feat(core): Update dependencies, enhance documentation, and improve error handling with clearer API usage examples

This commit is contained in:
2025-03-19 11:31:50 +00:00
parent d1788dc626
commit 2b51df90e6
12 changed files with 6073 additions and 2111 deletions

View File

@@ -10,7 +10,8 @@ export class CloudflareUtils {
public static isValidDomain(domainName: string): boolean {
try {
const domain = new plugins.smartstring.Domain(domainName);
return domain.isValid();
// Check if the domain has at least a TLD and a name
return domain.fullName.includes('.') && domain.zoneName.length > 0;
} catch (error) {
return false;
}
@@ -49,8 +50,9 @@ export class CloudflareUtils {
public static isValidRecordType(type: string): boolean {
const validTypes: plugins.tsclass.network.TDnsRecordType[] = [
'A', 'AAAA', 'CNAME', 'TXT', 'SRV', 'LOC', 'MX',
'NS', 'SPF', 'CERT', 'DNSKEY', 'DS', 'NAPTR', 'SMIMEA',
'NS', 'CAA', 'CERT', 'DNSKEY', 'DS', 'NAPTR', 'SMIMEA',
'SSHFP', 'TLSA', 'URI'
// Note: SPF has been removed as it's not in TDnsRecordType
];
return validTypes.includes(type as any);
}