feat(CloudflareAccount): Bump dependency versions and add domain support check in CloudflareAccount
This commit is contained in:
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@apiclient.xyz/cloudflare',
|
||||
version: '6.3.2',
|
||||
version: '6.4.0',
|
||||
description: 'A TypeScript client for managing Cloudflare accounts, zones, DNS records, and workers with ease.'
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import * as interfaces from './interfaces/index.js';
|
||||
import { WorkerManager } from './cloudflare.classes.workermanager.js';
|
||||
import { ZoneManager } from './cloudflare.classes.zonemanager.js';
|
||||
|
||||
export class CloudflareAccount {
|
||||
export class CloudflareAccount implements plugins.tsclass.network.IConvenientDnsProvider {
|
||||
private authToken: string;
|
||||
public preselectedAccountId: string;
|
||||
|
||||
@ -353,6 +353,24 @@ export class CloudflareAccount {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Determines whether the given domain can be managed by this account
|
||||
* @param domainName Full domain name to check (e.g., "sub.example.com")
|
||||
* @returns True if the zone for the domain exists in the account, false otherwise
|
||||
*/
|
||||
isDomainSupported: async (domainName: string): Promise<boolean> => {
|
||||
try {
|
||||
// Parse out the apex/zone name from the full domain
|
||||
const domain = new plugins.smartstring.Domain(domainName);
|
||||
// List zones filtered by the zone name
|
||||
const zones = await this.convenience.listZones(domain.zoneName);
|
||||
// If any zone matches, we can manage this domain
|
||||
return Array.isArray(zones) && zones.length > 0;
|
||||
} catch (error) {
|
||||
logger.log('error', `Error checking domain support for ${domainName}: ${error.message}`);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* purges a zone
|
||||
*/
|
||||
|
Reference in New Issue
Block a user