import { RecordEnumerator } from "./RecordEnumerator.js"; import { Input } from "./Input.js"; import { Database, UdbRecord } from "./db/index.js"; /** * Web page contents and its source url. */ export interface WebRecord { contents: string; source: string; } export type LinkCheck = (url: string) => boolean; export type WebRead = { done?: Promise; execute?: Function; }; /** * A Web source to read from. */ export declare class WebInput implements Input { private db; private baseUrl; private max; pages: WebRecord[]; recordIndex: number; maxConcurrent: number; queue: WebRead[]; readIdleDuration: number; private reading; private readPromises; constructor(db: Database, baseUrl: string, max?: number); enqueue(read: WebRead): WebRead; enqueueReadPage(url: string): WebRead; recordEnumerator(firstIndex: number, maxCount: number): RecordEnumerator; run(): Promise; readRecord(recordIndex: number): Promise; protected get logger(): import("../Logger.js").Logger; goToRecord(recordIndex: number): void; hasNext(): boolean; private fetch; /** * Read a web page. * * @param url The URL of the page to read. * @returns A promise to provide a web record. */ readPage(url: string): Promise; /** * Search a web record for anchor links. * * @param pageContents The web record to search into. * @param linkCheck A function to filter a link in. * @returns The array of found links. */ getLinks(pageContents: WebRecord, linkCheck: LinkCheck): string[]; private absoluteUrl; close(): void; addData(report: WebRecord): void; private removeData; }