@typecad/jlcpcb-parts
Version:
Intelligent fuzzy search for JLCPCB electrical components with CLI interface
51 lines • 1.95 kB
TypeScript
import { ComponentRecord } from '../types/index.js';
/**
* Manages component data including downloading, caching, and parsing.
* Supports both shared cache directory and custom cache directory modes.
*/
export declare class DataManager {
private readonly csvUrl;
private readonly localCsvFileName;
private readonly cacheDir;
private readonly useSharedCache;
private readonly timestampManager;
private readonly csvDownloader;
private readonly csvParser;
private cachedComponents;
private resolvedCsvPath;
/**
* Creates a new DataManager
* @param csvUrl URL to download the CSV file from
* @param localCsvFileName Name of the CSV file to save
* @param cacheDir Directory to store cache files (used when useSharedCache is false)
* @param cacheExpirationHours Number of hours before cache expires
* @param useSharedCache Whether to use shared cache directory (default: true)
*/
constructor(csvUrl?: string, localCsvFileName?: string, cacheDir?: string, cacheExpirationHours?: number, useSharedCache?: boolean);
/**
* Gets the resolved CSV file path, calculating it if needed
* @returns Promise that resolves to the CSV file path
*/
private getResolvedCsvPath;
/**
* Ensures that component data is available and up-to-date
* @returns Promise that resolves when data is available
*/
ensureDataAvailable(): Promise<void>;
/**
* Gets the component data, downloading if necessary
* @returns Promise that resolves to an array of ComponentRecord objects
*/
getCsvData(): Promise<ComponentRecord[]>;
/**
* Checks if the cache is stale
* @returns Promise that resolves to true if cache is stale
*/
isDataStale(): Promise<boolean>;
/**
* Downloads the CSV file from the remote URL
* @private
*/
private downloadCsvFile;
}
//# sourceMappingURL=DataManager.d.ts.map