UNPKG

@llml-browser/types

Version:

TypeScript types and schemas for the @llml-browser API

102 lines (100 loc) 2.42 kB
import { HTMLCleaningOptionsSchema } from "./chunk-54IS4CR5.mjs"; import { LinkExtractionOptionsSchema } from "./chunk-LAH43RYU.mjs"; import { MetadataOptionsSchema } from "./chunk-J6Y3C4TJ.mjs"; import { __export } from "./chunk-J5LGTIGS.mjs"; // src/routers/links/types.ts var types_exports = {}; __export(types_exports, { contentOptionsSchema: () => contentOptionsSchema, linksOptionsSchema: () => linksOptionsSchema }); import { z } from "zod"; var contentOptionsSchema = z.object({ /** * Options for metadata extraction. * Controls how metadata like title, description, etc. are extracted. */ metadataOptions: MetadataOptionsSchema.optional(), /** * Options for link extraction. * Controls how links are extracted and categorized. */ linksOptions: LinkExtractionOptionsSchema.optional(), /** * Options for HTML cleaning. * Controls how HTML is sanitized and cleaned. */ cleanedHtmlOptions: HTMLCleaningOptionsSchema.optional() }); var linksOptionsSchema = z.object({ /** * The URL to scrape. * Must be a valid URL string. */ url: z.string(), /** * Whether to build a site map tree. * Default: true */ // default true if not set tree: z.preprocess( (val) => val !== "false" && val !== false, z.boolean().optional() ), /** * Whether to extract metadata from the page. * Default: true */ // default true if not set metadata: z.preprocess( (val) => val !== "false" && val !== false, z.boolean().optional() ), /** * Whether to return cleaned HTML. * Default: false */ cleanedHtml: z.preprocess( (val) => val === "true" || val === true, z.boolean().optional() ), /** * Whether to fetch and parse robots.txt. * Default: false */ robots: z.preprocess( (val) => val === "true" || val === true, z.boolean().optional() ), /** * Whether to fetch and parse sitemap.xml. * Default: false */ sitemapXML: z.preprocess( (val) => val === "true" || val === true, z.boolean().optional() ), /** * Whether to include extracted links for each node in the tree. * Default: true */ extractedLinks: z.preprocess( (val) => val !== "false" && val !== false, z.boolean().optional() ), ...contentOptionsSchema.shape }); export { contentOptionsSchema, linksOptionsSchema, types_exports }; //# sourceMappingURL=chunk-GBJG7KDQ.mjs.map