/** * Data Source Registry * * Manages data sources across databases, graphs, and vector stores. * Provides unified access to underlying services (DatabaseService, GraphService, VectorService). */ import { DatabaseService } from '../../database/databases.service'; import { GraphService } from '../../graph/graphs.service'; import { VectorDatabaseService } from '../../vector/vector-database.service'; import { DataSourceType, IDataSource } from '../types'; /** * Registered data source with its service */ export interface IRegisteredDataSource { /** Data source tag */ tag: string; /** Source type */ type: DataSourceType; /** Environment */ env: string; /** Product tag */ product: string; /** Connection status */ status: 'connected' | 'disconnected' | 'error'; /** Last health check */ lastHealthCheck?: Date; /** Error message if status is 'error' */ error?: string; /** Metadata about the source (tables, indexes, etc.) */ metadata?: IDataSourceMetadata; } /** * Metadata about a data source */ export interface IDataSourceMetadata { /** Available entities (tables/labels/indexes) */ entities: string[]; /** Entity schemas */ schemas?: Record; /** Last updated */ updatedAt: Date; } /** * Entity schema (table/collection/label) */ export interface IEntitySchema { /** Entity name */ name: string; /** Fields/columns */ fields: IFieldSchema[]; /** Primary key fields */ primaryKey?: string[]; /** Indexes */ indexes?: IIndexSchema[]; } /** * Field schema */ export interface IFieldSchema { /** Field name */ name: string; /** Field type */ type: string; /** Nullable */ nullable: boolean; /** Default value */ defaultValue?: any; } /** * Index schema */ export interface IIndexSchema { /** Index name */ name: string; /** Indexed fields */ fields: string[]; /** Unique index */ unique: boolean; } /** * Registry configuration */ export interface IRegistryConfig { /** Enable automatic metadata caching */ cacheMetadata?: boolean; /** Metadata cache TTL in seconds */ metadataCacheTtl?: number; /** Enable health checks */ healthCheck?: boolean; /** Health check interval in seconds */ healthCheckInterval?: number; } /** * Data Source Registry * * Central registry for all data sources used by the warehouse. * Manages connections and provides access to underlying services. */ export declare class DataSourceRegistry { private readonly databaseService; private readonly graphService; private readonly vectorService; private readonly config; /** Registered data sources */ private sources; /** Metadata cache */ private metadataCache; /** Health check interval */ private healthCheckTimer?; constructor(databaseService: DatabaseService, graphService: GraphService, vectorService: VectorDatabaseService, config?: IRegistryConfig); /** * Register a database data source */ registerDatabase(tag: string, env: string, product: string): Promise; /** * Register a graph data source */ registerGraph(tag: string, env: string, product: string): Promise; /** * Register a vector data source */ registerVector(tag: string, env: string, product: string): Promise; /** * Unregister a data source */ unregister(tag: string): boolean; /** * Get a registered data source */ get(tag: string): IRegisteredDataSource | undefined; /** * Check if a data source is registered */ has(tag: string): boolean; /** * Get all registered data sources */ getAll(): IRegisteredDataSource[]; /** * Get data sources by type */ getByType(type: DataSourceType): IRegisteredDataSource[]; /** * Resolve a data source reference */ resolve(ref: IDataSource): IRegisteredDataSource; /** * Get the database service */ getDatabaseService(): DatabaseService; /** * Get the graph service */ getGraphService(): GraphService; /** * Get the vector service */ getVectorService(): VectorDatabaseService; /** * Get the appropriate service for a data source */ getService(source: IDataSource): DatabaseService | GraphService | VectorDatabaseService; /** * Get metadata for a data source */ getMetadata(tag: string, forceRefresh?: boolean): Promise; /** * Get entity schema */ getEntitySchema(tag: string, entity: string): Promise; /** * Validate that an entity exists in a data source */ validateEntity(source: IDataSource): Promise; /** * Check health of a data source */ checkHealth(tag: string): Promise; /** * Check health of all data sources */ checkAllHealth(): Promise>; /** * Start periodic health checks */ private startHealthChecks; /** * Stop health checks */ stopHealthChecks(): void; /** * Fetch metadata for a database */ private fetchDatabaseMetadata; /** * Fetch metadata for a graph */ private fetchGraphMetadata; /** * Fetch metadata for a vector store */ private fetchVectorMetadata; /** * Clean up resources */ destroy(): void; }