import { type EnvConfig } from '../../config/env.js'; import { type VendorCache } from '../cache.js'; /** * Component categories exposed by the public jlcsearch API * (https://jlcsearch.tscircuit.com), each backed by its own * `/{category}/list.json` endpoint. There is no generic cross-category * full-text search or single-part lookup endpoint — every lookup is a * category-scoped, in-stock-first snapshot capped at 100 results. */ export declare const LCSC_CATEGORIES: readonly ["resistors", "capacitors", "diodes", "mosfets", "leds", "microcontrollers", "switches", "led_drivers"]; export type LcscCategory = (typeof LCSC_CATEGORIES)[number]; export declare function isLcscCategory(value: string): value is LcscCategory; export interface LcscPart { lcsc: string; manufacturer: string; description: string; datasheet: string; stock: number; price: string; category: string; package: string; inStock: boolean; stockCount?: number; leadTime?: number; discontinued?: boolean; priceBreaks?: Array<{ quantity?: number; unitPrice?: number; }>; /** LCSC/JLCPCB assembly classification, when the backing dataset exposes it. */ classification?: 'basic' | 'preferred' | 'extended'; /** Parametric attributes (e.g. Resistance, Tolerance) as reported by the source. */ attributes?: Record; /** Whether this result was served from the vendor cache. */ fromCache?: boolean; /** Age of the cached data in seconds; 0 when live. */ cacheAgeSeconds?: number; } export interface LcscSearchResponse { parts: LcscPart[]; total: number; fromCache?: boolean; cacheAgeSeconds?: number; } export declare class LcscClient { private config; private logger; private jlcsearchBase; private lcscApiKey; private cache; private cacheTtlSeconds; constructor(config: EnvConfig, cache?: VendorCache); private jlcsearchRequest; private lcscOfficialRequest; /** Fetch one category's `list.json`, transparently caching the raw item list. */ private fetchCategory; /** * Search a single known category with jlcsearch's native parametric filters * (e.g. `package`, `resistance`, `capacitance`, `in_stock`). */ searchCategory(category: LcscCategory, filters?: Record, options?: { limit?: number; }): Promise; /** * Best-effort keyword search. jlcsearch has no generic full-text search * endpoint, so this maps recognizable keywords (resistor, mosfet, 0603, ...) * to one or more category snapshots and filters them client-side. Queries * that don't match a known category scan all categories with a small * per-category limit. */ searchParts(query: string, options?: { limit?: number; page?: number; }): Promise; /** * Get detailed information for a specific LCSC part by its LCSC code. * * jlcsearch has no single-part lookup endpoint, so this scans the cached * per-category snapshots (each capped at the top 100 in-stock parts) for a * matching `lcsc` id. Parts outside that in-stock snapshot will not be * found via the keyless tier even though they exist at LCSC — this is a * known limitation of the public dataset, not a bug. */ getPartDetail(lcscCode: string): Promise; private officialPartDetail; /** Get parts for a known category. Unknown categories return an empty list. */ getPartsByCategory(category: string): Promise; }