@llml-browser/types
Version:
TypeScript types and schemas for the @llml-browser API
128 lines (124 loc) • 4.8 kB
text/typescript
import { z } from 'zod';
/**
* Schema for configuring link extraction behavior.
* Defines validation rules for controlling how links are extracted from HTML.
*/
declare const LinkExtractionOptionsSchema: z.ZodObject<{
includeExternal: z.ZodOptional<z.ZodBoolean>;
includeMedia: z.ZodOptional<z.ZodBoolean>;
excludePatterns: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
removeQueryParams: z.ZodOptional<z.ZodBoolean>;
}, "strict", z.ZodTypeAny, {
includeExternal?: boolean | undefined;
includeMedia?: boolean | undefined;
excludePatterns?: string[] | undefined;
removeQueryParams?: boolean | undefined;
}, {
includeExternal?: boolean | undefined;
includeMedia?: boolean | undefined;
excludePatterns?: string[] | undefined;
removeQueryParams?: boolean | undefined;
}>;
/**
* Schema for storing extracted links by category.
* Defines the structure for organizing links extracted from a webpage.
*/
declare const ExtractedLinksSchema: z.ZodObject<{
internal: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
external: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
media: z.ZodOptional<z.ZodObject<{
images: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
videos: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
documents: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
}, "strip", z.ZodTypeAny, {
images?: string[] | undefined;
videos?: string[] | undefined;
documents?: string[] | undefined;
}, {
images?: string[] | undefined;
videos?: string[] | undefined;
documents?: string[] | undefined;
}>>;
}, "strip", z.ZodTypeAny, {
internal?: string[] | undefined;
external?: string[] | undefined;
media?: {
images?: string[] | undefined;
videos?: string[] | undefined;
documents?: string[] | undefined;
} | undefined;
}, {
internal?: string[] | undefined;
external?: string[] | undefined;
media?: {
images?: string[] | undefined;
videos?: string[] | undefined;
documents?: string[] | undefined;
} | undefined;
}>;
/**
* Configuration options for link extraction behavior.
* Controls which types of links are extracted and how they are processed.
*
* @property includeExternal - Whether to include links from other domains
* @property includeMedia - Whether to include media files (images, videos, docs)
* @property excludePatterns - List of regex patterns to exclude URLs
* @property removeQueryParams - Whether to remove query parameters from URLs
*
* @example
* ```typescript
* const options: LinkExtractionOptions = {
* includeExternal: false,
* includeMedia: true,
* excludePatterns: ['^/admin/', '\\.pdf$'],
* removeQueryParams: true
* };
* ```
*/
type LinkExtractionOptions = z.infer<typeof LinkExtractionOptionsSchema>;
/**
* Structure containing extracted links categorized by type.
* Organizes links extracted from a webpage into logical groups.
*
* @property internal - Array of links from the same domain
* @property external - Array of links from other domains
* @property media - Object containing arrays of media links categorized by type
* @property media.images - Array of image file URLs
* @property media.videos - Array of video file URLs
* @property media.documents - Array of document file URLs
*
* @example
* ```typescript
* const links: ExtractedLinks = {
* internal: [
* 'https://example.com/about',
* 'https://example.com/contact'
* ],
* external: [
* 'https://othersite.com/reference',
* 'https://api.example.org/data'
* ],
* media: {
* images: [
* 'https://example.com/images/logo.png',
* 'https://example.com/images/banner.jpg'
* ],
* videos: [
* 'https://example.com/videos/intro.mp4'
* ],
* documents: [
* 'https://example.com/docs/whitepaper.pdf'
* ]
* }
* };
* ```
*/
type ExtractedLinks = z.infer<typeof ExtractedLinksSchema>;
type LinkServiceTypes_ExtractedLinks = ExtractedLinks;
declare const LinkServiceTypes_ExtractedLinksSchema: typeof ExtractedLinksSchema;
type LinkServiceTypes_LinkExtractionOptions = LinkExtractionOptions;
declare const LinkServiceTypes_LinkExtractionOptionsSchema: typeof LinkExtractionOptionsSchema;
declare namespace LinkServiceTypes {
export { type LinkServiceTypes_ExtractedLinks as ExtractedLinks, LinkServiceTypes_ExtractedLinksSchema as ExtractedLinksSchema, type LinkServiceTypes_LinkExtractionOptions as LinkExtractionOptions, LinkServiceTypes_LinkExtractionOptionsSchema as LinkExtractionOptionsSchema };
}
export { ExtractedLinksSchema as E, LinkServiceTypes as L, LinkExtractionOptionsSchema as a, type LinkExtractionOptions as b, type ExtractedLinks as c };