import { VowelRoute } from '../../types'; import { SitemapParser, SitemapData, UrlEntry } from './sitemap'; /** * URL category information */ export interface UrlCategory { type: string; category: string; description: string; priority: string; } /** * URL categorizer interface * Implement this to provide platform-specific URL categorization */ export interface IUrlCategorizer { categorizeUrl(url: string): UrlCategory; } /** * Generic route generator * Converts sitemap data into voice-navigable routes with natural language descriptions * * @example * ```ts * const generator = new GenericRouteGenerator(); * const routes = await generator.generateRoutes('https://example.com'); * console.log(`Generated ${routes.length} routes`); * ``` */ export declare class GenericRouteGenerator { protected parser: SitemapParser; protected categorizer: IUrlCategorizer; constructor(categorizer?: IUrlCategorizer); /** * Generate routes from sitemap * Automatically discovers, categorizes, and prioritizes routes * * @param baseUrl - Base URL (e.g., "https://example.com") * @returns Array of voice-friendly routes */ generateRoutes(baseUrl: string): Promise; /** * Process sitemap data into routes * Handles both sitemap indexes and direct URL sets * Fault-tolerant: continues processing even if individual child sitemaps fail * * @param sitemapData - Parsed sitemap data * @param baseUrl - Base URL * @returns Generated routes */ protected processSitemapData(sitemapData: SitemapData, baseUrl: string): Promise; /** * Process URL set into categorized routes * Converts raw URLs into voice-friendly routes with descriptions * Fault-tolerant: skips malformed URLs and continues processing * * @param urls - URLs from sitemap * @param baseUrl - Base URL * @returns Categorized routes */ protected processUrlset(urls: UrlEntry[], baseUrl: string): VowelRoute[]; /** * Convert absolute URL to relative path * * @param absoluteUrl - Absolute URL * @param baseUrl - Base URL to remove * @returns Relative path */ protected getRelativePath(absoluteUrl: string, baseUrl: string): string; /** * Compare route priorities for sorting * * @param a - First route * @param b - Second route * @returns Comparison result */ protected comparePriority(a: VowelRoute, b: VowelRoute): number; /** * Get hardcoded routes that should always be available * Override in subclasses to provide platform-specific hardcoded routes * * @returns Hardcoded routes */ protected getHardcodedRoutes(): VowelRoute[]; /** * Get fallback routes when sitemap parsing fails * Override in subclasses to provide platform-specific fallback routes * * @returns Basic fallback routes */ protected getFallbackRoutes(): VowelRoute[]; } /** * Generic URL categorizer * Provides basic categorization for common URL patterns * Extend this class to add platform-specific categorization */ export declare class GenericUrlCategorizer implements IUrlCategorizer { /** * Categorize a URL based on its path pattern * Recognizes common URL patterns and generates natural descriptions * Fault-tolerant: handles malformed URLs gracefully * * @param url - URL to categorize * @returns Category information with type, description, and priority */ categorizeUrl(url: string): UrlCategory; /** * Get common pages mapping * Override in subclasses to add platform-specific pages * * @returns Common pages mapping */ protected getCommonPages(): Record; /** * Extract page description from URL path * Converts path to human-readable format * * @param pathname - URL path * @returns Human-readable description */ protected extractPageDescription(pathname: string): string; /** * Extract blog description from URL path * Converts path to human-readable format * * @param pathname - URL path * @returns Human-readable description */ protected extractBlogDescription(pathname: string): string; } //# sourceMappingURL=routes.d.ts.map