@typecad/kicad-symbols
Version:
Intelligent fuzzy search for KiCad symbols with CLI interface
109 lines • 3.4 kB
TypeScript
import { ComponentRecord } from '../types/index.js';
import { ProcessingProgress } from './KiCadLocalDataProcessor.js';
/**
* Data source modes for the DataManager
*/
export declare enum DataSourceMode {
/** Process local KiCad symbol files */
LOCAL_FILES = "local_files"
}
/**
* Configuration options for DataManager
*/
export interface DataManagerConfig {
/** Data source mode */
mode: DataSourceMode;
/** Custom KiCad symbols path (for local mode) */
customSymbolsPath?: string;
/** Enable progress reporting */
enableProgress: boolean;
/** Progress callback function */
progressCallback?: (progress: ProcessingProgress) => void;
}
/**
* Manages component data including caching and parsing
* Supports local file processing mode only
*/
export declare class DataManager {
private readonly localDataPath;
private readonly cacheManager;
private readonly localProcessor;
private readonly config;
private cachedComponents;
private currentMode;
private readonly useSharedCache;
/**
* Creates a new DataManager
* @param localDataPath Local path to save the data file (ignored if useSharedCache is true)
* @param cacheDir Directory to store cache files (ignored if useSharedCache is true)
* @param cacheExpirationHours Number of hours before cache expires
* @param config Optional configuration for data source mode and options
* @param useSharedCache Whether to use shared temp directory for cache files
*/
constructor(localDataPath?: string, cacheDir?: string, cacheExpirationHours?: number, config?: Partial<DataManagerConfig>, useSharedCache?: boolean);
/**
* Gets the cache file path, using shared cache directory if enabled
*/
private getCacheFilePath;
/**
* Ensures that component data is available and up-to-date
*/
ensureDataAvailable(): Promise<void>;
/**
* Ensures local data is available and up-to-date
*/
private ensureLocalDataAvailable;
/**
* Gets component data from the cache or processes local files
*/
getCsvData(): Promise<ComponentRecord[]>;
/**
* Checks if the local cache is valid
*/
isDataStale(): Promise<boolean>;
/**
* Saves component data to a JSON file
*/
private saveDataToFile;
/**
* Loads component data from the JSON file
*/
private loadDataFromFile;
/**
* Gets the current data source mode
*/
getCurrentMode(): DataSourceMode;
/**
* Checks if local KiCad symbols are available
*/
areLocalSymbolsAvailable(): Promise<boolean>;
/**
* Gets the path to local KiCad symbols
*/
getLocalSymbolsPath(): Promise<string | undefined>;
/**
* Forces a refresh of the data by clearing cache and reprocessing
*/
forceRefresh(): Promise<void>;
/**
* Gets processing statistics from the local processor
*/
getProcessingStatistics(): any;
/**
* Gets a summary of processing results
*/
getProcessingSummary(): string;
/**
* Checks if the local cache is valid
*/
private isLocalCacheValid;
/**
* Checks if symbol files are newer than the cache timestamp
*/
private hasNewerSymbolFiles;
/**
* Checks if a file exists
*/
private fileExists;
}
//# sourceMappingURL=DataManager.d.ts.map