@llml-browser/types
Version:
TypeScript types and schemas for the @llml-browser API
131 lines (129 loc) • 3.26 kB
JavaScript
import {
HTMLCleaningOptionsSchema
} from "./chunk-54IS4CR5.mjs";
import {
LinkExtractionOptionsSchema
} from "./chunk-LAH43RYU.mjs";
import {
MetadataOptionsSchema
} from "./chunk-5RX3GYMK.mjs";
import {
__export
} from "./chunk-J5LGTIGS.mjs";
// src/routers/links/types.ts
var types_exports = {};
__export(types_exports, {
contentOptionsSchema: () => contentOptionsSchema,
linksOptionsSchema: () => linksOptionsSchema,
treeOptionsSchema: () => treeOptionsSchema
});
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 treeOptionsSchema = z.object({
/**
* Whether to place folders before leaf nodes in the tree.
* Default: true
*/
folderFirst: z.preprocess(
(val) => val !== "false" && val !== false,
z.boolean().optional()
),
/**
* How to order links within each folder:
* - 'page' preserve the original document order
* - 'alphabetical' sort A→Z by URL
* Default: 'page'
*/
linksOrder: z.enum(["page", "alphabetical"]).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()
),
/**
* Whether to exclude subdomain as root URL.
* Default: true
* e.g., if false: rootUrl: https://swr.vercel.app -> https://vercel.app
*/
subdomainAsRootUrl: z.preprocess(
(val) => val !== "false" && val !== false,
z.boolean().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()
),
...treeOptionsSchema.shape,
...contentOptionsSchema.shape
});
export {
contentOptionsSchema,
treeOptionsSchema,
linksOptionsSchema,
types_exports
};
//# sourceMappingURL=chunk-XGNDRAIX.mjs.map