/** * Source Adapter Registry * Manages registration and lifecycle of source adapters */ import type { ISourceAdapter } from './ISourceAdapter.js'; import type { SourceConfig, SourceHealth, SourceType } from './types.js'; /** * Factory function type for creating source adapters */ export type SourceAdapterFactory = (config: SourceConfig) => ISourceAdapter; /** * Registry for managing source adapters * * Features: * - Register adapter factories by type * - Create adapter instances from configuration * - Manage adapter lifecycle (initialize, dispose) * - Query adapters by type or ID * * @example * ```typescript * const registry = new SourceAdapterRegistry() * * // Register factory for GitHub adapters * registry.registerFactory('github', (config) => new GitHubSourceAdapter(config)) * * // Create an adapter instance * const adapter = await registry.create({ * id: 'github-main', * name: 'GitHub Main', * type: 'github', * baseUrl: 'https://api.github.com', * enabled: true * }) * * // Use the adapter * const results = await adapter.search({ topics: ['claude-skill'] }) * ``` */ export declare class SourceAdapterRegistry { private factories; private adapters; /** * Register a factory for creating adapters of a specific type * * @param type - Source type identifier * @param factory - Factory function to create adapters */ registerFactory(type: SourceType | string, factory: SourceAdapterFactory): void; /** * Unregister a factory * * @param type - Source type to unregister */ unregisterFactory(type: SourceType | string): void; /** * Check if a factory is registered for a type * * @param type - Source type to check */ hasFactory(type: SourceType | string): boolean; /** * Get all registered factory types */ getRegisteredTypes(): string[]; /** * Create and register an adapter instance * * @param config - Adapter configuration * @param autoInitialize - Whether to initialize immediately (default: true) * @returns The created adapter */ create(config: SourceConfig, autoInitialize?: boolean): Promise; /** * Get an adapter by ID * * @param id - Adapter ID * @returns The adapter, or undefined if not found */ get(id: string): ISourceAdapter | undefined; /** * Get an adapter by ID, throwing if not found * * @param id - Adapter ID * @returns The adapter * @throws Error if adapter not found */ getOrThrow(id: string): ISourceAdapter; /** * Get all adapters of a specific type * * @param type - Source type to filter by * @returns Array of matching adapters */ getByType(type: SourceType | string): ISourceAdapter[]; /** * Get all enabled adapters */ getEnabled(): ISourceAdapter[]; /** * Get all registered adapters */ getAll(): ISourceAdapter[]; /** * Check if an adapter exists * * @param id - Adapter ID to check */ has(id: string): boolean; /** * Initialize an adapter if not already initialized * * @param id - Adapter ID */ initialize(id: string): Promise; /** * Initialize all registered adapters */ initializeAll(): Promise; /** * Remove and dispose an adapter * * @param id - Adapter ID to remove */ remove(id: string): Promise; /** * Remove and dispose all adapters */ removeAll(): Promise; /** * Check health of all enabled adapters * * @returns Map of adapter ID to health status */ checkHealthAll(): Promise>; /** * Get registry statistics */ getStats(): RegistryStats; private countByType; } /** * Registry statistics */ export interface RegistryStats { totalFactories: number; totalAdapters: number; enabledAdapters: number; initializedAdapters: number; adaptersByType: Record; } /** * Default global registry instance */ export declare const defaultRegistry: SourceAdapterRegistry; //# sourceMappingURL=SourceAdapterRegistry.d.ts.map