@langchain/community
Version:
Third-party integrations for LangChain.js
1 lines • 4.51 kB
Source Map (JSON)
{"version":3,"file":"puppeteer.d.ts","names":["launch","WaitForOptions","Page","Browser","PuppeteerLaunchOptions","connect","ConnectOptions","Document","BaseDocumentLoader","DocumentLoader","PuppeteerGotoOptions","PuppeteerEvaluate","Promise","PuppeteerWebBaseLoaderOptions","PuppeteerWebBaseLoader"],"sources":["../../../src/document_loaders/web/puppeteer.d.ts"],"sourcesContent":["import type { launch, WaitForOptions, Page, Browser, PuppeteerLaunchOptions, connect, ConnectOptions } from \"puppeteer\";\nimport { Document } from \"@langchain/core/documents\";\nimport { BaseDocumentLoader } from \"@langchain/core/document_loaders/base\";\nimport type { DocumentLoader } from \"@langchain/core/document_loaders/base\";\nexport { Page, Browser };\nexport type PuppeteerGotoOptions = WaitForOptions & {\n referer?: string;\n referrerPolicy?: string;\n};\n/**\n * Type representing a function for evaluating JavaScript code on a web\n * page using Puppeteer. It takes a Page and Browser object as parameters\n * and returns a Promise that resolves to a string.\n */\nexport type PuppeteerEvaluate = (page: Page, browser: Browser) => Promise<string>;\nexport type PuppeteerWebBaseLoaderOptions = {\n launchOptions?: PuppeteerLaunchOptions & ConnectOptions;\n gotoOptions?: PuppeteerGotoOptions;\n evaluate?: PuppeteerEvaluate;\n};\n/**\n * Class that extends the BaseDocumentLoader class and implements the\n * DocumentLoader interface. It represents a document loader for scraping\n * web pages using Puppeteer.\n * @example\n * ```typescript\n * const loader = new PuppeteerWebBaseLoader(\"https:exampleurl.com\", {\n * launchOptions: {\n * headless: true,\n * },\n * gotoOptions: {\n * waitUntil: \"domcontentloaded\",\n * },\n * });\n * const screenshot = await loader.screenshot();\n * ```\n */\nexport declare class PuppeteerWebBaseLoader extends BaseDocumentLoader implements DocumentLoader {\n webPath: string;\n options: PuppeteerWebBaseLoaderOptions | undefined;\n constructor(webPath: string, options?: PuppeteerWebBaseLoaderOptions);\n static _scrape(url: string, options?: PuppeteerWebBaseLoaderOptions): Promise<string>;\n /**\n * Method that calls the _scrape method to perform the scraping of the web\n * page specified by the webPath property.\n * @returns Promise that resolves to the scraped HTML content of the web page.\n */\n scrape(): Promise<string>;\n /**\n * Method that calls the scrape method and returns the scraped HTML\n * content as a Document object.\n * @returns Promise that resolves to an array of Document objects.\n */\n load(): Promise<Document[]>;\n /**\n * Static class method used to screenshot a web page and return\n * it as a {@link Document} object where the pageContent property\n * is the screenshot encoded in base64.\n *\n * @param {string} url\n * @param {PuppeteerWebBaseLoaderOptions} options\n * @returns {Document} A document object containing the screenshot of the page encoded in base64.\n */\n static _screenshot(url: string, options?: PuppeteerWebBaseLoaderOptions): Promise<Document>;\n /**\n * Screenshot a web page and return it as a {@link Document} object where\n * the pageContent property is the screenshot encoded in base64.\n *\n * @returns {Promise<Document>} A document object containing the screenshot of the page encoded in base64.\n */\n screenshot(): Promise<Document>;\n /**\n * Static method that imports the necessary Puppeteer modules. It returns\n * a Promise that resolves to an object containing the imported modules.\n * @returns Promise that resolves to an object containing the imported Puppeteer modules.\n */\n static imports(): Promise<{\n launch: typeof launch;\n connect: typeof connect;\n }>;\n}\n//# sourceMappingURL=puppeteer.d.ts.map"],"mappings":";;;;;AAKYU,KAAAA,oBAAAA,GAAuBT,cAAAA,GAAAA;EASvBU,OAAAA,CAAAA,EAAAA,MAAAA;EAA2BT,cAAAA,CAAAA,EAAAA,MAAAA;CAAeC;;AAAmB;AACzE;;;AAEkBO,KAHNC,iBAAAA,GAGMD,CAAAA,IAAAA,EAHqBR,IAGrBQ,EAAAA,OAAAA,EAHoCP,OAGpCO,EAAAA,GAHgDE,OAGhDF,CAAAA,MAAAA,CAAAA;AACHC,KAHHE,6BAAAA,GAGGF;EAAiB,aAAA,CAAA,EAFZP,sBAEY,GAFaE,cAEb;EAmBXQ,WAAAA,CAAAA,EApBHJ,oBAoByB;EAE9BG,QAAAA,CAAAA,EArBEF,iBAqBFE;CAC8BA;;;;;;;;;;;;;;;;AAHqD;;cAA3EC,sBAAAA,SAA+BN,kBAAAA,YAA8BC;;WAErEI;yCAC8BA;wCACDA,gCAAgCD;;;;;;YAM5DA;;;;;;UAMFA,QAAQL;;;;;;;;;;4CAU0BM,gCAAgCD,QAAQL;;;;;;;gBAOpEK,QAAQL;;;;;;oBAMJK;mBACCZ;oBACCK"}