(domain: string)
| 114 | * Returns the normalized domain on success, throws on validation failure. |
| 115 | */ |
| 116 | export async function validateCrawlDomain(domain: string): Promise<string> { |
| 117 | const normalized = domain.toLowerCase().trim(); |
| 118 | if (!DOMAIN_RE.test(normalized)) { |
| 119 | throw new Error('Invalid domain format'); |
| 120 | } |
| 121 | await validateHostResolution(normalized); |
| 122 | return normalized; |
| 123 | } |
| 124 | |
| 125 | /** |
| 126 | * Validate an externally-reachable URL the server will contact on the caller's |
no test coverage detected