UNPKG

@hasna/domains

Version:

Domain portfolio, registrar, marketplace, and DNS management for AI agents — CLI + MCP + HTTP API + SDK, shared account API and PostgreSQL

47 lines (46 loc) • 2.27 kB
// src/lib/capability.ts var PROVIDER_CAPABILITIES = { route53: { canBuy: true, canDns: true, gated: false, notes: "Full self-serve buy + hosted zones via AWS API; primary buy path." }, cloudflare: { canBuy: false, canDns: true, gated: false, notes: "DNS/zone management only; not a registrar." }, namecheap: { canBuy: true, canDns: true, gated: false, notes: "Buy + DNS via API; requires API access + whitelisted IP." }, godaddy: { canBuy: false, canDns: true, gated: true, notes: "Availability remains threshold-gated; this CLI supports sync/renew/DNS records where account access qualifies, but not direct automated purchase." }, brandsight: { canBuy: true, canDns: true, gated: true, notes: "GoDaddy Corporate Domains (enterprise/contract-only); this CLI supports portfolio, registration, renewal, nameserver, and DNS operations through the official v2 API when the account contract permits it." }, sedo: { canBuy: false, canDns: false, gated: true, notes: "Marketplace API only: search/portfolio/listings and recorded purchases; no registrar DNS or direct registration API in this CLI." } }; var UNKNOWN = { canBuy: false, canDns: false, gated: true, notes: "Unknown provider." }; function getCapability(name) { return PROVIDER_CAPABILITIES[name.toLowerCase()] ?? UNKNOWN; } function canBuy(name) { const c = getCapability(name); return c.canBuy && !c.gated; } function selectBuyRegistrar(preference) { if (preference) { const c = getCapability(preference); if (!c.canBuy) throw new Error(`Registrar '${preference}' cannot buy domains`); if (c.gated) throw new Error(`Registrar '${preference}' is gated/enterprise-only and not available for automated purchase: ${c.notes}`); return preference.toLowerCase(); } return "route53"; } function selectDnsProvider(preference) { if (preference) { const c = getCapability(preference); if (!c.canDns) throw new Error(`Provider '${preference}' cannot manage DNS`); if (c.gated) throw new Error(`Provider '${preference}' DNS is gated and may require account approval: ${c.notes}`); return preference.toLowerCase(); } return "cloudflare"; } export { PROVIDER_CAPABILITIES, canBuy, getCapability, selectBuyRegistrar, selectDnsProvider };