UNPKG

@llml-browser/types

Version:

TypeScript types and schemas for the @llml-browser API

92 lines (90 loc) 2.49 kB
import { HTMLCleaningOptionsSchema } from "./chunk-54IS4CR5.mjs"; import { ExtractedLinksSchema, LinkExtractionOptionsSchema } from "./chunk-LAH43RYU.mjs"; import { MetadataOptionsSchema, PageMetadataSchema } from "./chunk-J6Y3C4TJ.mjs"; import { __export } from "./chunk-J5LGTIGS.mjs"; // src/routers/browse/types.ts var types_exports = {}; __export(types_exports, { BrowseOptionsSchema: () => BrowseOptionsSchema, DataFormatsEnum: () => DataFormatsEnum }); import { z } from "zod"; var DataFormatsSchema = z.object({ /** * Markdown representation of the page content. * Contains the page content converted to Markdown format. */ markdown: z.string().optional(), /** * Raw HTML of the page as returned by the server. * Contains the unmodified HTML response from the target URL. */ rawHtml: z.string().optional(), /** * Cleaned HTML with unnecessary elements removed. * Contains a sanitized version of the HTML with ads, scripts, and other non-content elements removed. */ cleanedHtml: z.string().optional(), /** * Extracted links from the page. * Contains information about links found on the page. */ links: ExtractedLinksSchema.optional(), /** * Metadata extracted from the page. * Contains information like title, description, and other meta tags. */ metadata: PageMetadataSchema.optional() }); var DataFormatsEnum = z.enum([ "markdown", "rawHtml", "cleanedHtml", "links", "metadata" ]); var BrowseOptionsSchema = z.object({ /** * Array of data formats to include in the response. * If not specified, defaults to ['markdown', 'metadata']. * * @example * ```typescript * const options = { * formats: ['markdown', 'links', 'metadata'] * }; * ``` */ formats: z.array(DataFormatsEnum).optional().default(["markdown", "metadata"]), /** * Options for metadata extraction. * If not specified, defaults to the default metadata options. */ metadataOptions: MetadataOptionsSchema.optional(), /** * Options for link extraction. * If not specified, defaults to the default link extraction options. */ linksOptions: LinkExtractionOptionsSchema.optional(), /** * Options for HTML cleaning. * If not specified, defaults to the default HTML cleaning options. */ cleanedHtmlOptions: HTMLCleaningOptionsSchema.optional() }); export { DataFormatsEnum, BrowseOptionsSchema, types_exports }; //# sourceMappingURL=chunk-QAQ7DWXG.mjs.map