/** * Shared type definitions for DongneLibrary */ /** * Library information with code and name */ export interface LibraryInfo { code: string; name: string; } /** * Options for book search */ export interface SearchOptions { title: string; libraryName: string; startPage?: number; signal?: AbortSignal; } /** * Individual book information */ export interface Book { libraryName: string; title: string; exist: boolean; bookUrl?: string; maxoffset?: number | string; } /** * Search result containing book list and metadata */ export interface SearchResult { title?: string; libraryName?: string; homeUrl?: string; totalBookCount: number | string; startPage?: number; booklist: Book[]; } /** * Error object returned by search functions */ export interface SearchError { msg: string; } /** * Callback function signature for search operations */ export type SearchCallback = (err: SearchError | null, result?: SearchResult) => void; /** * HTTP response structure */ export interface HttpResponse { statusCode: number; body: string; } /** * Options for HTTP requests */ export interface HttpOptions { qs?: Record; form?: Record; headers?: Record; timeout?: number; signal?: AbortSignal; } /** * HTTP session interface for cookie-based requests */ export interface HttpSession { get(url: string, options?: HttpOptions): Promise; post(url: string, options?: HttpOptions): Promise; } /** * Library module interface - each library scraper must export these */ export interface LibraryModule { moduleName: string; search: (opt: SearchOptions, callback?: SearchCallback) => Promise; getLibraryNames: () => string[]; homeUrl: string; } /** * Internal library registry entry */ export interface LibraryRegistryEntry { name: string; search: LibraryModule["search"]; homeUrl: string; } /** * Callback function signature for search completion */ export type SearchCompleteCallback = (err: SearchError | null, results?: SearchResult[]) => void; /** * Options for the main search API */ export interface SearchOptionsMain { title: string; libraryName: string | string[]; signal?: AbortSignal; } /** * Public API interface for DongneLibrary */ export interface DongneLibraryAPI { resolveLibraryCount: (libraryName: string | string[]) => number; getAllLibraryNames: () => string[]; getAllModuleNames: () => string[]; getModuleHomeUrls: () => Record; isModuleName: (name: string) => boolean; searchAsync: (opt: SearchOptionsMain, onResult?: SearchCallback) => Promise; search: (opt: SearchOptionsMain | undefined | null, onResult?: SearchCallback, onComplete?: SearchCompleteCallback) => void; } //# sourceMappingURL=types.d.ts.map