@aoxborrow/registrar-client 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/dist/index.cjs +9 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/registrars/cloudflare.ts +1 -0
- package/src/registrars/dynadot.ts +1 -0
- package/src/registrars/gandi.ts +1 -0
- package/src/registrars/godaddy.ts +1 -0
- package/src/registrars/namebright.ts +1 -0
- package/src/registrars/namecheap.ts +1 -0
- package/src/registrars/namesilo.ts +1 -0
- package/src/registrars/porkbun.ts +1 -0
- package/src/registrars/spaceship.ts +1 -0
- package/src/types.ts +4 -2
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/errors.ts","../src/utils.ts","../src/client.ts","../src/portfolio.ts","../src/constants.ts","../src/http.ts","../src/features.ts","../src/registrar.ts","../src/registrars/cloudflare.ts","../src/registrars/dynadot.ts","../src/registrars/gandi.ts","../src/registrars/godaddy.ts","../src/registrars/namebright.ts","../src/xml.ts","../src/registrars/namecheap.ts","../src/registrars/namesilo.ts","../src/registrars/porkbun.ts","../src/registrars/spaceship.ts","../src/registrars/index.ts"],"names":["d","text","sleep","body","toContact","toDnsRecord","res","joinPhone","isOk","toPrice","statusResult","isYes"],"mappings":";;;AACO,SAAS,iBAAiB,KAAA,EAAgC;AAE/D,EAAA,IAAI,iBAAiB,cAAA,EAAgB;AACnC,IAAA,OAAO,KAAA;AAAA,EACT;AAGA,EAAA,MAAM,UACJ,KAAA,YAAiB,KAAA,GAAQ,MAAM,OAAA,GAAU,MAAA,CAAO,KAAK,CAAA,IAAK,2BAAA;AAG5D,EAAA,MAAM,OAAA,GAAU,IAAK,cAAc,cAAA,CAAe;AAAA,IAAI,OAAO,CAAA;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,cAAc,CAAA,CAAE,YAAA;AAAA,IAChB,OAAO,CAAA,CAAE,KAAA;AAAA,IACT,OAAO,CAAA,CAAE,KAAA;AAAA,IACT,KAAK,CAAA,CAAE,GAAA;AAAA,IACP,UAAU,CAAA,CAAE,QAAA;AAAA,IACZ,UAAU,CAAA,CAAE,QAAA;AAAA,IACZ,MAAM,CAAA,CAAE,IAAA;AAAA,IACR,eAAe,CAAA,CAAE,KAAA;AAAA,IACjB,YAAY,CAAA,CAAE,UAAA;AAAA,IACd,SAAS,CAAA,CAAE;AAAA,GACb;AACF;;;AC9sBO,IAAM,UAAA,GAAa;AAAA,EACxB,UAAA,EAAY,mBAAA;AAAA,EACZ,OAAA,EAAS,gBAAA;AAAA,EACT,KAAA,EAAO,cAAA;AAAA,EACP,OAAA,EAAS,gBAAA;AAAA,EACT,UAAA,EAAY,mBAAA;AAAA,EACZ,SAAA,EAAW,kBAAA;AAAA,EACX,QAAA,EAAU,iBAAA;AAAA,EACV,OAAA,EAAS,gBAAA;AAAA,EACT,SAAA,EAAW;AACb;AAMO,SAAS,eAAA,CACd,IAAA,EACA,WAAA,EACA,OAAA,EACW;AACX,EAAA,MAAM,cAAA,GAAiB,WAAW,IAAI,CAAA;AACtC,EAAA,OAAO,IAAI,cAAA,CAAe,WAAA,EAAa,OAAO,CAAA;AAChD","file":"index.js","sourcesContent":["// convert any thrown value to a RegistrarError (preserves existing RegistrarError instances)\nexport function toRegistrarError(error: unknown): RegistrarError {\n // already a RegistrarError, return as-is\n if (error instanceof RegistrarError) {\n return error;\n }\n\n // extract message from Error or convert unknown to string\n const message =\n error instanceof Error ? error.message : String(error) || 'An unknown error occurred';\n\n // wrap in a concrete RegistrarError instance\n const wrapped = new (class extends RegistrarError {})(message);\n\n // preserve the original error's identity where possible\n if (error instanceof Error) {\n wrapped.name = error.name;\n wrapped.stack = error.stack;\n } else {\n wrapped.name = 'RegistrarError';\n }\n\n return wrapped;\n}\n\n// base error class for registrar client errors\n// `status` mirrors an HTTP-style status code where meaningful\nexport class RegistrarError extends Error {\n public status: number;\n // optional machine-readable code from the underlying registrar API\n public providerCode?: string;\n\n constructor(message: string) {\n super(message);\n this.name = 'RegistrarError';\n this.status = -1;\n\n Object.setPrototypeOf(this, new.target.prototype);\n\n // maintain proper stack trace (V8/Node only)\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n }\n }\n\n // determine if this error should trigger a retry\n // overridden by subclasses for custom logic\n shouldRetry(): boolean {\n return false;\n }\n}\n\n// base class for transient errors that are safe to retry\nexport class RetryableRegistrarError extends RegistrarError {\n constructor(message: string) {\n super(message);\n this.name = 'RetryableRegistrarError';\n }\n\n shouldRetry(): boolean {\n return true;\n }\n}\n\n// request timed out\nexport class TimeoutError extends RetryableRegistrarError {\n public status = 408; // Request Timeout\n\n constructor(message: string) {\n super(message);\n this.name = 'TimeoutError';\n }\n}\n\n// network/connection failure reaching the registrar API\nexport class ConnectionError extends RetryableRegistrarError {\n public status = 503; // Service Unavailable\n\n constructor(message: string) {\n super(message);\n this.name = 'ConnectionError';\n }\n}\n\n// registrar API rejected the credentials\nexport class AuthenticationError extends RegistrarError {\n public status = 401; // Unauthorized\n\n constructor(message: string) {\n super(message);\n this.name = 'AuthenticationError';\n }\n}\n\n// caller lacks permission for the requested operation\nexport class AuthorizationError extends RegistrarError {\n public status = 403; // Forbidden\n\n constructor(message: string) {\n super(message);\n this.name = 'AuthorizationError';\n }\n}\n\n// requested resource (domain, contact, etc.) was not found\nexport class NotFoundError extends RegistrarError {\n public status = 404; // Not Found\n\n constructor(message: string) {\n super(message);\n this.name = 'NotFoundError';\n }\n}\n\n// registrar API rate limit exceeded\nexport class RateLimitError extends RetryableRegistrarError {\n public status = 429; // Too Many Requests\n // seconds to wait before retrying, if provided by the API\n public retryAfter?: number;\n\n constructor(message: string, retryAfter?: number) {\n super(message);\n this.name = 'RateLimitError';\n this.retryAfter = retryAfter;\n }\n}\n\n// registrar API returned a response we couldn't understand\nexport class InvalidResponseError extends RetryableRegistrarError {\n public status = 502; // Bad Gateway\n\n constructor(message: string) {\n super(message);\n this.name = 'InvalidResponseError';\n }\n}\n\n// failed to parse a response payload\nexport class ParsingError extends RegistrarError {\n public status = 422; // Unprocessable Entity\n\n constructor(message: string) {\n super(message);\n this.name = 'ParsingError';\n }\n}\n\n// invalid client configuration or arguments\nexport class ConfigurationError extends RegistrarError {\n public status = 500; // Internal Server Error\n\n constructor(message: string) {\n super(message);\n this.name = 'ConfigurationError';\n }\n}\n\n// a registration/transfer was attempted without the consent the registrar\n// requires (accepting its registration agreements). Distinct from\n// NotImplementedError: the capability exists, but the caller must supply consent.\nexport class ConsentRequiredError extends RegistrarError {\n public status = 400; // Bad Request\n\n constructor(message: string) {\n super(message);\n this.name = 'ConsentRequiredError';\n }\n}\n\n// the requested capability is not implemented by this provider\nexport class NotImplementedError extends RegistrarError {\n public status = 501; // Not Implemented\n\n constructor(message: string) {\n super(message);\n this.name = 'NotImplementedError';\n }\n}\n\n// request was cancelled via an AbortSignal\nexport class AbortError extends RegistrarError {\n public status = 499; // Client Closed Request\n\n constructor(message: string) {\n super(message);\n this.name = 'AbortError';\n }\n\n shouldRetry(): boolean {\n return false;\n }\n}\n","import type { DomainForward, Domain, DomainInput, RegistrationConsent } from './types';\nimport { ConsentRequiredError } from './errors';\n\n// sleep helper for retry backoff\nexport function sleep(ms: number): Promise<void> {\n return new Promise(resolve => setTimeout(resolve, ms));\n}\n\n// a DomainForward that is safe to write: masked/framed forwarding is read-only.\nexport type SettableDomainForward = DomainForward & { type: 'temporary' | 'permanent' };\n\nexport const MASKED_FORWARD_UNSUPPORTED =\n 'masked/framed forwarding is not supported by this library; use \"temporary\" or \"permanent\"';\n\n// Guard for `setDomainForwarding`: reject any masked/framed forward up front (so\n// no partial write happens) and narrow the list to the settable types. Providers\n// call this before writing.\nexport function settableForwards(forwards: DomainForward[]): SettableDomainForward[] {\n for (const f of forwards) {\n if (f.type === 'masked') throw new Error(MASKED_FORWARD_UNSUPPORTED);\n }\n return forwards as SettableDomainForward[];\n}\n\n// guard for register/transfer: registration forms a legal contract with the\n// registry, so a provider must be given explicit consent. Throws\n// ConsentRequiredError (distinct from NotImplementedError) when it's absent.\nexport function requireConsent(\n provider: string,\n consent: RegistrationConsent | undefined\n): RegistrationConsent {\n if (!consent) {\n throw new ConsentRequiredError(\n `${provider}: this operation requires consent — supply \\`consent\\` ` +\n '(accepting the registrar’s registration agreements)'\n );\n }\n return consent;\n}\n\n// filter a domain list by a case-insensitive substring of the domain name.\n// Providers that filter server-side still call this — the re-filter is a\n// harmless no-op there — so every provider applies `search` consistently.\nexport function filterDomains(domains: Domain[], search?: string): Domain[] {\n const q = search?.trim().toLowerCase();\n if (!q) return domains;\n return domains.filter(d => d.domainName.toLowerCase().includes(q));\n}\n\n// normalize a domain name: trim, lowercase, strip a single trailing dot\nexport function normalizeDomain(domain: string): string {\n return domain.trim().toLowerCase().replace(/\\.$/, '');\n}\n\n// exponential backoff delay: backoff * 2^attempt\nexport function backoffDelay(backoff: number, attempt: number): number {\n return backoff * Math.pow(2, attempt);\n}\n\n// parse a variety of date representations into a Date (or null)\n// handles ISO strings, epoch millis (as number or numeric string), and Date\nexport function parseDate(value: Date | string | number | null | undefined): Date | null {\n if (value == null || value === '') return null;\n if (value instanceof Date) return isNaN(value.getTime()) ? null : value;\n\n // numeric epoch millis (e.g. Dynadot returns ms timestamps)\n if (typeof value === 'number') {\n const d = new Date(value);\n return isNaN(d.getTime()) ? null : d;\n }\n\n // numeric string that looks like an epoch-millis timestamp\n const asNumber = Number(value);\n if (!isNaN(asNumber) && asNumber > 1_000_000_000_000) {\n const d = new Date(asNumber);\n return isNaN(d.getTime()) ? null : d;\n }\n\n const d = new Date(value);\n return isNaN(d.getTime()) ? null : d;\n}\n\n// normalize nameservers into a flat array of hostname strings.\n// accepts: string[], { hosts: string[] } (Spaceship), or objects with a\n// ServerName property (Dynadot), falling back to String() for anything else.\n// Hostnames are trimmed and lowercased (they're case-insensitive, but providers\n// return mixed case), and blanks are dropped.\nexport function normalizeNameservers(nameservers: unknown): string[] {\n if (!nameservers) return [];\n\n let raw: unknown[];\n\n // object with a `hosts` array (Spaceship shape)\n if (\n typeof nameservers === 'object' &&\n !Array.isArray(nameservers) &&\n Array.isArray((nameservers as { hosts?: unknown }).hosts)\n ) {\n raw = (nameservers as { hosts: unknown[] }).hosts;\n } else if (Array.isArray(nameservers)) {\n raw = nameservers;\n } else {\n return [];\n }\n\n return raw\n .map(ns => {\n if (typeof ns === 'string') return ns;\n if (ns && typeof ns === 'object' && 'ServerName' in ns) {\n return String(ns.ServerName);\n }\n return String(ns);\n })\n .map(host => host.trim().toLowerCase())\n .filter(Boolean);\n}\n\n// build a normalized Domain from loose provider input:\n// lowercases status, normalizes nameservers, and coerces dates.\nexport function createDomain(data: DomainInput = {}): Domain {\n return {\n domainName: data.domainName ?? '',\n registrar: data.registrar ?? '',\n status: (data.status ?? '').toLowerCase(),\n createdDate: parseDate(data.createdDate),\n expirationDate: parseDate(data.expirationDate),\n renewalDate: parseDate(data.renewalDate),\n autoRenew: data.autoRenew ?? false,\n locked: data.locked ?? false,\n privacy: data.privacy ?? false,\n nameservers: normalizeNameservers(data.nameservers),\n syncedAt: data.syncedAt ?? new Date(),\n deleted: data.deleted ?? false,\n };\n}\n","import { normalizeDomain, normalizeNameservers } from './utils';\nimport type {\n ConnectionResult,\n ContactSet,\n DnsRecord,\n Domain,\n DomainAvailability,\n DomainForward,\n EmailForward,\n ListDomainsOptions,\n OperationResult,\n Registrar,\n RegisterDomainInput,\n RequestOptions,\n TldPricing,\n TransferDomainInput,\n} from './types';\n\n// A thin, provider-agnostic facade over a single `Registrar`. Normalizes\n// domain names and delegates to the underlying provider.\n//\n// const client = new RegistrarClient(createRegistrar('cloudflare', creds));\n// await client.listDomains();\nexport class RegistrarClient {\n constructor(public readonly provider: Registrar) {}\n\n testConnection(opts?: RequestOptions): Promise<ConnectionResult> {\n return this.provider.testConnection(opts);\n }\n\n async listDomains(opts?: ListDomainsOptions): Promise<Domain[]> {\n const domains = await this.provider.listDomains(opts);\n if (!opts?.detailed) return domains;\n return this.enrichWithDetail(domains, opts);\n }\n\n // Fills fields that a provider's list endpoint omits (nameservers, privacy,\n // lock) by fetching each domain's detail and merging it over the summary.\n // Runs with bounded concurrency; a per-domain detail failure leaves that\n // domain's summary values untouched rather than failing the whole listing.\n private async enrichWithDetail(domains: Domain[], opts: RequestOptions): Promise<Domain[]> {\n const CONCURRENCY = 5;\n const result = [...domains];\n let next = 0;\n const worker = async (): Promise<void> => {\n while (next < domains.length) {\n const index = next++;\n const name = domains[index].domainName;\n try {\n const detail = await this.provider.getDomain(name, opts);\n let merged = { ...domains[index], ...detail };\n // Some providers expose nameservers only via a dedicated endpoint, not\n // on the domain detail — fetch them separately when still empty.\n if (merged.nameservers.length === 0) {\n try {\n const nameservers = normalizeNameservers(\n await this.provider.getNameservers(name, opts)\n );\n if (nameservers.length > 0) merged = { ...merged, nameservers };\n } catch {\n // leave nameservers empty if this provider can't supply them\n }\n }\n result[index] = merged;\n } catch {\n // keep the summary values for this domain on detail failure\n }\n }\n };\n const workers = Array.from({ length: Math.min(CONCURRENCY, domains.length) }, worker);\n await Promise.all(workers);\n return result;\n }\n\n getDomain(domainName: string, opts?: RequestOptions): Promise<Domain> {\n return this.provider.getDomain(normalizeDomain(domainName), opts);\n }\n\n checkAvailability(domainNames: string[], opts?: RequestOptions): Promise<DomainAvailability[]> {\n return this.provider.checkAvailability(domainNames.map(normalizeDomain), opts);\n }\n\n getPricing(tldOrDomain: string, opts?: RequestOptions): Promise<TldPricing> {\n return this.provider.getPricing(normalizeDomain(tldOrDomain), opts);\n }\n\n registerDomain(\n domainName: string,\n input: RegisterDomainInput,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.provider.registerDomain(normalizeDomain(domainName), input, opts);\n }\n\n renewDomain(domainName: string, years?: number, opts?: RequestOptions): Promise<OperationResult> {\n return this.provider.renewDomain(normalizeDomain(domainName), years, opts);\n }\n\n setAutoRenew(\n domainName: string,\n enabled: boolean,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.provider.setAutoRenew(normalizeDomain(domainName), enabled, opts);\n }\n\n transferIn(\n domainName: string,\n input: TransferDomainInput,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.provider.transferIn(normalizeDomain(domainName), input, opts);\n }\n\n updateNameservers(\n domainName: string,\n nameservers: string[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.provider.updateNameservers(normalizeDomain(domainName), nameservers, opts);\n }\n\n async getNameservers(domainName: string, opts?: RequestOptions): Promise<string[]> {\n return normalizeNameservers(\n await this.provider.getNameservers(normalizeDomain(domainName), opts)\n );\n }\n\n lockDomain(domainName: string, opts?: RequestOptions): Promise<OperationResult> {\n return this.provider.lockDomain(normalizeDomain(domainName), opts);\n }\n\n unlockDomain(domainName: string, opts?: RequestOptions): Promise<OperationResult> {\n return this.provider.unlockDomain(normalizeDomain(domainName), opts);\n }\n\n setPrivacy(\n domainName: string,\n enabled: boolean,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.provider.setPrivacy(normalizeDomain(domainName), enabled, opts);\n }\n\n getContacts(domainName: string, opts?: RequestOptions): Promise<ContactSet> {\n return this.provider.getContacts(normalizeDomain(domainName), opts);\n }\n\n updateContacts(\n domainName: string,\n contacts: ContactSet,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.provider.updateContacts(normalizeDomain(domainName), contacts, opts);\n }\n\n getDnsRecords(domainName: string, opts?: RequestOptions): Promise<DnsRecord[]> {\n return this.provider.getDnsRecords(normalizeDomain(domainName), opts);\n }\n\n setDnsRecords(\n domainName: string,\n records: DnsRecord[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.provider.setDnsRecords(normalizeDomain(domainName), records, opts);\n }\n\n // --- extended: forwarding ---\n //\n // Opt-in per provider (gate on `provider.supports(Feature.…)`); providers that\n // don't declare the feature reject with NotImplementedError. Email forwarding\n // (alias → address) and URL/domain forwarding (host → URL redirect) are\n // unrelated capabilities with separate feature flags. Each `set…` is a full\n // replace: any rule omitted is removed, an empty array clears forwarding.\n\n getEmailForwarding(domainName: string, opts?: RequestOptions): Promise<EmailForward[]> {\n return this.provider.getEmailForwarding(normalizeDomain(domainName), opts);\n }\n\n setEmailForwarding(\n domainName: string,\n forwards: EmailForward[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.provider.setEmailForwarding(normalizeDomain(domainName), forwards, opts);\n }\n\n getDomainForwarding(domainName: string, opts?: RequestOptions): Promise<DomainForward[]> {\n return this.provider.getDomainForwarding(normalizeDomain(domainName), opts);\n }\n\n setDomainForwarding(\n domainName: string,\n forwards: DomainForward[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.provider.setDomainForwarding(normalizeDomain(domainName), forwards, opts);\n }\n}\n","// Aggregate domains across multiple registrars into one combined portfolio.\n//\n// Each source is queried concurrently and failures are isolated per-registrar\n// (one provider being down never sinks the whole view). Every returned Domain\n// already carries its `registrar`, so the flattened list stays attributable.\n\nimport type { RegistrarClient } from './client';\nimport type { Domain, ListDomainsOptions, Registrar } from './types';\nimport { toRegistrarError } from './errors';\n\n// anything that can list domains: a raw Registrar or the RegistrarClient facade\nexport type DomainSource = Registrar | RegistrarClient;\n\n// a per-registrar failure from a portfolio fetch\nexport interface PortfolioError {\n // the registrar id that failed, e.g. \"godaddy\"\n registrar: string;\n error: Error;\n}\n\n// the outcome of a portfolio fetch: all domains that loaded, plus any errors\nexport interface PortfolioResult {\n domains: Domain[];\n errors: PortfolioError[];\n}\n\n// resolve a source's registrar id, whether it's a client facade or a provider\nfunction sourceName(source: DomainSource): string {\n return 'provider' in source ? source.provider.name : source.name;\n}\n\n/**\n * List domains across many registrars at once. Queries every source in parallel\n * and collects results with per-registrar error isolation.\n *\n * `opts` (including `search`) is passed to EACH source. Every source returns its\n * full account; order of the returned `domains` follows the order of `sources`.\n *\n * const { domains, errors } = await listPortfolio(\n * [godaddyClient, namecheapClient, gandiClient],\n * { search: 'acme' }\n * );\n */\nexport async function listPortfolio(\n sources: DomainSource[],\n opts?: ListDomainsOptions\n): Promise<PortfolioResult> {\n const settled = await Promise.allSettled(sources.map(source => source.listDomains(opts)));\n\n const domains: Domain[] = [];\n const errors: PortfolioError[] = [];\n\n settled.forEach((result, i) => {\n if (result.status === 'fulfilled') {\n domains.push(...result.value);\n } else {\n errors.push({\n registrar: sourceName(sources[i]),\n error: toRegistrarError(result.reason),\n });\n }\n });\n\n return { domains, errors };\n}\n","import type { RegistrarClientOptions } from './types';\n\n// default client-level options\nexport const DEFAULT_OPTIONS: RegistrarClientOptions = {\n timeout: 30_000, // 30s — registrar APIs can be slow, especially for registration\n retries: 2,\n backoff: 250,\n};\n\n// package identifier used in the default User-Agent header\nexport const USER_AGENT = '@aoxborrow/registrar-client';\n","import { USER_AGENT } from './constants';\nimport {\n AbortError,\n AuthenticationError,\n AuthorizationError,\n ConnectionError,\n InvalidResponseError,\n NotFoundError,\n ParsingError,\n RateLimitError,\n RegistrarError,\n TimeoutError,\n toRegistrarError,\n} from './errors';\nimport type { RegistrarClientOptions } from './types';\nimport { backoffDelay, sleep } from './utils';\n\n// configuration for an HttpClient instance\nexport interface HttpClientConfig {\n // base URL for all requests, e.g. \"https://api.example.com/v2\"\n baseUrl: string;\n // default headers applied to every request (e.g. Authorization) — never logged\n headers?: Record<string, string>;\n // request/retry behavior\n options: RegistrarClientOptions;\n}\n\n// options for a single request\nexport interface RequestConfig {\n method?: string;\n // path appended to baseUrl, or an absolute URL\n path: string;\n // query parameters (never used for secrets)\n query?: Record<string, string | number | boolean | undefined>;\n // JSON body; serialized with JSON.stringify\n body?: unknown;\n headers?: Record<string, string>;\n // per-request overrides\n timeout?: number;\n retries?: number;\n backoff?: number;\n signal?: AbortSignal;\n}\n\n// a small, browser/edge-safe fetch wrapper with timeout, abort linking,\n// retry-with-backoff, and registrar error mapping. No Node built-ins.\nexport class HttpClient {\n constructor(protected config: HttpClientConfig) {}\n\n // perform a request and parse a JSON response body\n async request<T = unknown>(req: RequestConfig): Promise<T> {\n return this.withRetries(req, async () => {\n const text = await this.send(req);\n if (text.length === 0) return undefined as T;\n try {\n return JSON.parse(text) as T;\n } catch (error) {\n throw new ParsingError(\n `Failed to parse JSON response from '${this.buildUrl(req)}': ${errorMessage(error)}`\n );\n }\n });\n }\n\n // perform a request and return the raw response body text (e.g. XML APIs)\n async requestText(req: RequestConfig): Promise<string> {\n return this.withRetries(req, () => this.send(req));\n }\n\n // shared retry-with-backoff wrapper around a single-attempt operation\n protected async withRetries<T>(req: RequestConfig, attemptFn: () => Promise<T>): Promise<T> {\n const retries = req.retries ?? this.config.options.retries;\n const backoff = req.backoff ?? this.config.options.backoff;\n\n let lastError: RegistrarError | undefined;\n for (let attempt = 0; attempt <= retries; attempt++) {\n try {\n return await attemptFn();\n } catch (error) {\n lastError = toRegistrarError(error);\n\n // out of attempts, or the error is not retryable\n if (attempt >= retries || !lastError.shouldRetry()) {\n throw lastError;\n }\n\n // honor Retry-After for rate limits when present, else exponential backoff\n const delay =\n lastError instanceof RateLimitError && lastError.retryAfter != null\n ? lastError.retryAfter * 1000\n : backoffDelay(backoff, attempt);\n await sleep(delay);\n }\n }\n\n // unreachable: the loop always returns or throws\n throw lastError ?? new RegistrarError('Request failed');\n }\n\n // build the full URL for a request, applying query parameters\n protected buildUrl(req: RequestConfig): string {\n let base: string;\n if (/^https?:\\/\\//.test(req.path)) {\n // absolute URL\n base = req.path;\n } else if (req.path === '') {\n // empty path: the baseUrl is itself the full endpoint (e.g. Namecheap/Dynadot)\n base = this.config.baseUrl;\n } else {\n base = `${this.config.baseUrl.replace(/\\/$/, '')}/${req.path.replace(/^\\//, '')}`;\n }\n const url = new URL(base);\n if (req.query) {\n for (const [key, value] of Object.entries(req.query)) {\n if (value !== undefined) url.searchParams.set(key, String(value));\n }\n }\n return url.toString();\n }\n\n // send a single request (no retries), map errors, and return the raw body text\n protected async send(req: RequestConfig): Promise<string> {\n const timeout = req.timeout ?? this.config.options.timeout;\n const externalSignal = req.signal ?? this.config.options.signal;\n\n // abort controller for this request, linked to any external signal\n const controller = new AbortController();\n if (externalSignal?.aborted) {\n throw new AbortError('Request was aborted');\n }\n const onAbort = () => controller.abort();\n externalSignal?.addEventListener('abort', onAbort);\n const timeoutId = setTimeout(() => controller.abort(), timeout);\n\n const url = this.buildUrl(req);\n const headers: Record<string, string> = {\n 'User-Agent': USER_AGENT,\n 'Accept': 'application/json',\n ...this.config.headers,\n ...req.headers,\n };\n if (req.body !== undefined && headers['Content-Type'] === undefined) {\n headers['Content-Type'] = 'application/json';\n }\n\n try {\n let response: Response;\n try {\n response = await fetch(url, {\n method: req.method ?? 'GET',\n headers,\n body: req.body !== undefined ? JSON.stringify(req.body) : undefined,\n signal: controller.signal,\n });\n } catch (error) {\n // distinguish abort/timeout from a genuine network failure\n if (isAbortError(error)) {\n if (externalSignal?.aborted) throw new AbortError('Request was aborted');\n throw new TimeoutError(`Request to '${url}' timed out after ${timeout}ms`);\n }\n throw new ConnectionError(`Failed to reach '${url}': ${errorMessage(error)}`);\n }\n\n if (!response.ok) {\n throw await this.toStatusError(response, url);\n }\n\n // 204 No Content yields an empty string\n if (response.status === 204) {\n return '';\n }\n return await response.text();\n } finally {\n clearTimeout(timeoutId);\n externalSignal?.removeEventListener('abort', onAbort);\n }\n }\n\n // map a non-2xx response to a typed RegistrarError\n protected async toStatusError(response: Response, url: string): Promise<RegistrarError> {\n // read the body defensively; it may aid debugging but must not be assumed JSON\n let detail = '';\n try {\n detail = (await response.text()).slice(0, 500);\n } catch {\n // ignore body read failures\n }\n const message = `Request to '${url}' failed with ${response.status} ${response.statusText}${\n detail ? `: ${detail}` : ''\n }`;\n\n switch (response.status) {\n case 401:\n return new AuthenticationError(message);\n case 403:\n return new AuthorizationError(message);\n case 404:\n return new NotFoundError(message);\n case 429: {\n const retryAfter = Number(response.headers.get('retry-after'));\n return new RateLimitError(message, Number.isFinite(retryAfter) ? retryAfter : undefined);\n }\n default: {\n if (response.status >= 500) {\n return new InvalidResponseError(message);\n }\n // preserve the real status for 4xx codes without a dedicated class\n // (400, 402, 409, 422, …) so callers can branch on it\n const err = new RegistrarError(message);\n err.status = response.status;\n return err;\n }\n }\n }\n}\n\n// detect an AbortController/fetch abort across environments\nfunction isAbortError(error: unknown): boolean {\n return (\n typeof error === 'object' &&\n error !== null &&\n 'name' in error &&\n (error as { name?: string }).name === 'AbortError'\n );\n}\n\n// safely extract a message from an unknown thrown value\nfunction errorMessage(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n","// Capability model for registrar providers.\n//\n// Features are identified by the string constants on `Feature`. Always reference\n// them through that object (e.g. `Feature.GetPricing`) rather than writing the\n// raw string — you get autocomplete and find-all-references, and typos become\n// compile errors.\n//\n// There are two kinds of feature:\n//\n// - CORE — the contract every provider is expected to fulfil. A provider\n// inherits the core surface by extending `BaseRegistrar`; it does not\n// re-declare it. Core is a deliberate product decision about what this\n// library guarantees, NOT the intersection of what today's registrars\n// happen to expose — so a single registrar's missing/undocumented endpoint\n// never demotes a feature out of core. Where a registrar's API path for a\n// core feature isn't wired up yet (or hasn't been found — e.g. DNS via\n// Cloudflare's separate Zones API), the method throws `NotImplementedError`\n// until implemented. The contract is the promise; `NotImplementedError` is\n// the \"not yet\".\n//\n// - EXTENDED — opt-in capabilities a provider declares via its static\n// `extendedFeatures`. This is where providers genuinely differ.\n//\n// A provider's full capability set is `CORE_FEATURES` ∪ its `extendedFeatures`,\n// exposed as `provider.features` (and statically as `Registrar.features`).\n\n// All feature identifiers. Reference these instead of string literals.\nexport const Feature = {\n // --- core (guaranteed contract; inherited from BaseRegistrar) ---\n TestConnection: 'testConnection', // verify credentials\n ListDomains: 'listDomains', // list domains in the account\n GetDomain: 'getDomain', // fetch a single domain's details\n CheckAvailability: 'checkAvailability', // check whether domains can be registered\n GetPricing: 'getPricing', // TLD/domain pricing lookup\n RegisterDomain: 'registerDomain', // register a new domain\n RenewDomain: 'renewDomain', // renew a domain\n SetAutoRenew: 'setAutoRenew', // toggle auto-renew\n TransferIn: 'transferIn', // transfer a domain into the account\n UpdateNameservers: 'updateNameservers', // replace a domain's nameservers\n GetNameservers: 'getNameservers', // read a domain's nameservers\n LockDomain: 'lockDomain', // enable the transfer lock\n UnlockDomain: 'unlockDomain', // disable the transfer lock\n SetPrivacy: 'setPrivacy', // toggle WHOIS privacy\n GetContacts: 'getContacts', // read registrant/admin/tech contacts\n UpdateContacts: 'updateContacts', // update registrant/admin/tech contacts\n GetDnsRecords: 'getDnsRecords', // read DNS records\n SetDnsRecords: 'setDnsRecords', // write DNS records\n\n // --- extended (opt-in; declared per provider) ---\n GetAuthCode: 'getAuthCode', // retrieve transfer auth/EPP code (transfer out)\n GetDnssec: 'getDnssec', // read whether DNSSEC is enabled (DS / key records)\n DisableDnssec: 'disableDnssec', // turn DNSSEC off (no enable / key management)\n GetEmailForwarding: 'getEmailForwarding', // read alias-style email forwarding rules\n SetEmailForwarding: 'setEmailForwarding', // alias-style email forwarding (redirect only)\n GetDomainForwarding: 'getDomainForwarding', // read URL redirect / domain forwarding\n SetDomainForwarding: 'setDomainForwarding', // URL redirect / domain forwarding\n} as const;\n\n// A registrar capability identifier — the value of one of the `Feature` members.\nexport type RegistrarFeature = (typeof Feature)[keyof typeof Feature];\n\n// The guaranteed core contract: every provider is expected to support these.\nexport const CORE_FEATURES = [\n Feature.TestConnection,\n Feature.ListDomains,\n Feature.GetDomain,\n Feature.CheckAvailability,\n Feature.GetPricing,\n Feature.RegisterDomain,\n Feature.RenewDomain,\n Feature.SetAutoRenew,\n Feature.TransferIn,\n Feature.UpdateNameservers,\n Feature.GetNameservers,\n Feature.LockDomain,\n Feature.UnlockDomain,\n Feature.SetPrivacy,\n Feature.GetContacts,\n Feature.UpdateContacts,\n Feature.GetDnsRecords,\n Feature.SetDnsRecords,\n] as const satisfies readonly RegistrarFeature[];\n\n// Every feature that is not part of the core contract. A provider opts into any\n// of these via its static `extendedFeatures`.\nexport const EXTENDED_FEATURES = [\n Feature.GetAuthCode,\n Feature.GetDnssec,\n Feature.DisableDnssec,\n Feature.GetEmailForwarding,\n Feature.SetEmailForwarding,\n Feature.GetDomainForwarding,\n Feature.SetDomainForwarding,\n] as const satisfies readonly RegistrarFeature[];\n\n// Every feature, core first.\nexport const ALL_FEATURES = [...CORE_FEATURES, ...EXTENDED_FEATURES] as const;\n\nconst CORE_FEATURE_SET: ReadonlySet<RegistrarFeature> = new Set(CORE_FEATURES);\n\n// true if `feature` is part of the guaranteed core contract\nexport function isCoreFeature(feature: RegistrarFeature): boolean {\n return CORE_FEATURE_SET.has(feature);\n}\n","import { DEFAULT_OPTIONS } from './constants';\nimport { ConfigurationError, NotImplementedError } from './errors';\nimport { HttpClient, type HttpClientConfig } from './http';\nimport { CORE_FEATURES, type RegistrarFeature } from './features';\nimport type {\n ConnectionResult,\n ContactSet,\n DnsRecord,\n Domain,\n DomainAvailability,\n DomainForward,\n DnssecStatus,\n EmailForward,\n ListDomainsOptions,\n OperationResult,\n Registrar,\n RegisterDomainInput,\n RegistrarClientOptions,\n RegistrarCredentials,\n RegistrarEnvironment,\n RegistrarOptions,\n RequestOptions,\n TldPricing,\n TransferDomainInput,\n} from './types';\n\n// pick the base URL for the requested environment. Throws if `sandbox` is\n// requested but the provider defines no sandbox URL — so integration tests\n// fail loudly rather than silently hitting production.\nexport function selectBaseUrl(\n registrar: string,\n environment: RegistrarEnvironment | undefined,\n urls: { production: string; sandbox?: string }\n): string {\n if (environment === 'sandbox') {\n if (!urls.sandbox) {\n throw new ConfigurationError(`${registrar} does not provide a sandbox environment`);\n }\n return urls.sandbox;\n }\n return urls.production;\n}\n\n// Abstract base for registrar providers. Owns the shared HTTP/auth/retry\n// plumbing (via `HttpClient`) and provides `NotImplementedError`-rejecting\n// defaults for every operation. Concrete providers extend this, build their\n// base URL + auth from the credentials passed to `super()`, and override the\n// operations their API supports.\nexport abstract class BaseRegistrar implements Registrar {\n abstract readonly name: string;\n\n protected http: HttpClient;\n protected credentials: RegistrarCredentials;\n protected options: RegistrarClientOptions;\n readonly environment: RegistrarEnvironment;\n\n // Extended capabilities this provider opts into, beyond the core contract.\n // Subclasses override this; core features are inherited and not re-declared.\n static readonly extendedFeatures: readonly RegistrarFeature[] = [];\n\n // The provider's full capability set: the core contract plus its extended\n // features. Available statically (no instance/credentials needed) for catalog\n // UIs and MCP tooling.\n static get features(): readonly RegistrarFeature[] {\n return [...CORE_FEATURES, ...this.extendedFeatures];\n }\n\n // instance mirror of the static `features`\n get features(): readonly RegistrarFeature[] {\n return (this.constructor as typeof BaseRegistrar).features;\n }\n\n // whether this provider supports a given capability\n supports(feature: RegistrarFeature): boolean {\n return this.features.includes(feature);\n }\n\n constructor(\n credentials: RegistrarCredentials,\n httpConfig: Omit<HttpClientConfig, 'options'>,\n options?: RegistrarOptions\n ) {\n const { environment = 'production', ...clientOptions } = options ?? {};\n this.credentials = credentials;\n this.environment = environment;\n this.options = { ...DEFAULT_OPTIONS, ...clientOptions };\n this.http = new HttpClient({ ...httpConfig, options: this.options });\n }\n\n testConnection(_opts?: RequestOptions): Promise<ConnectionResult> {\n return Promise.reject(\n new NotImplementedError(`${this.name}: testConnection is not implemented`)\n );\n }\n\n listDomains(_opts?: ListDomainsOptions): Promise<Domain[]> {\n return Promise.reject(new NotImplementedError(`${this.name}: listDomains is not implemented`));\n }\n\n renewDomain(\n _domainName: string,\n _years?: number,\n _opts?: RequestOptions\n ): Promise<OperationResult> {\n return Promise.reject(new NotImplementedError(`${this.name}: renewDomain is not implemented`));\n }\n\n updateNameservers(\n _domainName: string,\n _nameservers: string[],\n _opts?: RequestOptions\n ): Promise<OperationResult> {\n return Promise.reject(\n new NotImplementedError(`${this.name}: updateNameservers is not implemented`)\n );\n }\n\n lockDomain(_domainName: string, _opts?: RequestOptions): Promise<OperationResult> {\n return Promise.reject(new NotImplementedError(`${this.name}: lockDomain is not implemented`));\n }\n\n unlockDomain(_domainName: string, _opts?: RequestOptions): Promise<OperationResult> {\n return Promise.reject(new NotImplementedError(`${this.name}: unlockDomain is not implemented`));\n }\n\n getDomain(_domainName: string, _opts?: RequestOptions): Promise<Domain> {\n return this.notImplemented('getDomain');\n }\n\n checkAvailability(_domainNames: string[], _opts?: RequestOptions): Promise<DomainAvailability[]> {\n return this.notImplemented('checkAvailability');\n }\n\n getPricing(_tldOrDomain: string, _opts?: RequestOptions): Promise<TldPricing> {\n return this.notImplemented('getPricing');\n }\n\n registerDomain(\n _domainName: string,\n _input: RegisterDomainInput,\n _opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.notImplemented('registerDomain');\n }\n\n setAutoRenew(\n _domainName: string,\n _enabled: boolean,\n _opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.notImplemented('setAutoRenew');\n }\n\n transferIn(\n _domainName: string,\n _input: TransferDomainInput,\n _opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.notImplemented('transferIn');\n }\n\n getNameservers(_domainName: string, _opts?: RequestOptions): Promise<string[]> {\n return this.notImplemented('getNameservers');\n }\n\n setPrivacy(\n _domainName: string,\n _enabled: boolean,\n _opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.notImplemented('setPrivacy');\n }\n\n getContacts(_domainName: string, _opts?: RequestOptions): Promise<ContactSet> {\n return this.notImplemented('getContacts');\n }\n\n updateContacts(\n _domainName: string,\n _contacts: ContactSet,\n _opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.notImplemented('updateContacts');\n }\n\n getDnsRecords(_domainName: string, _opts?: RequestOptions): Promise<DnsRecord[]> {\n return this.notImplemented('getDnsRecords');\n }\n\n setDnsRecords(\n _domainName: string,\n _records: DnsRecord[],\n _opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.notImplemented('setDnsRecords');\n }\n\n // --- extended capabilities (opt-in; default to NotImplementedError) ---\n\n getEmailForwarding(_domainName: string, _opts?: RequestOptions): Promise<EmailForward[]> {\n return this.notImplemented('getEmailForwarding');\n }\n\n setEmailForwarding(\n _domainName: string,\n _forwards: EmailForward[],\n _opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.notImplemented('setEmailForwarding');\n }\n\n getDomainForwarding(_domainName: string, _opts?: RequestOptions): Promise<DomainForward[]> {\n return this.notImplemented('getDomainForwarding');\n }\n\n setDomainForwarding(\n _domainName: string,\n _forwards: DomainForward[],\n _opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.notImplemented('setDomainForwarding');\n }\n\n getAuthCode(_domainName: string, _opts?: RequestOptions): Promise<string> {\n return this.notImplemented('getAuthCode');\n }\n\n getDnssec(_domainName: string, _opts?: RequestOptions): Promise<DnssecStatus> {\n return this.notImplemented('getDnssec');\n }\n\n disableDnssec(_domainName: string, _opts?: RequestOptions): Promise<OperationResult> {\n return this.notImplemented('disableDnssec');\n }\n\n // shared rejection for a capability a provider hasn't wired up yet\n protected notImplemented(method: string): Promise<never> {\n return Promise.reject(new NotImplementedError(`${this.name}: ${method} is not implemented`));\n }\n}\n","import type {\n ConfigField,\n ConnectionResult,\n Contact,\n ContactSet,\n DnsRecord,\n Domain,\n DomainAvailability,\n DomainForward,\n EmailForward,\n ListDomainsOptions,\n OperationResult,\n RegisterDomainInput,\n RegistrarOptions,\n RequestOptions,\n TldPricing,\n} from '../types';\nimport { createDomain, filterDomains, normalizeDomain, settableForwards } from '../utils';\nimport { NotImplementedError, toRegistrarError } from '../errors';\nimport { BaseRegistrar, selectBaseUrl } from '../registrar';\nimport { Feature, type RegistrarFeature } from '../features';\nimport type { RegistrarCredentials } from '../types';\n\n// Cloudflare's standard response envelope\ninterface CfEnvelope<T> {\n success: boolean;\n errors?: { code?: number; message?: string }[];\n result?: T;\n}\n\n// a domain object from the Cloudflare Registrar API\ninterface CfDomain {\n name: string;\n // registrar domains report lifecycle under last_known_status (e.g.\n // \"registrationActive\") — there is no plain `status` field\n last_known_status?: string;\n registered_at?: string;\n expires_at?: string;\n auto_renew?: boolean;\n locked?: boolean;\n privacy?: boolean;\n name_servers?: string[];\n // WHOIS contacts, keyed by role, on the registrar domain payload\n contacts?: {\n registrant?: CfContact;\n administrator?: CfContact;\n technical?: CfContact;\n billing?: CfContact;\n };\n}\n\n// a WHOIS contact as the Cloudflare Registrar API returns it\ninterface CfContact {\n first_name?: string;\n last_name?: string;\n organization?: string;\n email?: string;\n phone?: string;\n fax?: string;\n address?: string;\n address2?: string;\n city?: string;\n state?: string;\n zip?: string;\n country?: string;\n}\n\n// a zone object from the Cloudflare Zones API. Nameservers and DNS records live\n// on the Zones API, not the Registrar API, so several read methods resolve the\n// domain to its zone first.\ninterface CfZone {\n id: string;\n name: string;\n name_servers?: string[];\n}\n\n// pricing (major currency units, as strings) on a domain-check / domain-search entry\ninterface CfPricing {\n currency?: string;\n registration_cost?: string;\n renewal_cost?: string;\n}\n\n// one entry from the registrar domain-check / domain-search result. `registrable`\n// is the authoritative availability flag; `reason` explains a false (e.g.\n// \"domain_premium\", \"extension_not_supported_via_api\").\ninterface CfDomainCheck {\n name: string;\n registrable: boolean;\n tier?: string;\n reason?: string;\n pricing?: CfPricing;\n}\n\n// the registration resource returned by POST /registrar/registrations and the\n// registration-status endpoint. `state` is the lifecycle; `completed` is a\n// convenience flag; registry details hang off context.registration.\ninterface CfRegistration {\n domain_name?: string;\n state?: 'in_progress' | 'succeeded' | 'failed' | 'action_required' | 'blocked';\n completed?: boolean;\n reason?: string;\n}\n\n// a rule in the http_request_dynamic_redirect phase ruleset (Single Redirects).\n// A domain forward is a static redirect: action \"redirect\" with a literal\n// target_url.value and a host-matching expression.\ninterface CfRedirectRule {\n id?: string;\n expression?: string;\n description?: string;\n action?: string;\n action_parameters?: {\n from_value?: {\n target_url?: { value?: string; expression?: string };\n status_code?: number;\n preserve_query_string?: boolean;\n };\n };\n}\n\ninterface CfRuleset {\n id?: string;\n rules?: CfRedirectRule[];\n}\n\n// an Email Routing rule: a matcher (literal \"to\" address, or \"all\" for the\n// catch-all) paired with a forward action carrying the destination address(es).\ninterface CfEmailRule {\n id?: string;\n name?: string;\n enabled?: boolean;\n matchers?: { type: string; field?: string; value?: string }[];\n actions?: { type: string; value?: string[] }[];\n}\n\ninterface CfEmailSettings {\n enabled?: boolean;\n status?: string;\n}\n\n// a DNS record from the Cloudflare Zones DNS API. For SRV records, weight/port\n// are carried on a nested `data` object; `content` holds the primary value for\n// every type, and `priority` is populated for MX/SRV.\ninterface CfDnsRecord {\n // record id, present on records read from the API (needed to delete them)\n id?: string;\n type: string;\n name: string;\n content?: string;\n ttl?: number;\n priority?: number;\n data?: {\n weight?: number;\n port?: number;\n priority?: number;\n };\n}\n\n/**\n * Cloudflare Registrar\n * API docs: https://developers.cloudflare.com/api/resources/registrar/\n *\n * Credentials: create an API token under My Profile > API Tokens with\n * \"Account.Registrar\" read/write permission. The Account ID is shown on the\n * Overview page of any zone (and in the dashboard URL).\n *\n * Registration is supported via the Registrar API's registrations endpoint\n * (beta): at-cost, standard-tier, API-supported TLDs only — premium names and\n * unsupported extensions are rejected by the availability check. Renewals and\n * transfers-in are not yet exposed by the Cloudflare API. Registrar is at-cost,\n * so `registerDomain` spends real money.\n */\nexport class CloudflareRegistrar extends BaseRegistrar {\n readonly name = 'cloudflare';\n\n static readonly displayName = 'Cloudflare';\n static readonly helpText =\n 'Create an API token in your Cloudflare dashboard under My Profile > API Tokens. ' +\n 'The token needs \"Account.Registrar\" read/write permissions. Find your Account ID ' +\n 'in the URL or on the Overview page of any zone.';\n static readonly configFields: ConfigField[] = [\n { name: 'apiToken', label: 'API Token', type: 'password', required: true },\n { name: 'accountId', label: 'Account ID', type: 'text', required: true },\n ];\n static readonly supportsSandbox = false; // Cloudflare Registrar has no test environment\n // No extended capabilities. Cloudflare is held to the core contract like any\n // provider. Reads, registration, availability/pricing, privacy, and DNS are\n // implemented (DNS routes through the Zones API); auto-renew, lock, nameserver,\n // renew, and contact updates are not — Cloudflare's API has no post-registration\n // update endpoint and the legacy edit endpoint (EOL 2026-09-27) rejects those\n // fields. Those methods stay `NotImplementedError`. See docs/registrars/cloudflare.md.\n // Domain forwarding (URL redirects via the Rules/Rulesets API + a proxied\n // placeholder DNS record) and email forwarding (Email Routing) are supported\n // through Cloudflare APIs outside the Registrar API. Masked/framed forwarding\n // is not offered by the library. See docs/registrars/cloudflare.md.\n static readonly extendedFeatures: readonly RegistrarFeature[] = [\n Feature.GetDomainForwarding,\n Feature.SetDomainForwarding,\n Feature.GetEmailForwarding,\n Feature.SetEmailForwarding,\n ];\n\n constructor(credentials: RegistrarCredentials, options?: RegistrarOptions) {\n super(\n credentials,\n {\n baseUrl: selectBaseUrl('Cloudflare', options?.environment, {\n production: 'https://api.cloudflare.com/client/v4',\n }),\n headers: {\n 'Authorization': `Bearer ${credentials.apiToken}`,\n 'Content-Type': 'application/json',\n },\n },\n options\n );\n }\n\n private get accountPath(): string {\n return `/accounts/${this.credentials.accountId}/registrar/domains`;\n }\n\n override async testConnection(opts?: RequestOptions): Promise<ConnectionResult> {\n try {\n const res = await this.http.request<CfEnvelope<CfDomain[]>>({\n path: this.accountPath,\n ...opts,\n });\n return res.success\n ? { success: true, message: 'Connection successful' }\n : { success: false, message: res.errors?.[0]?.message ?? 'Request failed' };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n override async listDomains(opts?: ListDomainsOptions): Promise<Domain[]> {\n // The Registrar list endpoint has no name filter, so `search` is applied\n // client-side. It also does not return nameservers (those live on the Zones\n // API); `nameservers` therefore reflects only what the list response carries.\n const { search, ...reqOpts } = opts ?? {};\n const domains: Domain[] = [];\n const perPage = 200; // Cloudflare API maximum page size\n let page = 0; // the Registrar list endpoint is 0-indexed (result_info.page starts at 0)\n let hasMore = true;\n\n while (hasMore) {\n const res = await this.http.request<CfEnvelope<CfDomain[]>>({\n path: this.accountPath,\n query: { per_page: perPage, page },\n ...reqOpts,\n });\n if (!res.success) {\n throw new Error(res.errors?.[0]?.message ?? 'API request failed');\n }\n const list = res.result ?? [];\n for (const d of list) domains.push(this.toDomain(d));\n hasMore = list.length === perPage;\n page++;\n }\n return filterDomains(domains, search);\n }\n\n // map a Cloudflare Registrar domain payload to the normalized Domain shape\n private toDomain(d: CfDomain): Domain {\n return createDomain({\n domainName: d.name,\n registrar: this.name,\n status: d.last_known_status,\n createdDate: d.registered_at,\n expirationDate: d.expires_at,\n renewalDate: d.expires_at,\n autoRenew: d.auto_renew ?? false,\n locked: d.locked ?? false,\n privacy: d.privacy ?? true, // Cloudflare includes WHOIS privacy by default\n nameservers: d.name_servers ?? [],\n });\n }\n\n override async getDomain(domainName: string, opts?: RequestOptions): Promise<Domain> {\n // Registrar API: GET /accounts/{account_id}/registrar/domains/{domain}\n const res = await this.http.request<CfEnvelope<CfDomain>>({\n path: `${this.accountPath}/${encodeURIComponent(domainName)}`,\n ...opts,\n });\n if (!res.success || !res.result) {\n throw new Error(res.errors?.[0]?.message ?? `Domain ${domainName} not found`);\n }\n return this.toDomain(res.result);\n }\n\n /**\n * Nameservers come from the Zones API, not the Registrar API: a domain must be\n * an active zone in the account for its Cloudflare-assigned nameservers to be\n * known. GET /zones?name={domain} → the zone's `name_servers`.\n */\n override async getNameservers(domainName: string, opts?: RequestOptions): Promise<string[]> {\n const zone = await this.findZone(domainName, opts);\n if (!zone) {\n throw new Error(\n `${this.name}: ${domainName} is not a zone in this account; nameservers are only ` +\n 'available via the Zones API for domains added as zones'\n );\n }\n return zone.name_servers ?? [];\n }\n\n /**\n * DNS records live on the Zones API. Two-step: resolve the domain to its\n * zone_id via GET /zones?name={domain}, then GET /zones/{zone_id}/dns_records.\n */\n override async getDnsRecords(domainName: string, opts?: RequestOptions): Promise<DnsRecord[]> {\n const zone = await this.findZone(domainName, opts);\n if (!zone) {\n throw new Error(\n `${this.name}: ${domainName} is not a zone in this account; DNS records are managed ` +\n 'through the Zones API for domains added as zones'\n );\n }\n const res = await this.http.request<CfEnvelope<CfDnsRecord[]>>({\n path: `/zones/${encodeURIComponent(zone.id)}/dns_records`,\n ...opts,\n });\n if (!res.success) {\n throw new Error(res.errors?.[0]?.message ?? 'Failed to list DNS records');\n }\n return (res.result ?? []).map(toDnsRecord);\n }\n\n /**\n * Replace the zone's DNS records with the provided set (Zones API). The\n * Registrar API has no DNS surface, so the domain must be an active zone in the\n * account. Cloudflare has no bulk \"replace\" call, so this deletes the zone's\n * existing records and recreates them from `records`. The implicit SOA and the\n * zone's Cloudflare nameservers are not part of the editable record set and are\n * left untouched; an apex NS record in `records` is skipped (Cloudflare manages\n * it).\n */\n override async setDnsRecords(\n domainName: string,\n records: DnsRecord[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n try {\n const zone = await this.findZone(domainName, opts);\n if (!zone) {\n return {\n success: false,\n message: `${domainName} is not a zone in this account; DNS is managed via the Zones API`,\n };\n }\n const dnsPath = `/zones/${encodeURIComponent(zone.id)}/dns_records`;\n\n const list = await this.http.request<CfEnvelope<CfDnsRecord[]>>({ path: dnsPath, ...opts });\n if (!list.success) {\n return {\n success: false,\n message: list.errors?.[0]?.message ?? 'Failed to list DNS records',\n };\n }\n\n for (const rec of list.result ?? []) {\n if (!rec.id) continue;\n const del = await this.http.request<CfEnvelope<unknown>>({\n method: 'DELETE',\n path: `${dnsPath}/${encodeURIComponent(rec.id)}`,\n ...opts,\n });\n if (!del.success) {\n return {\n success: false,\n message: del.errors?.[0]?.message ?? 'Failed to delete DNS record',\n };\n }\n }\n\n for (const record of records) {\n const type = record.type.toUpperCase();\n const name = toFqdn(record.name, zone.name);\n if (type === 'NS' && name === zone.name) continue; // apex NS is Cloudflare-managed\n const create = await this.http.request<CfEnvelope<unknown>>({\n method: 'POST',\n path: dnsPath,\n body: toCfDnsBody(record, type, name),\n ...opts,\n });\n if (!create.success) {\n return {\n success: false,\n message: create.errors?.[0]?.message ?? `Failed to create ${type} record`,\n };\n }\n }\n return { success: true, message: 'DNS records updated successfully' };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n /**\n * WHOIS contacts come inline on the registrar domain payload, keyed by role\n * (registrant / administrator / technical / billing). GET the domain and map\n * each present role to the normalized ContactSet.\n */\n override async getContacts(domainName: string, opts?: RequestOptions): Promise<ContactSet> {\n const res = await this.http.request<CfEnvelope<CfDomain>>({\n path: `${this.accountPath}/${encodeURIComponent(domainName)}`,\n ...opts,\n });\n if (!res.success || !res.result) {\n throw new Error(res.errors?.[0]?.message ?? `Domain ${domainName} not found`);\n }\n const c = res.result.contacts ?? {};\n const contacts: ContactSet = {};\n if (c.registrant) contacts.registrant = toContact(c.registrant);\n if (c.administrator) contacts.admin = toContact(c.administrator);\n if (c.technical) contacts.tech = toContact(c.technical);\n if (c.billing) contacts.billing = toContact(c.billing);\n return contacts;\n }\n\n private get registrarPath(): string {\n return `/accounts/${this.credentials.accountId}/registrar`;\n }\n\n // authoritative availability + pricing for a batch of names (max 20 per call).\n // POST /registrar/domain-check is the source of truth (unlike domain-search).\n private async domainCheck(\n domainNames: string[],\n opts?: RequestOptions\n ): Promise<CfDomainCheck[]> {\n const out: CfDomainCheck[] = [];\n for (let i = 0; i < domainNames.length; i += 20) {\n const batch = domainNames.slice(i, i + 20).map(normalizeDomain);\n const res = await this.http.request<CfEnvelope<{ domains?: CfDomainCheck[] }>>({\n method: 'POST',\n path: `${this.registrarPath}/domain-check`,\n body: { domains: batch },\n ...opts,\n });\n if (!res.success) {\n throw new Error(res.errors?.[0]?.message ?? 'Domain check failed');\n }\n out.push(...(res.result?.domains ?? []));\n }\n return out;\n }\n\n /**\n * Real-time pricing via the registrar domain-check endpoint. Cloudflare has no\n * per-TLD price list — pricing is per name (a premium name prices differently\n * from a standard one) — so a full domain gives an accurate quote; a bare TLD\n * is probed with a neutral standard label and returns representative pricing.\n * Transfers are not available via the Cloudflare API, so `transfer` is omitted.\n */\n override async getPricing(tldOrDomain: string, opts?: RequestOptions): Promise<TldPricing> {\n const input = tldOrDomain.replace(/^\\.+/, '').toLowerCase();\n const domain = input.includes('.') ? input : `registrar-client-pricing-probe.${input}`;\n const tld = domain.slice(domain.indexOf('.') + 1);\n const [entry] = await this.domainCheck([domain], opts);\n if (!entry?.pricing) {\n throw new Error(\n `${this.name}: no pricing available for ${tldOrDomain}${\n entry?.reason ? ` (${entry.reason})` : ''\n } — pass a specific standard-tier domain for an accurate quote`\n );\n }\n const pricing: TldPricing = { tld, currency: entry.pricing.currency ?? 'USD' };\n const reg = toPrice(entry.pricing.registration_cost);\n const renew = toPrice(entry.pricing.renewal_cost);\n if (reg != null) pricing.registration = reg;\n if (renew != null) pricing.renewal = renew;\n return pricing;\n }\n\n /**\n * Availability + pricing via POST /registrar/domain-check (the authoritative\n * check — domain-search is discovery-only). A name is `available` when the API\n * reports it registrable; premium names and unsupported extensions come back\n * registrable:false with a `reason`. Batches of 20 are sent per the API limit.\n */\n override async checkAvailability(\n domainNames: string[],\n opts?: RequestOptions\n ): Promise<DomainAvailability[]> {\n const checks = await this.domainCheck(domainNames, opts);\n const byName = new Map(checks.map(c => [normalizeDomain(c.name), c]));\n return domainNames.map(name => {\n const c = byName.get(normalizeDomain(name));\n const availability: DomainAvailability = {\n domainName: normalizeDomain(name),\n available: c?.registrable ?? false,\n };\n if (c?.tier) availability.premium = c.tier === 'premium';\n const price = toPrice(c?.pricing?.registration_cost);\n if (price != null) availability.price = price;\n if (c?.pricing?.currency) availability.currency = c.pricing.currency;\n return availability;\n });\n }\n\n // resolve a domain name to its Cloudflare zone via the Zones API (null if the\n // domain is not a zone in this account)\n private async findZone(domainName: string, opts?: RequestOptions): Promise<CfZone | null> {\n const res = await this.http.request<CfEnvelope<CfZone[]>>({\n path: '/zones',\n query: { name: domainName },\n ...opts,\n });\n if (!res.success) {\n throw new Error(res.errors?.[0]?.message ?? 'Failed to look up zone');\n }\n return res.result?.find(z => z.name === domainName) ?? null;\n }\n\n // resolve a domain to its zone or throw a helpful error (forwarding requires\n // the domain to be an active zone in the account).\n private async requireZone(domainName: string, opts?: RequestOptions): Promise<CfZone> {\n const zone = await this.findZone(domainName, opts);\n if (!zone) {\n throw new Error(\n `${this.name}: ${domainName} is not a zone in this account; forwarding is managed ` +\n 'through the Rules and Email Routing APIs, which require the domain to be an active zone'\n );\n }\n return zone;\n }\n\n // --- domain (URL) forwarding: Rules/Rulesets API + a proxied placeholder DNS\n // record so Cloudflare's edge can apply the redirect --------------------------\n\n /**\n * Read URL forwarding from the zone's `http_request_dynamic_redirect` phase\n * ruleset. Each static redirect rule (action `redirect`, a literal target URL,\n * and a single `http.host eq \"...\"` match) maps to one DomainForward. Rules\n * with dynamic (expression) targets or multi-condition matches are skipped —\n * they are richer than the generic forwarding model. Returns [] when no\n * redirect ruleset exists.\n */\n override async getDomainForwarding(\n domainName: string,\n opts?: RequestOptions\n ): Promise<DomainForward[]> {\n const zone = await this.requireZone(domainName, opts);\n const ruleset = await this.getRedirectRuleset(zone.id, opts);\n const forwards: DomainForward[] = [];\n for (const rule of ruleset?.rules ?? []) {\n if (rule.action !== 'redirect') continue;\n const url = rule.action_parameters?.from_value?.target_url?.value;\n const host = hostFromExpression(rule.expression, zone.name);\n if (!url || host == null) continue;\n const status = rule.action_parameters?.from_value?.status_code;\n forwards.push({ host, url, type: status === 301 ? 'permanent' : 'temporary' });\n }\n return forwards;\n }\n\n /**\n * Set URL forwarding (replace-all). For each rule this (1) ensures a proxied\n * placeholder DNS record exists on the source host so Cloudflare's edge handles\n * the request, and (2) writes a static redirect rule to the zone's\n * `http_request_dynamic_redirect` ruleset (301 for `permanent`, 302 for\n * `redirect`). HTTPS works automatically via Cloudflare's Universal SSL. An\n * empty list clears forwarding: the redirect rules and the placeholder records\n * are removed.\n */\n override async setDomainForwarding(\n domainName: string,\n forwards: DomainForward[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n try {\n const settable = settableForwards(forwards); // reject masked before any write\n const zone = await this.requireZone(domainName, opts);\n const existing = await this.getRedirectRuleset(zone.id, opts);\n\n if (settable.length === 0) {\n if (existing?.id) {\n await this.http.request<CfEnvelope<unknown>>({\n method: 'DELETE',\n path: `/zones/${encodeURIComponent(zone.id)}/rulesets/${encodeURIComponent(existing.id)}`,\n ...opts,\n });\n }\n await this.removePlaceholderRecords(zone.id, opts);\n return { success: true, message: 'Domain forwarding cleared successfully' };\n }\n\n const rules = settable.map(f => {\n const fqdn = toFqdn(f.host || '@', zone.name);\n return {\n expression: `http.host eq \"${fqdn}\"`,\n description: `forward ${fqdn}`,\n action: 'redirect',\n action_parameters: {\n from_value: {\n target_url: { value: f.url },\n status_code: f.type === 'permanent' ? 301 : 302,\n preserve_query_string: false,\n },\n },\n };\n });\n\n // ensure the edge sees traffic for each source host\n for (const f of settable) {\n await this.ensurePlaceholderRecord(zone.id, toFqdn(f.host || '@', zone.name), opts);\n }\n\n const body = { name: 'default', kind: 'zone', phase: PHASE_DYNAMIC_REDIRECT, rules };\n const res = existing?.id\n ? await this.http.request<CfEnvelope<CfRuleset>>({\n method: 'PUT',\n path: `/zones/${encodeURIComponent(zone.id)}/rulesets/${encodeURIComponent(existing.id)}`,\n body,\n ...opts,\n })\n : await this.http.request<CfEnvelope<CfRuleset>>({\n method: 'POST',\n path: `/zones/${encodeURIComponent(zone.id)}/rulesets`,\n body,\n ...opts,\n });\n return res.success\n ? { success: true, message: 'Domain forwarding updated successfully' }\n : {\n success: false,\n message: res.errors?.[0]?.message ?? 'Failed to update domain forwarding',\n };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n // GET the dynamic-redirect phase entry-point ruleset, or null when none exists\n // (the API returns 404 with code 10003 in that case).\n private async getRedirectRuleset(\n zoneId: string,\n opts?: RequestOptions\n ): Promise<CfRuleset | null> {\n try {\n const res = await this.http.request<CfEnvelope<CfRuleset>>({\n path: `/zones/${encodeURIComponent(zoneId)}/rulesets/phases/${PHASE_DYNAMIC_REDIRECT}/entrypoint`,\n ...opts,\n });\n return res.result ?? null;\n } catch (error) {\n if (toRegistrarError(error).status === 404) return null;\n throw error;\n }\n }\n\n // ensure a proxied placeholder A/AAAA/CNAME exists for `fqdn` so Cloudflare's\n // edge receives the request. Creates a proxied AAAA -> 100:: (a reserved\n // originless address) only when the host has no A/AAAA/CNAME record yet; an\n // existing record is left untouched (it must be proxied for the redirect to\n // fire).\n private async ensurePlaceholderRecord(\n zoneId: string,\n fqdn: string,\n opts?: RequestOptions\n ): Promise<void> {\n const list = await this.http.request<CfEnvelope<CfDnsRecord[]>>({\n path: `/zones/${encodeURIComponent(zoneId)}/dns_records`,\n query: { name: fqdn },\n ...opts,\n });\n const hasAddress = (list.result ?? []).some(r =>\n ['A', 'AAAA', 'CNAME'].includes((r.type ?? '').toUpperCase())\n );\n if (hasAddress) return;\n await this.http.request<CfEnvelope<unknown>>({\n method: 'POST',\n path: `/zones/${encodeURIComponent(zoneId)}/dns_records`,\n body: { type: 'AAAA', name: fqdn, content: PLACEHOLDER_AAAA, proxied: true, ttl: 1 },\n ...opts,\n });\n }\n\n // delete the proxied placeholder records this provider creates for forwarding\n // (identified by their reserved sentinel content), leaving real records alone.\n private async removePlaceholderRecords(zoneId: string, opts?: RequestOptions): Promise<void> {\n const list = await this.http.request<CfEnvelope<CfDnsRecord[]>>({\n path: `/zones/${encodeURIComponent(zoneId)}/dns_records`,\n query: { per_page: 200 },\n ...opts,\n });\n for (const r of list.result ?? []) {\n if (r.id && PLACEHOLDER_CONTENT.has((r.content ?? '').toLowerCase())) {\n await this.http.request<CfEnvelope<unknown>>({\n method: 'DELETE',\n path: `/zones/${encodeURIComponent(zoneId)}/dns_records/${encodeURIComponent(r.id)}`,\n ...opts,\n });\n }\n }\n }\n\n // --- email forwarding: Email Routing (zone rules + catch-all) ----------------\n\n /**\n * Read Email Routing forwarding rules. Each rule/catch-all with a `forward`\n * action maps to one EmailForward: the local part of the matched address is the\n * `alias` (\"*\" for the catch-all), and the first forward destination is\n * `forwardTo`. Non-forward actions (drop / Worker) are skipped.\n */\n override async getEmailForwarding(\n domainName: string,\n opts?: RequestOptions\n ): Promise<EmailForward[]> {\n const zone = await this.requireZone(domainName, opts);\n const zid = encodeURIComponent(zone.id);\n const forwards: EmailForward[] = [];\n\n const rules = await this.http.request<CfEnvelope<CfEmailRule[]>>({\n path: `/zones/${zid}/email/routing/rules`,\n ...opts,\n });\n for (const rule of rules.result ?? []) {\n const dest = forwardAction(rule);\n if (!dest) continue;\n const matcher = rule.matchers?.[0];\n if (matcher?.type === 'all') continue; // catch-all handled below\n const value = matcher?.value ?? '';\n const alias = value.includes('@') ? value.slice(0, value.indexOf('@')) : value;\n forwards.push({ alias, forwardTo: dest });\n }\n\n const catchAll = await this.http.request<CfEnvelope<CfEmailRule>>({\n path: `/zones/${zid}/email/routing/rules/catch_all`,\n ...opts,\n });\n if (catchAll.result?.enabled) {\n const dest = forwardAction(catchAll.result);\n if (dest) forwards.push({ alias: '*', forwardTo: dest });\n }\n return forwards;\n }\n\n /**\n * Set Email Routing forwarding (replace-all). Enables Email Routing if needed\n * (which adds the required MX/SPF records), then rewrites the rules: each\n * `alias@domain -> forwardTo` becomes a routing rule, and an `alias` of \"*\"/\"@\"\n * becomes the catch-all. Destination addresses must be verified on the account\n * before Cloudflare will activate a rule; where the token can manage addresses,\n * any unknown destination is added (which sends its verification email) and the\n * result message names the addresses still awaiting verification. If the token\n * lacks the address-management scope, that pre-check is skipped.\n */\n override async setEmailForwarding(\n domainName: string,\n forwards: EmailForward[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n try {\n const zone = await this.requireZone(domainName, opts);\n const zid = encodeURIComponent(zone.id);\n\n const settings = await this.http.request<CfEnvelope<CfEmailSettings>>({\n path: `/zones/${zid}/email/routing`,\n ...opts,\n });\n if (!settings.result?.enabled) {\n const enabled = await this.http.request<CfEnvelope<CfEmailSettings>>({\n method: 'POST',\n path: `/zones/${zid}/email/routing/enable`,\n body: {},\n ...opts,\n });\n if (!enabled.success) {\n return {\n success: false,\n message: enabled.errors?.[0]?.message ?? 'Failed to enable Email Routing',\n };\n }\n }\n\n // ensure each destination is a verified account address (best-effort — the\n // token may lack the address-management scope, in which case this is skipped)\n const destinations = [...new Set(forwards.map(f => f.forwardTo))];\n const unverified = await this.ensureDestinations(destinations, opts);\n\n // remove existing non-catch-all rules\n const existing = await this.http.request<CfEnvelope<CfEmailRule[]>>({\n path: `/zones/${zid}/email/routing/rules`,\n ...opts,\n });\n for (const rule of existing.result ?? []) {\n if (rule.matchers?.[0]?.type === 'all' || !rule.id) continue;\n await this.http.request<CfEnvelope<unknown>>({\n method: 'DELETE',\n path: `/zones/${zid}/email/routing/rules/${encodeURIComponent(rule.id)}`,\n ...opts,\n });\n }\n\n let catchAllDest: string | undefined;\n for (const f of forwards) {\n const alias = f.alias.trim();\n if (alias === '*' || alias === '@' || alias === '') {\n catchAllDest = f.forwardTo;\n continue;\n }\n const create = await this.http.request<CfEnvelope<CfEmailRule>>({\n method: 'POST',\n path: `/zones/${zid}/email/routing/rules`,\n body: {\n enabled: true,\n name: `forward ${alias}@${zone.name}`,\n matchers: [{ type: 'literal', field: 'to', value: `${alias}@${zone.name}` }],\n actions: [{ type: 'forward', value: [f.forwardTo] }],\n },\n ...opts,\n });\n if (!create.success) {\n return {\n success: false,\n message: create.errors?.[0]?.message ?? `Failed to create rule for ${alias}`,\n };\n }\n }\n\n // catch-all: forward when a wildcard was given, otherwise reset to drop\n const catchAllBody = catchAllDest\n ? {\n enabled: true,\n matchers: [{ type: 'all' }],\n actions: [{ type: 'forward', value: [catchAllDest] }],\n }\n : { enabled: false, matchers: [{ type: 'all' }], actions: [{ type: 'drop' }] };\n const ca = await this.http.request<CfEnvelope<CfEmailRule>>({\n method: 'PUT',\n path: `/zones/${zid}/email/routing/rules/catch_all`,\n body: catchAllBody,\n ...opts,\n });\n if (!ca.success) {\n return {\n success: false,\n message: ca.errors?.[0]?.message ?? 'Failed to set catch-all rule',\n };\n }\n const note = unverified.length\n ? ` — awaiting verification of ${unverified.join(', ')} (rules stay inactive until verified)`\n : '';\n return { success: true, message: `Email forwarding updated successfully${note}` };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n // ensure each destination is a verified Email Routing address on the account.\n // Unknown addresses are added (which triggers Cloudflare's verification email).\n // Best-effort: if the token can't manage addresses (403) the check is skipped\n // and an empty list is returned. Returns the destinations not yet verified.\n private async ensureDestinations(dests: string[], opts?: RequestOptions): Promise<string[]> {\n if (dests.length === 0) return [];\n const acct = encodeURIComponent(this.credentials.accountId);\n try {\n const res = await this.http.request<\n CfEnvelope<{ email?: string; verified?: string | null }[]>\n >({ path: `/accounts/${acct}/email/routing/addresses`, query: { per_page: 50 }, ...opts });\n const byEmail = new Map(\n (res.result ?? []).map(a => [(a.email ?? '').toLowerCase(), a.verified])\n );\n const unverified: string[] = [];\n for (const dest of dests) {\n const verified = byEmail.get(dest.toLowerCase());\n if (verified) continue;\n if (!byEmail.has(dest.toLowerCase())) {\n await this.http.request<CfEnvelope<unknown>>({\n method: 'POST',\n path: `/accounts/${acct}/email/routing/addresses`,\n body: { email: dest },\n ...opts,\n });\n }\n unverified.push(dest);\n }\n return unverified;\n } catch (error) {\n if (toRegistrarError(error).status === 403) return []; // no address scope; skip\n throw error;\n }\n }\n\n /**\n * Register a domain via POST /registrar/registrations (Registrar API, beta).\n * Cloudflare registers onto the account's default WHOIS contact unless a\n * registrant is supplied; nameservers cannot be set at registration (the domain\n * joins the account on Cloudflare's nameservers). Registration is at-cost —\n * this spends real money — and only standard-tier, API-supported TLDs qualify\n * (premium names return registrable:false from checkAvailability). When the\n * request does not finish synchronously the registration continues server-side\n * and is polled to a terminal state.\n */\n override async registerDomain(\n domainName: string,\n input: RegisterDomainInput,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n try {\n const name = normalizeDomain(domainName);\n const body: Record<string, unknown> = { domain_name: name };\n if (input.autoRenew != null) body.auto_renew = input.autoRenew;\n if (input.privacy != null) body.privacy_mode = input.privacy ? 'redaction' : 'off';\n const registrant = input.contacts?.registrant;\n if (registrant) body.contacts = { registrant: toCfRegistrant(registrant) };\n\n const res = await this.http.request<CfEnvelope<CfRegistration>>({\n method: 'POST',\n path: `${this.registrarPath}/registrations`,\n body,\n ...opts,\n });\n if (!res.success) {\n return { success: false, message: res.errors?.[0]?.message ?? 'Registration failed' };\n }\n\n let reg = res.result;\n for (let i = 0; reg && !reg.completed && reg.state === 'in_progress' && i < 15; i++) {\n await sleep(2000, opts?.signal);\n const poll = await this.http.request<CfEnvelope<CfRegistration>>({\n path: `${this.registrarPath}/registrations/${encodeURIComponent(name)}/registration-status`,\n ...opts,\n });\n if (!poll.success) break;\n reg = poll.result;\n }\n\n if (reg?.completed || reg?.state === 'succeeded') {\n return { success: true, message: `Domain ${domainName} registered successfully` };\n }\n return {\n success: false,\n message: `Registration did not complete (state: ${reg?.state ?? 'unknown'}${\n reg?.reason ? `, ${reg.reason}` : ''\n })`,\n };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n // Cloudflare exposes no post-registration update endpoint for auto-renew, lock,\n // or nameservers. `auto_renew`, `privacy_mode`, and `locked` can be set only at\n // registration (see `registerDomain`); the legacy PUT edit endpoint refuses\n // these fields (422 \"not allowed to perform this action\" for auto_renew/locked,\n // 403 for nameservers) while still accepting `privacy` (see `setPrivacy`).\n // Verified live against the account 2026-08-29 on both a gTLD (.dev) and .uk, so\n // this is API-wide, not TLD-specific. Renewals are likewise not in the API yet.\n // These stay NotImplementedError until Cloudflare ships update endpoints; the\n // wiring (patchDomain + a `name_servers`/`auto_renew`/`locked` body) is ready.\n private static readonly UPDATE_UNAVAILABLE =\n \"Cloudflare's API has no post-registration update endpoint for it; set it during \" +\n 'registration or in the Cloudflare dashboard';\n\n override renewDomain(\n _domainName: string,\n _years = 1,\n _opts?: RequestOptions\n ): Promise<OperationResult> {\n return Promise.reject(\n new NotImplementedError(\n `${this.name}: renewDomain is not available — renewals are not yet in the Cloudflare ` +\n 'Registrar API. Enable auto-renew at registration so the domain renews at expiry'\n )\n );\n }\n\n override updateNameservers(\n _domainName: string,\n _nameservers: string[],\n _opts?: RequestOptions\n ): Promise<OperationResult> {\n return Promise.reject(\n new NotImplementedError(\n `${this.name}: updateNameservers is not available — Cloudflare Registrar nameserver ` +\n 'changes require contacting Cloudflare Support (the API rejects them with 403)'\n )\n );\n }\n\n override lockDomain(_domainName: string, _opts?: RequestOptions): Promise<OperationResult> {\n return Promise.reject(\n new NotImplementedError(\n `${this.name}: lockDomain — ${CloudflareRegistrar.UPDATE_UNAVAILABLE}`\n )\n );\n }\n\n override unlockDomain(_domainName: string, _opts?: RequestOptions): Promise<OperationResult> {\n return Promise.reject(\n new NotImplementedError(\n `${this.name}: unlockDomain — ${CloudflareRegistrar.UPDATE_UNAVAILABLE}`\n )\n );\n }\n\n override setAutoRenew(\n _domainName: string,\n _enabled: boolean,\n _opts?: RequestOptions\n ): Promise<OperationResult> {\n return Promise.reject(\n new NotImplementedError(\n `${this.name}: setAutoRenew — ${CloudflareRegistrar.UPDATE_UNAVAILABLE}`\n )\n );\n }\n\n /**\n * Toggle WHOIS privacy (Cloudflare includes it free). PUT `privacy` on the\n * registrar domain. Whether the registry actually honors the change is\n * TLD-dependent, but Cloudflare accepts the update for supported TLDs.\n */\n override async setPrivacy(\n domainName: string,\n enabled: boolean,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.patchDomain(domainName, { privacy: enabled }, opts);\n }\n\n // confirm a domain exists in the account (registrar domains are keyed by name)\n private async findDomain(domainName: string, opts?: RequestOptions): Promise<CfDomain | null> {\n const res = await this.http.request<CfEnvelope<CfDomain[]>>({\n path: this.accountPath,\n query: { name: domainName },\n ...opts,\n });\n return res.result?.find(d => d.name === domainName) ?? null;\n }\n\n // confirm the domain exists then PUT the given fields (registrar API is name-keyed)\n private async patchDomain(\n domainName: string,\n body: Record<string, unknown>,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n try {\n const domain = await this.findDomain(domainName, opts);\n if (!domain) return { success: false, message: 'Domain not found' };\n\n const res = await this.http.request<CfEnvelope<CfDomain>>({\n method: 'PUT',\n path: `${this.accountPath}/${encodeURIComponent(domainName)}`,\n body,\n ...opts,\n });\n return {\n success: res.success,\n message: res.success ? 'Domain updated successfully' : 'Failed to update domain',\n };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n}\n\n// the Rules phase that holds Single Redirects (URL forwarding) rules.\nconst PHASE_DYNAMIC_REDIRECT = 'http_request_dynamic_redirect';\n// reserved originless AAAA target for proxied placeholder records (see\n// https://developers.cloudflare.com/dns/manage-dns-records/how-to/create-dns-records/#originless-setups)\nconst PLACEHOLDER_AAAA = '100::';\n// sentinel contents this provider writes for forwarding placeholder records, so\n// they can be recognized and cleaned up without touching real records.\nconst PLACEHOLDER_CONTENT = new Set(['100::', '192.0.2.0', '192.0.2.1']);\n\n// extract the single host from a `http.host eq \"FQDN\"` expression, returned\n// relative to the zone apex (\"@\"). Returns null when the expression is not a\n// simple single-host match (e.g. a dynamic or multi-condition rule).\nfunction hostFromExpression(expression: string | undefined, zoneName: string): string | null {\n if (!expression) return null;\n const m = /^\\(?\\s*http\\.host eq \"([^\"]+)\"\\s*\\)?$/.exec(expression.trim());\n if (!m) return null;\n const fqdn = m[1].replace(/\\.$/, '');\n const zone = zoneName.replace(/\\.$/, '');\n if (fqdn === zone) return '@';\n if (fqdn.endsWith(`.${zone}`)) return fqdn.slice(0, -(zone.length + 1));\n return fqdn;\n}\n\n// the first forward destination on an Email Routing rule, or undefined when the\n// rule has no forward action (e.g. drop or Worker).\nfunction forwardAction(rule: CfEmailRule): string | undefined {\n return rule.actions?.find(a => a.type === 'forward')?.value?.[0];\n}\n\n// map a Cloudflare DNS record to the generic DnsRecord shape. `content` holds\n// the value for every type; MX/SRV carry a `priority`, and SRV's weight/port\n// live on the nested `data` object.\nfunction toDnsRecord(r: CfDnsRecord): DnsRecord {\n const type = r.type.toUpperCase();\n const record: DnsRecord = { type, name: r.name, value: r.content ?? '' };\n if (r.ttl != null) record.ttl = r.ttl;\n const priority = r.priority ?? r.data?.priority;\n if ((type === 'MX' || type === 'SRV') && priority != null) record.priority = priority;\n if (type === 'SRV') {\n if (r.data?.weight != null) record.weight = r.data.weight;\n if (r.data?.port != null) record.port = r.data.port;\n }\n return record;\n}\n\n// resolve a DnsRecord name (relative, \"@\" apex, or already a FQDN) to the\n// fully-qualified name Cloudflare's DNS API expects.\nfunction toFqdn(name: string, zoneName: string): string {\n const n = (name ?? '').replace(/\\.$/, '');\n const zone = zoneName.replace(/\\.$/, '');\n if (n === '' || n === '@' || n === zone) return zone;\n if (n.endsWith(`.${zone}`)) return n;\n return `${n}.${zone}`;\n}\n\n// map a normalized DnsRecord to a Cloudflare dns_records create body. `content`\n// holds the value for every type except SRV, whose priority/weight/port/target\n// go on the nested `data` object (Cloudflare derives service/proto from `name`).\nfunction toCfDnsBody(record: DnsRecord, type: string, name: string): Record<string, unknown> {\n if (type === 'SRV') {\n const body: Record<string, unknown> = {\n type,\n name,\n data: {\n priority: record.priority ?? 0,\n weight: record.weight ?? 0,\n port: record.port ?? 0,\n target: record.value,\n },\n };\n if (record.ttl != null) body.ttl = record.ttl;\n return body;\n }\n const body: Record<string, unknown> = { type, name, content: record.value };\n if (record.ttl != null) body.ttl = record.ttl;\n if (type === 'MX') body.priority = record.priority ?? 0;\n return body;\n}\n\n// parse a Cloudflare price string (major currency units, e.g. \"11.20\") to a\n// number, or undefined when absent/unparseable.\nfunction toPrice(value: string | undefined): number | undefined {\n if (value == null || value === '') return undefined;\n const n = Number(value);\n return Number.isFinite(n) ? n : undefined;\n}\n\n// map the library's Contact to Cloudflare's registrant shape (email/phone plus a\n// nested postal_info.address). Cloudflare joins first + last into a single name.\nfunction toCfRegistrant(c: Contact): Record<string, unknown> {\n const name = [c.firstName, c.lastName].filter(Boolean).join(' ');\n const street = [c.address1, c.address2].filter(Boolean).join(', ');\n const postal: Record<string, unknown> = {\n name,\n address: {\n street,\n city: c.city,\n state: c.state,\n postal_code: c.postalCode,\n country_code: c.country,\n },\n };\n if (c.organization) postal.organization = c.organization;\n return { email: c.email, phone: c.phone, postal_info: postal };\n}\n\n// resolve after `ms` milliseconds, rejecting early if `signal` aborts. Used to\n// space out registration status polls. Browser/edge-safe (setTimeout only).\nfunction sleep(ms: number, signal?: AbortSignal): Promise<void> {\n return new Promise((resolve, reject) => {\n const fail = () =>\n reject(signal?.reason instanceof Error ? signal.reason : new Error('aborted'));\n if (signal?.aborted) return fail();\n const timer = setTimeout(resolve, ms);\n signal?.addEventListener(\n 'abort',\n () => {\n clearTimeout(timer);\n fail();\n },\n { once: true }\n );\n });\n}\n\n// map a Cloudflare WHOIS contact to the normalized Contact shape. Optional\n// fields are set only when non-empty (Cloudflare returns \"\" for absent values).\nfunction toContact(c: CfContact): Contact {\n const contact: Contact = {\n firstName: c.first_name ?? '',\n lastName: c.last_name ?? '',\n email: c.email ?? '',\n phone: c.phone ?? '',\n address1: c.address ?? '',\n city: c.city ?? '',\n postalCode: c.zip ?? '',\n country: c.country ?? '',\n };\n if (c.organization) contact.organization = c.organization;\n if (c.fax) contact.fax = c.fax;\n if (c.address2) contact.address2 = c.address2;\n if (c.state) contact.state = c.state;\n return contact;\n}\n","import type {\n ConfigField,\n ConnectionResult,\n Contact,\n ContactSet,\n DnsRecord,\n DnssecStatus,\n Domain,\n DomainAvailability,\n DomainForward,\n EmailForward,\n ListDomainsOptions,\n OperationResult,\n RegisterDomainInput,\n RegistrarOptions,\n RequestOptions,\n TldPricing,\n TransferDomainInput,\n} from '../types';\nimport { createDomain, filterDomains, requireConsent, settableForwards } from '../utils';\nimport { NotFoundError, NotImplementedError, toRegistrarError } from '../errors';\nimport { BaseRegistrar, selectBaseUrl } from '../registrar';\nimport { Feature, type RegistrarFeature } from '../features';\nimport type { RegistrarCredentials } from '../types';\n\n// --- RESTful v2 response shapes (snake_case; captured from the live API) ---\n\n// the standard envelope: HTTP 200 with a `code` of 200 on success, otherwise an\n// `error.description`. Signature/auth failures come back as real HTTP 4xx.\ninterface V2Envelope<T> {\n code?: number;\n message?: string;\n data?: T;\n error?: { code?: string; description?: string };\n}\n\ninterface V2Nameserver {\n server_name?: string;\n ip_list?: string[];\n}\n\n// a DNS record under glue_info (record_value2 carries the MX priority)\ninterface V2DnsRecord {\n sub_host?: string;\n record_type?: string;\n record_value1?: string;\n record_value2?: string;\n}\n\n// the glue/DNS block: `glue_type` is NAME_SERVERS (external NS), DNS (Dynadot-\n// hosted records), REGISTRAR_FORWARDING (URL redirect), or\n// REGISTRAR_STEALTH_FORWARDING (framed/cloaked redirect). It also carries the\n// per-domain email-forwarding settings inline.\ninterface V2GlueInfo {\n glue_type?: string;\n nameserver_list?: V2Nameserver[];\n dns_main_list?: V2DnsRecord[];\n dns_sub_list?: V2DnsRecord[];\n ttl?: string | number;\n // domain (URL) forwarding, present when glue_type is REGISTRAR_FORWARDING /\n // REGISTRAR_STEALTH_FORWARDING. `forward_type` reads back as\n // \"permanently\"/\"temporarily\"; stealth carries a `stealth_title` instead.\n forward_url?: string;\n forward_type?: string;\n stealth_title?: string;\n // email forwarding: `email_forward_type` reads back uppercase\n // (MTYPE_NONE/MTYPE_FORWARD/MTYPE_MX); aliases carry username -> destination.\n email_forward_type?: string;\n email_alias_list?: { username?: string; email?: string }[];\n}\n\n// one DNS-security record from GET .../dnssec. `algorithm` / `digest_type` read\n// back as human labels with the numeric code in parentheses, e.g. \"SHA-256 (2)\".\ninterface V2DnssecInfo {\n key_tag?: string | number;\n algorithm?: string | number;\n digest_type?: string | number;\n digest?: string;\n}\n\n// Dynadot's default nameservers, used to switch a domain off URL forwarding\n// (there is no dedicated \"clear forwarding\" endpoint).\nconst DYNADOT_DEFAULT_NS = ['ns1.dynadot.com', 'ns2.dynadot.com'];\n\ninterface V2DomainInfo {\n domain_name?: string;\n expiration_date?: number;\n registration_date?: number;\n glue_info?: V2GlueInfo;\n registrant_contact_id?: number;\n admin_contact_id?: number;\n technical_contact_id?: number;\n billing_contact_id?: number;\n locked?: string;\n privacy?: string;\n renew_option?: string;\n status?: string;\n}\n\n// a full contact record. Name is one combined field; phone/fax split into a\n// country code + number.\ninterface V2Contact {\n contact_id?: number;\n organization?: string;\n name?: string;\n email?: string;\n phone_number?: string;\n phone_cc?: string | number;\n fax_number?: string;\n fax_cc?: string | number;\n address1?: string;\n address2?: string;\n city?: string;\n state?: string;\n zip?: string;\n country?: string;\n}\n\ninterface V2Price {\n currency?: string;\n unit?: string; // e.g. \"(price/1 year)\"\n registration_price?: string;\n renewal_price?: string;\n transfer_price?: string;\n restore_price?: string;\n}\n\ninterface V2SearchResult {\n domain_name?: string;\n available?: string; // \"Yes\" | \"No\"\n premium?: string; // \"yes\" | \"no\"\n price_list?: V2Price[];\n}\n\n// bulk_search is capped conservatively; the endpoint takes a comma-joined list\nconst SEARCH_BATCH_SIZE = 100;\n\n// Dynadot DNS record types that map cleanly to our generic DnsRecord types.\n// (Dynadot also has forward/stealth/email pseudo-records — those are forwarding\n// features, not generic DNS, so they're excluded here.)\nconst SUPPORTED_DNS_TYPES = new Set(['A', 'AAAA', 'CNAME', 'MX', 'TXT', 'NS', 'SRV', 'CAA']);\n\n/**\n * Dynadot Registrar\n * API docs: https://www.dynadot.com/domain/api-document\n *\n * Targets Dynadot's **RESTful v2 API** (`https://api.dynadot.com/restful/v2/…`).\n *\n * ## Authentication\n * Two credentials: an **API key** (the public identifier, sent as\n * `Authorization: Bearer <key>`) and an **API secret** (used only to sign\n * requests). Every request carries an `X-Signature` header — the Base64 HMAC-\n * SHA256, keyed by the secret, of:\n *\n * `apiKey + \"\\n\" + pathAndQuery + \"\\n\" + \"\" + \"\\n\" + body`\n *\n * The third component is the (optional) `X-Request-Id`; this client signs it as\n * an empty string and does not send the header. Signing uses Web Crypto\n * (`crypto.subtle`), so it stays browser/edge-safe.\n *\n * Enable both keys under Tools > API in a Dynadot account (the account must be\n * unlocked with API access enabled).\n *\n * ## Envelope\n * Responses are `{ code, message, data }`, with `code: 200` on success and an\n * `error.description` otherwise. Note Dynadot returns HTTP 200 even for logical\n * errors (a bad command, a missing domain) — only auth/signature failures are\n * real HTTP 4xx — so success is read from the envelope `code`, not the status.\n *\n * ## Verification\n * Every method's path and payload is verified against a live account. Reads\n * (`testConnection`, `listDomains`, `getDomain`, `getNameservers`,\n * `getContacts`, `getDnsRecords`, `checkAvailability`, `getPricing`) were run\n * against the production account; all writes (`registerDomain`, `transferIn`,\n * `renewDomain`, `setAutoRenew`, `updateNameservers`, `lockDomain`/\n * `unlockDomain`, `setPrivacy`, `setDnsRecords`) were exercised end-to-end in the\n * Dynadot sandbox (`api-sandbox.dynadot.com`), which mirrors the API.\n */\nexport class DynadotRegistrar extends BaseRegistrar {\n readonly name = 'dynadot';\n\n static readonly displayName = 'Dynadot';\n static readonly helpText =\n 'Under Tools > API in your Dynadot account, generate an API Key and API Secret. ' +\n 'The account must be unlocked with API access enabled. The key identifies you; ' +\n 'the secret signs requests (X-Signature) and is never sent directly.';\n static readonly configFields: ConfigField[] = [\n { name: 'apiKey', label: 'API Key', type: 'password', required: true },\n { name: 'apiSecret', label: 'API Secret', type: 'password', required: true },\n ];\n static readonly supportsSandbox = true; // api-sandbox.dynadot.com mirrors the API\n // On top of core: transfer-out auth code, DNSSEC read/disable, and email +\n // domain (URL) forwarding. All implemented on the v2 transport and verified in\n // the Dynadot sandbox.\n static readonly extendedFeatures: readonly RegistrarFeature[] = [\n Feature.GetAuthCode,\n Feature.GetDnssec,\n Feature.DisableDnssec,\n Feature.GetEmailForwarding,\n Feature.SetEmailForwarding,\n Feature.GetDomainForwarding,\n Feature.SetDomainForwarding,\n ];\n\n constructor(credentials: RegistrarCredentials, options?: RegistrarOptions) {\n super(\n credentials,\n {\n // baseUrl is the host; each request builds the full /restful/v2/… path\n baseUrl: selectBaseUrl('Dynadot', options?.environment, {\n production: 'https://api.dynadot.com',\n sandbox: 'https://api-sandbox.dynadot.com',\n }),\n headers: { Authorization: `Bearer ${credentials.apiKey}` },\n },\n options\n );\n }\n\n // sign and issue a request. `pathAndQuery` is the exact request target\n // (path + any query), used verbatim both to sign and to send so the two match.\n private async signedRequest<T>(\n method: string,\n pathAndQuery: string,\n body?: unknown,\n opts?: RequestOptions\n ): Promise<V2Envelope<T>> {\n const bodyStr = body !== undefined ? JSON.stringify(body) : '';\n const stringToSign = `${this.credentials.apiKey}\\n${pathAndQuery}\\n\\n${bodyStr}`;\n const signature = await hmacSha256Base64(this.credentials.apiSecret, stringToSign);\n return this.http.request<V2Envelope<T>>({\n method,\n path: pathAndQuery,\n body,\n // Dynadot requires application/json even on bodyless mutations (e.g. the\n // DELETE for disableDnssec), so set it explicitly rather than relying on\n // the client's body-present default.\n headers: { 'X-Signature': signature, 'Content-Type': 'application/json' },\n ...opts,\n });\n }\n\n // issue a request and return its `data`, throwing on a non-2xx envelope code\n private async read<T>(\n method: string,\n pathAndQuery: string,\n body?: unknown,\n opts?: RequestOptions\n ): Promise<T> {\n const env = await this.signedRequest<T>(method, pathAndQuery, body, opts);\n if (!isOk(env.code)) {\n throw new Error(env.error?.description ?? env.message ?? 'Dynadot request failed');\n }\n return env.data as T;\n }\n\n // issue a mutating request and map its envelope to an OperationResult. The\n // envelope `code` mirrors the HTTP status, so success spans 2xx (register is\n // 200, transfer_in is 202 Accepted).\n private async mutate(\n method: string,\n pathAndQuery: string,\n body: unknown,\n successMessage: string,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n try {\n const env = await this.signedRequest<unknown>(method, pathAndQuery, body, opts);\n const ok = isOk(env.code);\n return {\n success: ok,\n message: ok ? successMessage : (env.error?.description ?? env.message ?? 'Request failed'),\n };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n override async testConnection(opts?: RequestOptions): Promise<ConnectionResult> {\n try {\n await this.read<{ account_info?: unknown }>(\n 'GET',\n '/restful/v2/accounts/info',\n undefined,\n opts\n );\n return { success: true, message: 'Connection successful' };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n override async listDomains(opts?: ListDomainsOptions): Promise<Domain[]> {\n // GET /domains returns the whole account in one response, nameservers inline.\n const { search, ...reqOpts } = opts ?? {};\n const data = await this.read<{ domain_info_list?: V2DomainInfo[] }>(\n 'GET',\n '/restful/v2/domains',\n undefined,\n reqOpts\n );\n const domains = (data.domain_info_list ?? []).map(info => this.toDomain(info));\n return filterDomains(domains, search);\n }\n\n override async getDomain(domainName: string, opts?: RequestOptions): Promise<Domain> {\n return this.toDomain(await this.domainInfo(domainName, opts));\n }\n\n // fetch and unwrap GET /domains/{name} -> data.domain_info (shared by getDomain,\n // getContacts, and the forwarding reads, which all read from domain_info)\n private async domainInfo(domainName: string, opts?: RequestOptions): Promise<V2DomainInfo> {\n const data = await this.read<{ domain_info?: V2DomainInfo }>(\n 'GET',\n `/restful/v2/domains/${encodeURIComponent(domainName)}`,\n undefined,\n opts\n );\n if (!data.domain_info) throw new NotFoundError(`Dynadot: domain '${domainName}' not found`);\n return data.domain_info;\n }\n\n override async getNameservers(domainName: string, opts?: RequestOptions): Promise<string[]> {\n // domain_info carries the nameservers inline (empty for Dynadot-DNS-hosted\n // domains, which have no external NS)\n const domain = await this.getDomain(domainName, opts);\n return domain.nameservers;\n }\n\n /**\n * Reads registrant/admin/tech/billing contacts. domain_info carries a numeric\n * contact id per role; this resolves each distinct id via GET /contacts/{id}\n * (roles usually share one contact, so ids are de-duplicated).\n */\n override async getContacts(domainName: string, opts?: RequestOptions): Promise<ContactSet> {\n const info = await this.domainInfo(domainName, opts);\n\n const roleIds: [keyof ContactSet, string][] = [\n ['registrant', str(info.registrant_contact_id)],\n ['admin', str(info.admin_contact_id)],\n ['tech', str(info.technical_contact_id)],\n ['billing', str(info.billing_contact_id)],\n ];\n\n const byId = new Map<string, Contact>();\n for (const [, id] of roleIds) {\n if (!id || id === '0' || byId.has(id)) continue;\n const cdata = await this.read<{ contact?: V2Contact }>(\n 'GET',\n `/restful/v2/contacts/${encodeURIComponent(id)}`,\n undefined,\n opts\n );\n if (cdata.contact) byId.set(id, toContact(cdata.contact));\n }\n\n const contacts: ContactSet = {};\n for (const [role, id] of roleIds) {\n const contact = byId.get(id);\n if (contact) contacts[role] = contact;\n }\n return contacts;\n }\n\n override async getDnsRecords(domainName: string, opts?: RequestOptions): Promise<DnsRecord[]> {\n const data = await this.read<{ glue_info?: V2GlueInfo }>(\n 'GET',\n `/restful/v2/domains/${encodeURIComponent(domainName)}/records`,\n undefined,\n opts\n );\n const glue = data.glue_info ?? {};\n // only Dynadot-hosted DNS has records; NAME_SERVERS / forwarding domains have none\n if (glue.glue_type !== 'DNS') return [];\n const ttl = glue.ttl != null ? Number(glue.ttl) : undefined;\n return [\n ...(glue.dns_main_list ?? []).map(r => toDnsRecord(r, '@', ttl)),\n ...(glue.dns_sub_list ?? []).map(r => toDnsRecord(r, r.sub_host ?? '', ttl)),\n ];\n }\n\n /**\n * Availability via `bulk_search` (comma-joined `domain_name_list`), batched.\n * `show_price=true` returns a `price_list` per name; the first (1-year) entry's\n * registration price is surfaced.\n */\n override async checkAvailability(\n domainNames: string[],\n opts?: RequestOptions\n ): Promise<DomainAvailability[]> {\n const results: DomainAvailability[] = [];\n for (let i = 0; i < domainNames.length; i += SEARCH_BATCH_SIZE) {\n const batch = domainNames.slice(i, i + SEARCH_BATCH_SIZE);\n const list = encodeURIComponent(batch.join(','));\n const data = await this.read<{ domain_result_list?: V2SearchResult[] }>(\n 'GET',\n `/restful/v2/domains/bulk_search?domain_name_list=${list}&show_price=true`,\n undefined,\n opts\n );\n for (const r of data.domain_result_list ?? []) {\n const price = oneYearPrice(r.price_list);\n results.push({\n domainName: r.domain_name ?? '',\n available: r.available === 'Yes',\n premium: r.premium != null ? r.premium.toLowerCase() === 'yes' : undefined,\n price: price?.registration,\n currency: price?.currency,\n period: price ? 1 : undefined,\n });\n }\n }\n return results;\n }\n\n /**\n * Pricing for a specific domain (may be premium). Needs a full domain (e.g.\n * \"example.com\"); a bare TLD throws, since v2 has no standalone TLD-price\n * endpoint.\n *\n * For a domain **already in the account**, the classic `renew` command with\n * `price_check=1` returns the exact renewal fee — premium names included —\n * without renewing. `bulk_search` (the v2 pricing path) only quotes names\n * *available to register*, so it can't price an owned domain's renewal. We try\n * the price check first and fall back to `bulk_search` for names not in the\n * account (e.g. pricing a domain before registering it).\n */\n override async getPricing(tldOrDomain: string, opts?: RequestOptions): Promise<TldPricing> {\n if (!tldOrDomain.includes('.')) {\n throw new NotImplementedError(\n `${this.name}: getPricing needs a full domain (e.g. \"example.com\"); ` +\n 'Dynadot v2 has no standalone per-TLD price endpoint'\n );\n }\n const tld = tldOrDomain.slice(tldOrDomain.indexOf('.') + 1);\n\n // Owned domain: the price-check renew quote is the exact renewal (premium\n // included). Skips bulk_search, which returns nothing for a registered name.\n const checked = await this.renewPriceCheck(tldOrDomain, opts);\n if (checked) {\n return { tld, currency: checked.currency, renewal: checked.renewal };\n }\n\n // Not in the account — fall back to bulk_search for available-name pricing.\n const list = encodeURIComponent(tldOrDomain);\n const data = await this.read<{ domain_result_list?: V2SearchResult[] }>(\n 'GET',\n `/restful/v2/domains/bulk_search?domain_name_list=${list}&show_price=true`,\n undefined,\n opts\n );\n const result = (data.domain_result_list ?? [])[0];\n const price = oneYearPrice(result?.price_list);\n return {\n tld,\n currency: price?.currency ?? 'USD',\n registration: price?.registration,\n renewal: price?.renewal,\n transfer: price?.transfer,\n };\n }\n\n /**\n * Renewal price for a domain already in the account, via the classic\n * `/api3.json?command=renew&price_check=1` quote (the RESTful v2 renew endpoint\n * executes immediately and has no price-only mode). Authenticates with the same\n * API key as a query parameter — the classic command is unsigned. `PriceInfo`\n * reads e.g. \"Renew Fee: 108.90 in USD, Total: 108.90 in USD, The domain is\n * premium\". Returns null when the domain isn't in the account or the fee can't\n * be parsed, so the caller can fall back.\n */\n private async renewPriceCheck(\n domain: string,\n opts?: RequestOptions\n ): Promise<{ renewal: number; currency: string } | null> {\n const params = new URLSearchParams({\n key: this.credentials.apiKey,\n command: 'renew',\n domain,\n duration: '1',\n price_check: '1',\n });\n try {\n const res = await this.http.request<{\n RenewResponse?: { Status?: string; PriceInfo?: string };\n }>({ method: 'GET', path: `/api3.json?${params.toString()}`, ...opts });\n const info = res.RenewResponse;\n if (info?.Status !== 'price_check_success' || !info.PriceInfo) return null;\n const match = info.PriceInfo.match(/Renew Fee:\\s*([\\d.]+)\\s+in\\s+([A-Za-z]{3})/);\n if (!match) return null;\n const renewal = Number(match[1]);\n return Number.isNaN(renewal) ? null : { renewal, currency: match[2].toUpperCase() };\n } catch {\n return null;\n }\n }\n\n // --- writes (paths + bodies verified against the Dynadot sandbox) ---\n\n /**\n * Registers a domain via POST /domains/{name}/register. The body nests the\n * order under a `domain` object; v2 uses the account's default WHOIS contacts,\n * so `input.contacts` is not sent. `privacy` maps to Dynadot's privacy level\n * (\"full\"/\"off\"). Spends real money in production.\n */\n override async registerDomain(\n domainName: string,\n input: RegisterDomainInput,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n requireConsent(this.name, input.consent);\n return this.mutate(\n 'POST',\n `/restful/v2/domains/${encodeURIComponent(domainName)}/register`,\n { domain: { duration: input.years ?? 1, privacy: input.privacy ? 'full' : 'off' } },\n `Domain ${domainName} registered successfully`,\n opts\n );\n }\n\n /**\n * Transfers a domain in with its auth/EPP code (nested under `domain`, like\n * register). Returns 202 Accepted on success. Contacts come from the account\n * default. Spends real money in production.\n */\n override async transferIn(\n domainName: string,\n input: TransferDomainInput,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n requireConsent(this.name, input.consent);\n return this.mutate(\n 'POST',\n `/restful/v2/domains/${encodeURIComponent(domainName)}/transfer_in`,\n {\n domain: {\n auth_code: input.authCode,\n duration: input.years ?? 1,\n privacy: input.privacy ? 'full' : 'off',\n },\n },\n `Domain ${domainName} transfer requested successfully`,\n opts\n );\n }\n\n /**\n * Renews a domain. Dynadot's renew takes both the number of years (`duration`)\n * and the domain's current expiration `year` as a guard against double-renews,\n * so this reads the current expiration first.\n */\n override async renewDomain(\n domainName: string,\n years = 1,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const domain = await this.getDomain(domainName, opts);\n const year = domain.expirationDate?.getUTCFullYear();\n if (year == null) {\n return { success: false, message: `Dynadot: could not read ${domainName}'s expiration year` };\n }\n return this.mutate(\n 'POST',\n `/restful/v2/domains/${encodeURIComponent(domainName)}/renew`,\n { duration: years, year },\n 'Domain renewed successfully',\n opts\n );\n }\n\n // Auto-renew via the renew_option endpoint. The accepted write values are\n // \"auto\" (auto-renew), \"donot\" (do not renew), and \"reset\" (manual renewal) —\n // note these differ from the read values (\"auto-renew\" etc.).\n override async setAutoRenew(\n domainName: string,\n enabled: boolean,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.mutate(\n 'PUT',\n `/restful/v2/domains/${encodeURIComponent(domainName)}/renew_option`,\n { renew_option: enabled ? 'auto' : 'donot' },\n `Auto-renew ${enabled ? 'enabled' : 'disabled'} successfully`,\n opts\n );\n }\n\n // Replace nameservers via PUT .../nameservers with a `nameserver_list` of\n // hostname strings.\n override async updateNameservers(\n domainName: string,\n nameservers: string[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n if (nameservers.length < 2 || nameservers.length > 13) {\n throw new Error('Dynadot requires 2-13 nameservers');\n }\n return this.mutate(\n 'PUT',\n `/restful/v2/domains/${encodeURIComponent(domainName)}/nameservers`,\n { nameserver_list: nameservers },\n 'Nameservers updated successfully',\n opts\n );\n }\n\n // Transfer lock via PUT .../domain_lock with a boolean `lock`.\n override async lockDomain(domainName: string, opts?: RequestOptions): Promise<OperationResult> {\n return this.setLock(domainName, true, opts);\n }\n\n override async unlockDomain(domainName: string, opts?: RequestOptions): Promise<OperationResult> {\n return this.setLock(domainName, false, opts);\n }\n\n private setLock(\n domainName: string,\n locked: boolean,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.mutate(\n 'PUT',\n `/restful/v2/domains/${encodeURIComponent(domainName)}/domain_lock`,\n { lock: locked },\n `Domain ${locked ? 'locked' : 'unlocked'} successfully`,\n opts\n );\n }\n\n // WHOIS privacy via PUT .../privacy with a `privacy_level` of \"full\"/\"off\".\n override async setPrivacy(\n domainName: string,\n enabled: boolean,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.mutate(\n 'PUT',\n `/restful/v2/domains/${encodeURIComponent(domainName)}/privacy`,\n { privacy_level: enabled ? 'full' : 'off' },\n `Privacy ${enabled ? 'enabled' : 'disabled'} successfully`,\n opts\n );\n }\n\n /**\n * Updates contact roles. Dynadot contacts are account-level records referenced\n * by id, so this creates a contact per supplied role (`POST /contacts`) and\n * points the domain's roles at the new ids (`PUT /domains/{d}/contacts`). Roles\n * not supplied keep their current contact id (read first and passed through, as\n * the PUT sets all four). Identical contacts across roles are created once.\n * Verified end-to-end in the sandbox.\n */\n override async updateContacts(\n domainName: string,\n contacts: ContactSet,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n if (!contacts.registrant && !contacts.admin && !contacts.tech && !contacts.billing) {\n throw new Error(`${this.name}: updateContacts requires at least one contact role`);\n }\n // read current ids so unspecified roles are preserved (the PUT sets all four)\n const info = (\n await this.read<{ domain_info?: V2DomainInfo }>(\n 'GET',\n `/restful/v2/domains/${encodeURIComponent(domainName)}`,\n undefined,\n opts\n )\n ).domain_info;\n if (!info) throw new NotFoundError(`Dynadot: domain '${domainName}' not found`);\n\n const created = new Map<Contact, number>();\n const idFor = async (c: Contact): Promise<number> => {\n let id = created.get(c);\n if (id == null) {\n const data = await this.read<{ contact_id: number }>(\n 'POST',\n '/restful/v2/contacts',\n { contact: toDynadotContact(c) },\n opts\n );\n id = data.contact_id;\n created.set(c, id);\n }\n return id;\n };\n\n const body = {\n registrant_contact_id: contacts.registrant\n ? await idFor(contacts.registrant)\n : info.registrant_contact_id,\n admin_contact_id: contacts.admin ? await idFor(contacts.admin) : info.admin_contact_id,\n technical_contact_id: contacts.tech ? await idFor(contacts.tech) : info.technical_contact_id,\n billing_contact_id: contacts.billing\n ? await idFor(contacts.billing)\n : info.billing_contact_id,\n };\n return this.mutate(\n 'PUT',\n `/restful/v2/domains/${encodeURIComponent(domainName)}/contacts`,\n body,\n 'Contacts updated successfully',\n opts\n );\n }\n\n /**\n * Replaces the DNS record set via POST /domains/{name}/records. Records split\n * into apex (\"main\") and subdomain lists, mirroring the read shape; MX priority\n * rides in record_value2. Only generic DNS types are supported. Verified live\n * (add/restore round-trip): the body is accepted and non-forwarding records are\n * fully replaced.\n */\n override async setDnsRecords(\n domainName: string,\n records: DnsRecord[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const mainList: V2DnsRecord[] = [];\n const subList: V2DnsRecord[] = [];\n let ttl: number | undefined;\n\n for (const r of records) {\n const type = r.type.toUpperCase();\n if (!SUPPORTED_DNS_TYPES.has(type)) {\n throw new Error(`Dynadot: DNS record type '${type}' is not supported`);\n }\n if (ttl == null && r.ttl != null) ttl = r.ttl;\n const entry: V2DnsRecord = { record_type: type.toLowerCase(), record_value1: r.value };\n if (type === 'MX' && r.priority != null) entry.record_value2 = String(r.priority);\n\n const isApex = r.name === '@' || r.name === '' || r.name === domainName;\n if (isApex) {\n mainList.push(entry);\n } else {\n subList.push({ ...entry, sub_host: r.name });\n }\n }\n\n const glue: V2GlueInfo = { glue_type: 'DNS', dns_main_list: mainList, dns_sub_list: subList };\n if (ttl != null) glue.ttl = String(ttl);\n\n return this.mutate(\n 'POST',\n `/restful/v2/domains/${encodeURIComponent(domainName)}/records`,\n glue,\n 'DNS records updated successfully',\n opts\n );\n }\n\n // --- extended capabilities ---------------------------------------------\n\n /**\n * The transfer authorization (EPP) code via GET .../transfer_auth_code. Reads\n * the current code (Dynadot can also mint a fresh one with `new_code=true`, not\n * used here to avoid a side effect on a read).\n */\n override async getAuthCode(domainName: string, opts?: RequestOptions): Promise<string> {\n const data = await this.read<{ auth_code?: string }>(\n 'GET',\n `/restful/v2/domains/${encodeURIComponent(domainName)}/transfer_auth_code`,\n undefined,\n opts\n );\n return data.auth_code ?? '';\n }\n\n /**\n * DNSSEC status via GET .../dnssec, which returns a list of DS records\n * (`dnssec_info_list`); a non-empty list means DNSSEC is enabled. `algorithm`\n * and `digest_type` come back as labels with the numeric code in parentheses\n * (e.g. \"SHA-256 (2)\"), so parse the code out.\n */\n override async getDnssec(domainName: string, opts?: RequestOptions): Promise<DnssecStatus> {\n const data = await this.read<{ dnssec_info_list?: V2DnssecInfo[] }>(\n 'GET',\n `/restful/v2/domains/${encodeURIComponent(domainName)}/dnssec`,\n undefined,\n opts\n );\n const list = data.dnssec_info_list ?? [];\n return {\n enabled: list.length > 0,\n dsRecords: list.map(d => ({\n keyTag: parseCode(d.key_tag),\n algorithm: parseCode(d.algorithm),\n digestType: parseCode(d.digest_type),\n digest: d.digest ?? '',\n })),\n };\n }\n\n // Disable DNSSEC via DELETE .../dnssec (removes the registrar's DS records).\n override disableDnssec(domainName: string, opts?: RequestOptions): Promise<OperationResult> {\n return this.mutate(\n 'DELETE',\n `/restful/v2/domains/${encodeURIComponent(domainName)}/dnssec`,\n undefined,\n 'DNSSEC disabled successfully',\n opts\n );\n }\n\n /**\n * Read alias-style email forwarding from domain_info's inline `glue_info`\n * (Dynadot has no standalone endpoint). Only `MTYPE_FORWARD` carries redirect\n * aliases; MX-mode (`MTYPE_MX`) and none return no rules.\n */\n override async getEmailForwarding(\n domainName: string,\n opts?: RequestOptions\n ): Promise<EmailForward[]> {\n const glue = (await this.domainInfo(domainName, opts)).glue_info;\n if ((glue?.email_forward_type ?? '').toUpperCase() !== 'MTYPE_FORWARD') return [];\n return (glue?.email_alias_list ?? [])\n .map(a => ({ alias: a.username ?? '', forwardTo: a.email ?? '' }))\n .filter(f => f.alias && f.forwardTo);\n }\n\n /**\n * Replace email forwarding via PUT .../email_forwarding (full replace; an empty\n * list clears it with `mtype_none`). Requires the domain to use Dynadot DNS —\n * the API rejects it when the record is a CNAME.\n */\n override async setEmailForwarding(\n domainName: string,\n forwards: EmailForward[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const body =\n forwards.length === 0\n ? { email_forward_type: 'mtype_none', email_alias_list: [], email_exchange_list: [] }\n : {\n email_forward_type: 'mtype_forward',\n email_alias_list: forwards.map(f => ({ username: f.alias, email: f.forwardTo })),\n email_exchange_list: [],\n };\n return this.mutate(\n 'PUT',\n `/restful/v2/domains/${encodeURIComponent(domainName)}/email_forwarding`,\n body,\n 'Email forwarding updated successfully',\n opts\n );\n }\n\n /**\n * Read domain (URL) forwarding from domain_info's inline `glue_info`. Dynadot\n * forwards the whole domain, so this returns at most one rule at host \"@\":\n * REGISTRAR_FORWARDING is a 301/302 redirect (`forward_type`\n * permanently/temporarily). REGISTRAR_STEALTH_FORWARDING (a masked/framed\n * redirect) is reported as read-only `masked` — `setDomainForwarding` rejects it.\n */\n override async getDomainForwarding(\n domainName: string,\n opts?: RequestOptions\n ): Promise<DomainForward[]> {\n const glue = (await this.domainInfo(domainName, opts)).glue_info;\n const type = (glue?.glue_type ?? '').toUpperCase();\n if (!glue?.forward_url) return [];\n if (type === 'REGISTRAR_STEALTH_FORWARDING') {\n return [{ host: '@', url: glue.forward_url, type: 'masked' }];\n }\n if (type === 'REGISTRAR_FORWARDING') {\n const temporary = (glue.forward_type ?? '').toLowerCase().startsWith('temp');\n return [{ host: '@', url: glue.forward_url, type: temporary ? 'temporary' : 'permanent' }];\n }\n return [];\n }\n\n /**\n * Set domain (URL) forwarding. Dynadot forwards the entire domain, so at most\n * one rule (host \"@\") is accepted: `temporary`/`permanent` use standard\n * forwarding (302 vs 301). An empty list clears forwarding — Dynadot has no\n * \"off\" for it, so we restore its default nameservers, which is the neutral\n * non-forwarding state.\n */\n override async setDomainForwarding(\n domainName: string,\n forwards: DomainForward[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const enc = encodeURIComponent(domainName);\n if (forwards.length === 0) {\n return this.mutate(\n 'PUT',\n `/restful/v2/domains/${enc}/nameservers`,\n { nameserver_list: DYNADOT_DEFAULT_NS },\n 'Domain forwarding cleared successfully',\n opts\n );\n }\n if (forwards.length > 1) {\n throw new Error('Dynadot forwards the whole domain; only a single \"@\" rule is supported');\n }\n const [f] = settableForwards(forwards); // reject masked before any write\n if (f.host && f.host !== '@') {\n throw new Error(\n 'Dynadot forwards the whole domain; per-host forwarding is not supported (use host \"@\")'\n );\n }\n return this.mutate(\n 'PUT',\n `/restful/v2/domains/${enc}/domain_forwarding`,\n { forward_url: f.url, is_temporary: f.type === 'temporary' },\n 'Domain forwarding updated successfully',\n opts\n );\n }\n\n // map a v2 domain_info payload to the normalized Domain shape\n private toDomain(d: V2DomainInfo): Domain {\n return createDomain({\n domainName: d.domain_name,\n registrar: this.name,\n status: d.status ?? '',\n createdDate: d.registration_date ?? null,\n expirationDate: d.expiration_date ?? null,\n renewalDate: d.expiration_date ?? null,\n autoRenew: d.renew_option === 'auto-renew' || d.renew_option === 'auto',\n locked: d.locked === 'Yes',\n privacy: isPrivacyOn(d.privacy),\n nameservers: extractNameservers(d.glue_info),\n });\n }\n}\n\n// --- signing ---\n\n// Base64-encoded HMAC-SHA256 of `message`, keyed by `secret` (UTF-8). Uses Web\n// Crypto so it runs unchanged in browsers, edge runtimes, and Node.\nasync function hmacSha256Base64(secret: string, message: string): Promise<string> {\n const enc = new TextEncoder();\n const key = await crypto.subtle.importKey(\n 'raw',\n enc.encode(secret),\n { name: 'HMAC', hash: 'SHA-256' },\n false,\n ['sign']\n );\n const signature = await crypto.subtle.sign('HMAC', key, enc.encode(message));\n let binary = '';\n for (const byte of new Uint8Array(signature)) binary += String.fromCharCode(byte);\n return btoa(binary);\n}\n\n// --- mapping helpers ---\n\n// whether a v2 envelope `code` (which mirrors the HTTP status) is a success —\n// 2xx, so it covers 200 and transfer_in's 202 Accepted\nfunction isOk(code: number | undefined): boolean {\n return code != null && code >= 200 && code < 300;\n}\n\n// map a v2 DNS record to the normalized DnsRecord shape\nfunction toDnsRecord(r: V2DnsRecord, name: string, ttl: number | undefined): DnsRecord {\n const type = (r.record_type ?? '').toUpperCase();\n const record: DnsRecord = { type, name, value: r.record_value1 ?? '' };\n if (ttl != null) record.ttl = ttl;\n // MX priority (distance) rides in record_value2\n if (type === 'MX' && r.record_value2 != null && r.record_value2 !== '') {\n record.priority = Number(r.record_value2);\n }\n return record;\n}\n\n// map a v2 contact record to the normalized Contact shape\nfunction toContact(c: V2Contact): Contact {\n const { firstName, lastName } = splitName(str(c.name));\n const contact: Contact = {\n firstName,\n lastName,\n email: str(c.email),\n phone: joinPhone(c.phone_cc, c.phone_number),\n address1: str(c.address1),\n city: str(c.city),\n postalCode: str(c.zip),\n country: str(c.country),\n };\n const organization = str(c.organization);\n if (organization) contact.organization = organization;\n const fax = joinPhone(c.fax_cc, c.fax_number);\n if (fax) contact.fax = fax;\n const address2 = str(c.address2);\n if (address2) contact.address2 = address2;\n const state = str(c.state);\n if (state) contact.state = state;\n return contact;\n}\n\n// whether a v2 privacy string denotes privacy being on. The API reports several\n// values: \"Full Privacy\"/\"Partial Privacy\" (on) vs \"Privacy Off\"/\"No Privacy\"\n// (off), so key off the level word rather than a simple prefix.\nfunction isPrivacyOn(privacy: string | undefined): boolean {\n const p = (privacy ?? '').toLowerCase();\n if (!p || p.includes('off') || p.startsWith('no')) return false;\n return p.includes('full') || p.includes('partial') || p.includes('privacy');\n}\n\n// pick the 1-year price entry (falling back to the first), mapping to numbers\nfunction oneYearPrice(\n prices: V2Price[] | undefined\n): { currency?: string; registration?: number; renewal?: number; transfer?: number } | undefined {\n if (!prices?.length) return undefined;\n const oneYear = prices.find(p => /\\b1\\s*year\\b/i.test(p.unit ?? '')) ?? prices[0];\n return {\n currency: oneYear.currency,\n registration: toNumber(oneYear.registration_price),\n renewal: toNumber(oneYear.renewal_price),\n transfer: toNumber(oneYear.transfer_price),\n };\n}\n\n// pull the external nameserver hostnames from a glue_info block\nfunction extractNameservers(glue: V2GlueInfo | undefined): string[] {\n return (glue?.nameserver_list ?? []).map(ns => str(ns.server_name)).filter(Boolean);\n}\n\n// Dynadot stores a single combined name; split on the first space\nfunction splitName(name: string): { firstName: string; lastName: string } {\n const trimmed = name.trim();\n const space = trimmed.indexOf(' ');\n if (space === -1) return { firstName: trimmed, lastName: '' };\n return { firstName: trimmed.slice(0, space), lastName: trimmed.slice(space + 1).trim() };\n}\n\n// rejoin a split country code + number as \"+cc.number\" (e.g. \"+1.4805551234\")\n// map the normalized Contact to Dynadot's contact shape (name + split phone).\n// The inverse of toContact: joins first/last into `name` and splits the\n// \"+cc.number\" phone into phone_cc / phone_number.\nfunction toDynadotContact(c: Contact): Record<string, unknown> {\n const phone = splitDynadotPhone(c.phone);\n const contact: Record<string, unknown> = {\n name: `${c.firstName} ${c.lastName}`.trim(),\n email: c.email,\n phone_cc: phone.cc,\n phone_number: phone.number,\n address1: c.address1,\n city: c.city,\n zip: c.postalCode,\n country: c.country,\n };\n if (c.organization) contact.organization = c.organization;\n if (c.address2) contact.address2 = c.address2;\n if (c.state) contact.state = c.state;\n if (c.fax) {\n const fax = splitDynadotPhone(c.fax);\n contact.fax_cc = fax.cc;\n contact.fax_number = fax.number;\n }\n return contact;\n}\n\n// split an international phone (\"+1.4805551234\") into country code + number,\n// the inverse of joinPhone. Falls back to all digits as the number.\nfunction splitDynadotPhone(phone: string): { cc: string; number: string } {\n const trimmed = (phone ?? '').trim();\n const dot = trimmed.indexOf('.');\n if (trimmed.startsWith('+') && dot > 1) {\n return {\n cc: trimmed.slice(1, dot).replace(/\\D/g, ''),\n number: trimmed.slice(dot + 1).replace(/\\D/g, ''),\n };\n }\n return { cc: '', number: trimmed.replace(/\\D/g, '') };\n}\n\nfunction joinPhone(cc: string | number | undefined, num: string | number | undefined): string {\n const number = str(num);\n if (!number) return '';\n const code = str(cc);\n return code ? `+${code}.${number}` : number;\n}\n\n// stringify a loosely-typed scalar, guarding against objects/arrays\nfunction str(value: unknown): string {\n return typeof value === 'string' ? value : typeof value === 'number' ? String(value) : '';\n}\n\n// parse a price string like \"10.88\" into a number, or undefined\nfunction toNumber(value: string | undefined): number | undefined {\n if (value == null || value === '') return undefined;\n const n = Number(value);\n return Number.isFinite(n) ? n : undefined;\n}\n\n// Dynadot reports DNSSEC algorithm / digest-type as a label with the numeric\n// code in parentheses, e.g. \"SHA-256 (2)\" or \"RSA/SHA-256 (8)\". Pull out the\n// code; tolerate a bare number (key_tag) or numeric string too.\nfunction parseCode(value: string | number | undefined): number {\n if (typeof value === 'number') return value;\n const paren = /\\((\\d+)\\)/.exec(value ?? '');\n if (paren) return Number(paren[1]);\n const n = Number(value);\n return Number.isFinite(n) ? n : 0;\n}\n","import type {\n ConfigField,\n ConnectionResult,\n Contact,\n ContactSet,\n DnsRecord,\n DnssecStatus,\n Domain,\n DomainAvailability,\n DomainForward,\n DomainForwardType,\n DsRecord,\n EmailForward,\n ListDomainsOptions,\n OperationResult,\n RegisterDomainInput,\n RegistrarOptions,\n RequestOptions,\n TldPricing,\n TransferDomainInput,\n} from '../types';\nimport { createDomain, filterDomains, settableForwards } from '../utils';\nimport { toRegistrarError } from '../errors';\nimport { BaseRegistrar, selectBaseUrl } from '../registrar';\nimport { Feature, type RegistrarFeature } from '../features';\nimport type { RegistrarCredentials } from '../types';\n\n// A contact as returned under `GET /v5/domain/domains/{fqdn}/contacts` (and\n// nested in the domain-detail `contacts` object). Gandi names fields `given`/\n// `family`/`streetaddr`/`zip`; privacy is `data_obfuscated` on the detail\n// endpoint (older responses carried `extra_parameters.whois_privacy`).\ninterface GandiContact {\n given?: string;\n family?: string;\n orgname?: string;\n email?: string;\n phone?: string;\n fax?: string;\n streetaddr?: string;\n city?: string;\n state?: string;\n zip?: string;\n country?: string;\n data_obfuscated?: boolean;\n extra_parameters?: { whois_privacy?: string };\n}\n\n// the four contact roles Gandi exposes; `bill` maps to our `billing`\ninterface GandiContacts {\n owner?: GandiContact;\n admin?: GandiContact;\n tech?: GandiContact;\n bill?: GandiContact;\n}\n\n// Shape of a domain in `GET /v5/domain/domains` (list) and\n// `GET /v5/domain/domains/{fqdn}` (detail). `status` is an array of EPP\n// statuses; `autorenew` may be a bare boolean or an object; nameservers arrive\n// as `nameserver.hosts` on the list endpoint and as a top-level `nameservers`\n// array on the detail endpoint.\ninterface GandiDomain {\n fqdn: string;\n status?: string | string[];\n dates?: {\n created_at?: string;\n registry_created_at?: string;\n registry_ends_at?: string;\n updated_at?: string;\n };\n autorenew?: boolean | { enabled?: boolean };\n contacts?: GandiContacts;\n nameserver?: { current?: string; hosts?: string[] };\n nameservers?: string[];\n}\n\n// one record set from `GET /v5/livedns/domains/{fqdn}/records`; a set can hold\n// multiple values (e.g. several A records for one name), flattened on read.\ninterface GandiRecord {\n rrset_type?: string;\n rrset_name?: string;\n rrset_ttl?: number;\n rrset_values?: string[];\n}\n\n// a single price entry within a pricing/check product\ninterface GandiPrice {\n min_duration?: number;\n max_duration?: number;\n duration_unit?: string;\n price_before_taxes?: number;\n price_after_taxes?: number;\n type?: string;\n discount?: boolean;\n}\n\n// a product in `GET /v5/billing/price/domain` and `GET /v5/domain/check`. Each product\n// carries the `process` (create/renew/transfer) its `prices` apply to; `check`\n// products also carry availability `status`.\ninterface GandiProduct {\n name?: string;\n status?: string;\n process?: string;\n prices?: GandiPrice[];\n}\n\n// envelope shared by the pricing and check endpoints\ninterface GandiPricingResponse {\n currency?: string;\n grid?: string;\n products?: GandiProduct[];\n}\n\n// a DNSSEC key from GET /v5/livedns/domains/{fqdn}/keys. `ds` is the full DS\n// RR line (\"<owner> <ttl> IN DS <keyTag> <algorithm> <digestType> <digest>\").\ninterface GandiKey {\n id?: string;\n deleted?: boolean;\n flags?: number;\n algorithm?: number;\n ds?: string;\n}\n\n// an email forward from GET /v5/email/forwards/{domain}: `source` is the local\n// part (mailbox), `destinations` the full addresses it forwards to.\ninterface GandiForward {\n source?: string;\n destinations?: string[];\n}\n\n// a web-forwarding (URL redirect) entry from GET\n// /v5/domain/domains/{fqdn}/webredirs. `host` is the full FQDN of the source\n// subdomain; `type` is Gandi's redirect kind (http301/http302/cloak).\ninterface GandiWebredir {\n host?: string;\n type?: string;\n url?: string;\n protocol?: string;\n}\n\n// map our DomainForwardType to Gandi's webredir `type`, and back.\nconst GANDI_FORWARD_TYPE: Record<'temporary' | 'permanent', string> = {\n permanent: 'http301',\n temporary: 'http302',\n};\nconst GANDI_TYPE_TO_FORWARD: Record<string, DomainForwardType> = {\n http301: 'permanent',\n http302: 'temporary',\n cloak: 'masked', // read-only; setDomainForwarding rejects it\n};\n\n/**\n * Gandi.net Registrar\n * API docs: https://api.gandi.net/docs/\n *\n * Credentials: generate a Personal Access Token (PAT) under Account Settings >\n * Security. The token must have domain management permissions. It is sent as a\n * `Bearer` Authorization header. (Gandi's legacy `Apikey` scheme is deprecated\n * and now returns 403.)\n */\nexport class GandiRegistrar extends BaseRegistrar {\n readonly name = 'gandi';\n\n static readonly displayName = 'Gandi.net';\n static readonly helpText =\n 'Generate a Personal Access Token (PAT) in your Gandi account under Account ' +\n 'Settings > Security. The token needs permission to manage domains. (Gandi has ' +\n 'deprecated the legacy API Key; use a PAT.)';\n static readonly configFields: ConfigField[] = [\n { name: 'apiKey', label: 'Personal Access Token', type: 'password', required: true },\n ];\n // Gandi's v5 API offers a sandbox at api.sandbox.gandi.net (separate account)\n static readonly supportsSandbox = true;\n // On top of core: transfer-out auth code (`authinfo`), DNSSEC read/disable\n // (LiveDNS keys), email forwarding, and web/URL forwarding (webredirs;\n // per-subdomain, no apex). Note core `setPrivacy` disabling is a no-op for\n // individual (natural-person) registrants — Gandi keeps WHOIS obfuscation on\n // for GDPR regardless of the request.\n static readonly extendedFeatures: readonly RegistrarFeature[] = [\n Feature.GetAuthCode,\n Feature.GetDnssec,\n Feature.DisableDnssec,\n Feature.GetEmailForwarding,\n Feature.SetEmailForwarding,\n Feature.GetDomainForwarding,\n Feature.SetDomainForwarding,\n ];\n\n constructor(credentials: RegistrarCredentials, options?: RegistrarOptions) {\n super(\n credentials,\n {\n baseUrl: selectBaseUrl('Gandi', options?.environment, {\n production: 'https://api.gandi.net/v5',\n sandbox: 'https://api.sandbox.gandi.net/v5',\n }),\n headers: {\n 'Authorization': `Bearer ${credentials.apiKey}`,\n 'Content-Type': 'application/json',\n },\n },\n options\n );\n }\n\n override async testConnection(opts?: RequestOptions): Promise<ConnectionResult> {\n try {\n await this.http.request<GandiDomain[]>({ path: '/domain/domains', ...opts });\n return { success: true, message: 'Connection successful' };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n override async listDomains(opts?: ListDomainsOptions): Promise<Domain[]> {\n const { search, ...reqOpts } = opts ?? {};\n const domains: Domain[] = [];\n const perPage = 1000; // Gandi API maximum page size\n // Gandi's `fqdn` filter is server-side and supports wildcards, so a plain\n // substring search is wrapped in `*...*`.\n const term = search?.trim();\n const fqdn = term ? `*${term}*` : undefined;\n let page = 1;\n\n for (;;) {\n const list = await this.http.request<GandiDomain[]>({\n path: '/domain/domains',\n query: { per_page: perPage, page, ...(fqdn ? { fqdn } : {}) },\n ...reqOpts,\n });\n if (!list || list.length === 0) break;\n\n for (const d of list) domains.push(this.toDomain(d));\n\n if (list.length < perPage) break;\n page++;\n }\n return filterDomains(domains, search);\n }\n\n // map Gandi's list/detail domain shape into a normalized Domain, tolerating\n // the field variations documented on GandiDomain.\n private toDomain(d: GandiDomain): Domain {\n const statuses = Array.isArray(d.status) ? d.status : d.status ? [d.status] : [];\n const autoRenew =\n typeof d.autorenew === 'boolean' ? d.autorenew : (d.autorenew?.enabled ?? false);\n return createDomain({\n domainName: d.fqdn,\n registrar: this.name,\n status: statuses.join(','),\n createdDate: d.dates?.created_at ?? d.dates?.registry_created_at,\n expirationDate: d.dates?.registry_ends_at,\n renewalDate: d.dates?.updated_at,\n autoRenew,\n locked: statuses.some(s => /transferprohibited|locked/i.test(s)),\n privacy:\n d.contacts?.owner?.extra_parameters?.whois_privacy === 'enabled' ||\n d.contacts?.owner?.data_obfuscated === true,\n nameservers: d.nameserver?.hosts ?? d.nameservers ?? [],\n });\n }\n\n // fetch a single domain's details (dates, status, nameservers, privacy) via\n // `GET /v5/domain/domains/{fqdn}` and normalize through the shared toDomain.\n override async getDomain(domainName: string, opts?: RequestOptions): Promise<Domain> {\n const d = await this.http.request<GandiDomain>({\n path: `/domain/domains/${domainName}`,\n ...opts,\n });\n return this.toDomain({ ...d, fqdn: d.fqdn ?? domainName });\n }\n\n // read the nameservers set on a domain. The dedicated endpoint returns a bare\n // JSON array of hostname strings.\n override async getNameservers(domainName: string, opts?: RequestOptions): Promise<string[]> {\n const res = await this.http.request<string[]>({\n path: `/domain/domains/${domainName}/nameservers`,\n ...opts,\n });\n return Array.isArray(res) ? res.map(String) : [];\n }\n\n // read the registrant/admin/tech/billing contacts. Gandi keys these\n // owner/admin/tech/bill; `owner` is the registrant and `bill` the billing role.\n override async getContacts(domainName: string, opts?: RequestOptions): Promise<ContactSet> {\n const res = await this.http.request<GandiContacts>({\n path: `/domain/domains/${domainName}/contacts`,\n ...opts,\n });\n return {\n registrant: fromGandiContact(res.owner),\n admin: fromGandiContact(res.admin),\n tech: fromGandiContact(res.tech),\n billing: fromGandiContact(res.bill),\n };\n }\n\n /**\n * Read DNS records from LiveDNS (`GET /v5/livedns/domains/{fqdn}/records`).\n * A LiveDNS record set carries an array of values, so each value is emitted as\n * its own normalized DnsRecord. MX values are \"priority target\" and SRV values\n * \"priority weight port target\"; those numeric prefixes are split into the\n * dedicated DnsRecord fields, leaving `value` as the target.\n */\n override async getDnsRecords(domainName: string, opts?: RequestOptions): Promise<DnsRecord[]> {\n const rrsets = await this.http.request<GandiRecord[]>({\n path: `/livedns/domains/${domainName}/records`,\n ...opts,\n });\n const records: DnsRecord[] = [];\n for (const rr of rrsets ?? []) {\n const type = (rr.rrset_type ?? '').toUpperCase();\n const name = rr.rrset_name ?? '';\n for (const value of rr.rrset_values ?? []) {\n const record: DnsRecord = { type, name, value };\n if (rr.rrset_ttl != null) record.ttl = rr.rrset_ttl;\n if (type === 'MX') {\n const [priority, ...rest] = value.split(/\\s+/);\n const p = Number(priority);\n if (Number.isFinite(p) && rest.length > 0) {\n record.priority = p;\n record.value = rest.join(' ');\n }\n } else if (type === 'SRV') {\n const parts = value.split(/\\s+/);\n if (parts.length === 4) {\n record.priority = Number(parts[0]);\n record.weight = Number(parts[1]);\n record.port = Number(parts[2]);\n record.value = parts[3];\n }\n }\n records.push(record);\n }\n }\n return records;\n }\n\n /**\n * Per-TLD pricing via `GET /v5/billing/price/domain`. `processes` is a repeatable\n * query param and each returned product is tagged with the `process` its prices\n * cover, so a single call fetches register/renew/transfer. A bare TLD is turned\n * into a sample fqdn (`example.<tld>`) since the endpoint keys off a domain\n * name. Gandi returns prices in major currency units already.\n */\n override async getPricing(tldOrDomain: string, opts?: RequestOptions): Promise<TldPricing> {\n const tld = (\n tldOrDomain.includes('.') ? tldOrDomain.slice(tldOrDomain.indexOf('.') + 1) : tldOrDomain\n ).toLowerCase();\n const name = tldOrDomain.includes('.') ? tldOrDomain : `example.${tld}`;\n\n // `processes` must be repeated (create/renew/transfer); the query map can't\n // hold a repeated key, so the params are encoded directly into the path.\n const params = new URLSearchParams({ name });\n for (const process of ['create', 'renew', 'transfer']) {\n params.append('processes', process);\n }\n\n const resp = await this.http.request<GandiPricingResponse>({\n path: `/billing/price/domain?${params.toString()}`,\n ...opts,\n });\n const products = resp.products ?? [];\n const priceFor = (process: string): number | undefined =>\n pickPrice(products.find(p => p.process === process)?.prices?.[0]);\n\n return {\n tld,\n currency: resp.currency ?? 'USD',\n registration: priceFor('create'),\n renewal: priceFor('renew'),\n transfer: priceFor('transfer'),\n };\n }\n\n /**\n * Availability via `GET /v5/domain/check`, which checks a single name per call,\n * so multiple names are looped. The default `create` product carries the\n * availability `status` and registration price; a status of `available*` means\n * registrable, and a `premium` price type (or `*premium` status) flags premium\n * names.\n */\n override async checkAvailability(\n domainNames: string[],\n opts?: RequestOptions\n ): Promise<DomainAvailability[]> {\n const results: DomainAvailability[] = [];\n for (const domainName of domainNames) {\n const resp = await this.http.request<GandiPricingResponse>({\n path: '/domain/check',\n query: { name: domainName },\n ...opts,\n });\n const products = resp.products ?? [];\n const product = products.find(p => p.process === 'create') ?? products[0];\n const status = product?.status ?? '';\n const price = product?.prices?.[0];\n const result: DomainAvailability = {\n domainName: product?.name ?? domainName,\n available: status.startsWith('available'),\n premium: status.includes('premium') || price?.type === 'premium',\n };\n const amount = pickPrice(price);\n if (amount != null) result.price = amount;\n if (resp.currency) result.currency = resp.currency;\n if (price?.duration_unit === 'y' && price.min_duration != null) {\n result.period = price.min_duration;\n }\n results.push(result);\n }\n return results;\n }\n\n override async renewDomain(\n domainName: string,\n years = 1,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.mutate(\n { method: 'POST', path: `/domain/domains/${domainName}/renew`, body: { duration: years } },\n 'Domain renewed successfully',\n opts\n );\n }\n\n override async updateNameservers(\n domainName: string,\n nameservers: string[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n if (nameservers.length < 1) {\n throw new Error('At least 1 nameserver is required');\n }\n return this.mutate(\n { method: 'PUT', path: `/domain/domains/${domainName}/nameservers`, body: { nameservers } },\n 'Nameservers updated successfully',\n opts\n );\n }\n\n // The transfer lock lives on the domain's `/status` subresource and is toggled\n // with the `clientTransferProhibited` EPP flag (a boolean) — not by PATCHing a\n // `status` string on the domain object, which 404s. The change is asynchronous\n // (Gandi returns 202 \"status change in progress\"), so a read-back right after\n // may still show the old state briefly.\n override async lockDomain(domainName: string, opts?: RequestOptions): Promise<OperationResult> {\n return this.mutate(\n {\n method: 'PATCH',\n path: `/domain/domains/${domainName}/status`,\n body: { clientTransferProhibited: true },\n },\n 'Domain locked successfully',\n opts\n );\n }\n\n override async unlockDomain(domainName: string, opts?: RequestOptions): Promise<OperationResult> {\n return this.mutate(\n {\n method: 'PATCH',\n path: `/domain/domains/${domainName}/status`,\n body: { clientTransferProhibited: false },\n },\n 'Domain unlocked successfully',\n opts\n );\n }\n\n // --- extended capabilities ---------------------------------------------\n\n // The transfer authorization (EPP) code is the `authinfo` field on the\n // domain-details endpoint (present for domains the account manages).\n override async getAuthCode(domainName: string, opts?: RequestOptions): Promise<string> {\n const d = await this.http.request<{ authinfo?: string }>({\n path: `/domain/domains/${domainName}`,\n ...opts,\n });\n return d.authinfo ?? '';\n }\n\n /**\n * DNSSEC status via Gandi LiveDNS keys (GET /livedns/domains/{fqdn}/keys). A\n * non-deleted key means DNSSEC is enabled; each key's `ds` field is the full DS\n * RR line, which we parse into keyTag/algorithm/digestType/digest.\n */\n override async getDnssec(domainName: string, opts?: RequestOptions): Promise<DnssecStatus> {\n const keys = await this.http.request<GandiKey[]>({\n path: `/livedns/domains/${domainName}/keys`,\n ...opts,\n });\n const active = (keys ?? []).filter(k => !k.deleted);\n const dsRecords = active.map(k => parseDsRecord(k.ds)).filter((d): d is DsRecord => d !== null);\n return { enabled: active.length > 0, dsRecords };\n }\n\n /**\n * Disable DNSSEC by deleting each LiveDNS key (Gandi has no single toggle —\n * removing the keys removes the DS records at the registry).\n */\n override async disableDnssec(\n domainName: string,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n try {\n const keys = await this.http.request<GandiKey[]>({\n path: `/livedns/domains/${domainName}/keys`,\n ...opts,\n });\n for (const k of keys ?? []) {\n if (k.deleted || !k.id) continue;\n await this.http.request({\n method: 'DELETE',\n path: `/livedns/domains/${domainName}/keys/${encodeURIComponent(k.id)}`,\n ...opts,\n });\n }\n return { success: true, message: 'DNSSEC disabled successfully' };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n /**\n * Read email forwarding via GET /email/forwards/{domain}. A Gandi forward has a\n * `source` (local part) and multiple `destinations`; we expand each destination\n * into its own {alias, forwardTo} row.\n */\n override async getEmailForwarding(\n domainName: string,\n opts?: RequestOptions\n ): Promise<EmailForward[]> {\n const forwards = await this.http.request<GandiForward[]>({\n path: `/email/forwards/${domainName}`,\n ...opts,\n });\n const out: EmailForward[] = [];\n for (const f of forwards ?? []) {\n for (const dest of f.destinations ?? []) {\n if (f.source && dest) out.push({ alias: f.source, forwardTo: dest });\n }\n }\n return out;\n }\n\n /**\n * Replace email forwarding (full replace; empty clears). Gandi has no bulk\n * endpoint, so diff against the current forwards: group desired rows by source,\n * DELETE sources no longer wanted, PUT changed sources, POST new ones.\n */\n override async setEmailForwarding(\n domainName: string,\n forwards: EmailForward[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n try {\n const desired = new Map<string, string[]>();\n for (const f of forwards) {\n const list = desired.get(f.alias) ?? [];\n list.push(f.forwardTo);\n desired.set(f.alias, list);\n }\n const current = await this.http.request<GandiForward[]>({\n path: `/email/forwards/${domainName}`,\n ...opts,\n });\n const currentSources = new Set(\n (current ?? []).map(f => f.source).filter((s): s is string => !!s)\n );\n\n for (const source of currentSources) {\n if (!desired.has(source)) {\n await this.http.request({\n method: 'DELETE',\n path: `/email/forwards/${domainName}/${encodeURIComponent(source)}`,\n ...opts,\n });\n }\n }\n for (const [source, destinations] of desired) {\n if (currentSources.has(source)) {\n await this.http.request({\n method: 'PUT',\n path: `/email/forwards/${domainName}/${encodeURIComponent(source)}`,\n body: { destinations },\n ...opts,\n });\n } else {\n await this.http.request({\n method: 'POST',\n path: `/email/forwards/${domainName}`,\n body: { source, destinations },\n ...opts,\n });\n }\n }\n return { success: true, message: 'Email forwarding updated successfully' };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n /**\n * Read web/URL forwarding via GET /domain/domains/{fqdn}/webredirs. Gandi keys\n * each redirect by the full FQDN of the source subdomain; we normalize that back\n * to a host relative to the apex (e.g. `shop.example.com` -> `shop`).\n */\n override async getDomainForwarding(\n domainName: string,\n opts?: RequestOptions\n ): Promise<DomainForward[]> {\n const redirs = await this.http.request<GandiWebredir[]>({\n path: `/domain/domains/${domainName}/webredirs`,\n ...opts,\n });\n return (redirs ?? []).map(r => ({\n host: gandiFqdnToHost(r.host ?? domainName, domainName),\n url: r.url ?? '',\n type: GANDI_TYPE_TO_FORWARD[(r.type ?? '').toLowerCase()] ?? 'permanent',\n }));\n }\n\n /**\n * Replace web/URL forwarding (full replace; empty clears). Gandi's webredirs\n * endpoint has no update — only create (POST) and delete (DELETE by FQDN) — so\n * this diffs against the current set: delete entries that are gone or changed,\n * then create the desired ones that aren't already present identically.\n *\n * Gandi only supports forwarding a subdomain, not the apex; an apex host (\"@\")\n * throws rather than silently failing with a 500 from the API.\n */\n override async setDomainForwarding(\n domainName: string,\n forwards: DomainForward[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n try {\n const settable = settableForwards(forwards); // reject masked before any write\n for (const f of settable) {\n if (!f.host || f.host === '@') {\n throw new Error(\n `${this.name}: web forwarding requires a subdomain host; Gandi cannot forward the apex (\"@\")`\n );\n }\n }\n const current = await this.getDomainForwarding(domainName, opts);\n const same = (a: DomainForward, b: DomainForward): boolean =>\n a.host === b.host && a.url === b.url && a.type === b.type;\n\n // delete current entries that are no longer wanted, or whose url/type changed\n for (const existing of current) {\n if (!settable.some(f => same(f, existing))) {\n await this.http.request({\n method: 'DELETE',\n path: `/domain/domains/${domainName}/webredirs/${gandiHostToFqdn(existing.host, domainName)}`,\n ...opts,\n });\n }\n }\n // create desired entries that aren't already present identically\n for (const f of settable) {\n if (!current.some(c => same(c, f))) {\n await this.http.request({\n method: 'POST',\n path: `/domain/domains/${domainName}/webredirs`,\n // `protocol` is intentionally omitted so Gandi applies its default\n // (http). Requesting `https` makes Gandi provision a Let's Encrypt\n // certificate for the source host, which our normalized model doesn't\n // express (and which the sandbox can't do — it 500s).\n body: {\n host: gandiHostToFqdn(f.host, domainName),\n type: GANDI_FORWARD_TYPE[f.type],\n url: f.url,\n },\n ...opts,\n });\n }\n }\n return { success: true, message: 'Domain forwarding updated successfully' };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n override async setAutoRenew(\n domainName: string,\n enabled: boolean,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n try {\n await this.http.request({\n method: 'PATCH',\n path: `/domain/domains/${domainName}/autorenew`,\n body: { enabled },\n ...opts,\n });\n return {\n success: true,\n message: `Auto-renew ${enabled ? 'enabled' : 'disabled'} successfully`,\n };\n } catch (error) {\n // Disabling auto-renew on a domain that never had an autorenew record\n // returns 400 \"This product has no autorenew record\". That state already\n // means auto-renew is off, so treat it as idempotent success.\n const message = toRegistrarError(error).message;\n if (!enabled && /no autorenew record/i.test(message)) {\n return { success: true, message: 'Auto-renew disabled successfully' };\n }\n return { success: false, message };\n }\n }\n\n /**\n * WHOIS privacy on Gandi is the per-contact `data_obfuscated` flag, toggled by\n * PATCHing the domain's owner contact. Enabling works; disabling is accepted\n * (HTTP 202) but is a **no-op for individual (natural-person) registrants** —\n * Gandi keeps their contact obfuscated in WHOIS for GDPR regardless. The\n * request is well-formed, so this reports the registrar's acceptance; whether\n * the state actually changes is governed by Gandi's policy for the contact\n * type. (Verified live against the sandbox.)\n */\n override async setPrivacy(\n domainName: string,\n enabled: boolean,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.mutate(\n {\n method: 'PATCH',\n path: `/domain/domains/${domainName}/contacts`,\n body: { owner: { data_obfuscated: enabled } },\n },\n `WHOIS privacy ${enabled ? 'enabled' : 'disabled'} successfully`,\n opts\n );\n }\n\n /**\n * Replaces the entire zone via LiveDNS (`PUT /livedns/domains/{d}/records`),\n * which takes `items` as grouped rrsets. Flat records are regrouped by\n * (name, type); MX/SRV values are re-encoded with their numeric prefixes — the\n * exact inverse of `getDnsRecords`, so a get→set round-trip is lossless.\n */\n override async setDnsRecords(\n domainName: string,\n records: DnsRecord[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.mutate(\n {\n method: 'PUT',\n path: `/livedns/domains/${domainName}/records`,\n body: { items: toGandiRrsets(records) },\n },\n 'DNS records updated successfully',\n opts\n );\n }\n\n /**\n * Updates contact roles by PATCHing the domain's contacts. Only supplied roles\n * are sent; `registrant` maps to Gandi's `owner`, `billing` to `bill`. A\n * registrant change can trigger registry verification — not exercised live.\n */\n override async updateContacts(\n domainName: string,\n contacts: ContactSet,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const body: GandiContacts = {};\n if (contacts.registrant) body.owner = toGandiContact(contacts.registrant);\n if (contacts.admin) body.admin = toGandiContact(contacts.admin);\n if (contacts.tech) body.tech = toGandiContact(contacts.tech);\n if (contacts.billing) body.bill = toGandiContact(contacts.billing);\n if (Object.keys(body).length === 0) {\n throw new Error(`${this.name}: updateContacts requires at least one contact role`);\n }\n return this.mutate(\n { method: 'PATCH', path: `/domain/domains/${domainName}/contacts`, body },\n 'Contacts updated successfully',\n opts\n );\n }\n\n /**\n * Registers a domain via `POST /domain/domains`. Requires a registrant (Gandi's\n * `owner`); other roles fall back to it. `data_obfuscated` carries the privacy\n * choice. Spends real money; not exercised against a live account.\n */\n override async registerDomain(\n domainName: string,\n input: RegisterDomainInput,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const registrant = input.contacts.registrant;\n if (!registrant) {\n throw new Error(`${this.name}: registration requires at least a registrant contact`);\n }\n const owner = toGandiContact(registrant);\n if (input.privacy != null) owner.data_obfuscated = input.privacy;\n const body: Record<string, unknown> = {\n fqdn: domainName,\n duration: input.years ?? 1,\n owner,\n };\n if (input.contacts.admin) body.admin = toGandiContact(input.contacts.admin);\n if (input.contacts.tech) body.tech = toGandiContact(input.contacts.tech);\n if (input.contacts.billing) body.bill = toGandiContact(input.contacts.billing);\n if (input.nameservers && input.nameservers.length > 0) body.nameservers = input.nameservers;\n return this.mutate(\n { method: 'POST', path: '/domain/domains', body },\n `Domain ${domainName} registered successfully`,\n opts\n );\n }\n\n /**\n * Transfers a domain in via `POST /domain/transferin/{d}` with the EPP auth code\n * (`authinfo`) and the new owner. Spends real money; not exercised against a\n * live account.\n */\n override async transferIn(\n domainName: string,\n input: TransferDomainInput,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const registrant = input.contacts?.registrant;\n if (!registrant) {\n throw new Error(`${this.name}: transfer requires a registrant contact (Gandi's owner)`);\n }\n const owner = toGandiContact(registrant);\n if (input.privacy != null) owner.data_obfuscated = input.privacy;\n const body: Record<string, unknown> = {\n fqdn: domainName,\n authinfo: input.authCode,\n owner,\n };\n if (input.years != null) body.duration = input.years;\n return this.mutate(\n { method: 'POST', path: `/domain/transferin/${domainName}`, body },\n `Domain ${domainName} transfer requested successfully`,\n opts\n );\n }\n\n private async mutate(\n req: { method: string; path: string; body?: unknown },\n successMessage: string,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n try {\n await this.http.request({ ...req, ...opts });\n return { success: true, message: successMessage };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n}\n\n// map a Gandi contact into the normalized Contact shape. Gandi has no distinct\n// second address line, so `address2` is left undefined.\n// map the normalized Contact to Gandi's contact shape (given/family/streetaddr/…).\n// `type` is Gandi's contact type: 1 (company) when an organization is set, else\n// 0 (individual).\nfunction toGandiContact(c: Contact): GandiContact & { type: number } {\n const contact: GandiContact & { type: number } = {\n given: c.firstName,\n family: c.lastName,\n email: c.email,\n phone: c.phone,\n streetaddr: c.address1,\n city: c.city,\n zip: c.postalCode,\n country: c.country,\n type: c.organization ? 1 : 0,\n };\n if (c.organization) contact.orgname = c.organization;\n if (c.fax) contact.fax = c.fax;\n if (c.state) contact.state = toGandiState(c.state, c.country);\n return contact;\n}\n\n// Gandi wants the ISO 3166-2 subdivision code for `state` (e.g. `US-CA`), and\n// rejects a bare 2-letter code as \"shorter than minimum length 4\". The rest of\n// the library stores just the subdivision (`CA`, `ENG`), so prefix it with the\n// country to form the ISO 3166-2 code. A value that already contains a `-`\n// (already `US-CA`) is left as-is.\nfunction toGandiState(state: string, country: string): string {\n return country && !state.includes('-') ? `${country}-${state}` : state;\n}\n\n// regroup flat DnsRecords into Gandi LiveDNS rrsets (one per name+type, values\n// collected). MX/SRV values are re-encoded with their numeric prefixes — the\n// exact inverse of getDnsRecords — so a get→set round-trip reproduces the zone.\nfunction toGandiRrsets(records: DnsRecord[]): GandiRecord[] {\n const groups = new Map<string, GandiRecord>();\n for (const r of records) {\n const type = r.type.toUpperCase();\n const name = r.name || '@';\n let value = r.value;\n if (type === 'MX' && r.priority != null) {\n value = `${r.priority} ${r.value}`;\n } else if (type === 'SRV') {\n value = `${r.priority ?? 0} ${r.weight ?? 0} ${r.port ?? 0} ${r.value}`;\n }\n const key = `${name} ${type}`;\n let rrset = groups.get(key);\n if (!rrset) {\n rrset = { rrset_name: name, rrset_type: type, rrset_values: [] };\n groups.set(key, rrset);\n }\n if (rrset.rrset_ttl == null && r.ttl != null) rrset.rrset_ttl = r.ttl;\n rrset.rrset_values!.push(value);\n }\n return [...groups.values()];\n}\n\n// Gandi webredirs are keyed by the full FQDN of the source subdomain, while our\n// DomainForward.host is relative to the apex. These convert between the two.\nfunction gandiHostToFqdn(host: string, domain: string): string {\n return !host || host === '@' ? domain : `${host}.${domain}`;\n}\nfunction gandiFqdnToHost(fqdn: string, domain: string): string {\n if (fqdn === domain) return '@';\n const suffix = `.${domain}`;\n return fqdn.endsWith(suffix) ? fqdn.slice(0, -suffix.length) : fqdn;\n}\n\nfunction fromGandiContact(c: GandiContact | undefined): Contact | undefined {\n if (!c) return undefined;\n return {\n firstName: c.given ?? '',\n lastName: c.family ?? '',\n organization: c.orgname ? String(c.orgname) : undefined,\n email: c.email ?? '',\n phone: c.phone ?? '',\n fax: c.fax ? String(c.fax) : undefined,\n address1: c.streetaddr ?? '',\n city: c.city ?? '',\n state: c.state ? String(c.state) : undefined,\n postalCode: c.zip ?? '',\n country: c.country ?? '',\n };\n}\n\n// pick a numeric price from a Gandi price entry, preferring the tax-inclusive\n// amount. Gandi reports prices in major currency units (e.g. 15.5), so no\n// cents-to-dollars conversion is needed.\nfunction pickPrice(price: GandiPrice | undefined): number | undefined {\n if (!price) return undefined;\n const value = price.price_after_taxes ?? price.price_before_taxes;\n return typeof value === 'number' && Number.isFinite(value) ? value : undefined;\n}\n\n// parse a DS resource-record line into its components. Gandi's `ds` field looks\n// like \"example.com. 3600 IN DS 50651 13 2 01CC01EE...\". Returns null if it\n// doesn't contain a DS record (e.g. a key with no published DS).\nfunction parseDsRecord(ds: string | undefined): DsRecord | null {\n if (!ds) return null;\n const tokens = ds.trim().split(/\\s+/);\n const i = tokens.findIndex(t => t.toUpperCase() === 'DS');\n const parts = i >= 0 ? tokens.slice(i + 1) : tokens;\n if (parts.length < 4) return null;\n const [keyTag, algorithm, digestType, ...digest] = parts;\n return {\n keyTag: Number(keyTag) || 0,\n algorithm: Number(algorithm) || 0,\n digestType: Number(digestType) || 0,\n digest: digest.join(''),\n };\n}\n","import type {\n ConfigField,\n ConnectionResult,\n Contact,\n ContactSet,\n DnsRecord,\n Domain,\n DomainAvailability,\n DomainForward,\n DomainForwardType,\n ListDomainsOptions,\n OperationResult,\n RegisterDomainInput,\n RegistrationConsent,\n RegistrarOptions,\n RequestOptions,\n TldPricing,\n TransferDomainInput,\n} from '../types';\nimport { createDomain, filterDomains, settableForwards } from '../utils';\nimport {\n ConfigurationError,\n ConsentRequiredError,\n NotFoundError,\n NotImplementedError,\n toRegistrarError,\n} from '../errors';\nimport { BaseRegistrar, selectBaseUrl } from '../registrar';\nimport { Feature, type RegistrarFeature } from '../features';\nimport type { RegistrarCredentials } from '../types';\n\n// a mailing address as GoDaddy models it\ninterface GoDaddyAddress {\n address1?: string;\n address2?: string;\n city?: string;\n state?: string;\n postalCode?: string;\n country?: string;\n}\n\n// a contact as GoDaddy models it (registrant / admin / tech / billing)\ninterface GoDaddyContact {\n nameFirst?: string;\n nameLast?: string;\n organization?: string;\n email?: string;\n phone?: string;\n fax?: string;\n addressMailing?: GoDaddyAddress;\n}\n\ninterface GoDaddyDomain {\n domain: string;\n status?: string;\n createdAt?: string;\n expires?: string;\n renewDeadline?: string;\n renewAuto?: boolean;\n locked?: boolean;\n privacy?: boolean;\n nameServers?: string[];\n contactRegistrant?: GoDaddyContact;\n contactAdmin?: GoDaddyContact;\n contactTech?: GoDaddyContact;\n contactBilling?: GoDaddyContact;\n authCode?: string;\n}\n\n// one entry from POST /v1/domains/available; `price` is in micro-units of `currency`\ninterface GoDaddyAvailability {\n domain: string;\n available?: boolean;\n price?: number;\n currency?: string;\n period?: number;\n}\n\ninterface GoDaddyAvailabilityResponse {\n domains?: GoDaddyAvailability[];\n}\n\n// a DNS record as GoDaddy models it\ninterface GoDaddyRecord {\n type: string;\n name: string;\n data: string;\n ttl?: number;\n priority?: number;\n weight?: number;\n port?: number;\n}\n\n// a legal agreement GoDaddy requires consent to before registering a TLD\ninterface GoDaddyAgreement {\n agreementKey: string;\n title?: string;\n url?: string;\n}\n\n// GoDaddy models forwarding as a per-fqdn resource under the v2 customer-scoped\n// route /v2/customers/{customerId}/domains/forwards/{fqdn}. Note the asymmetry\n// between the write and read enums: a write takes REDIRECT_PERMANENT (301) /\n// REDIRECT_TEMPORARY (302) / MASKED (frame), but a read returns the *_REDIRECT\n// spelling (PERMANENT_REDIRECT / TEMPORARY_REDIRECT). `mask` is only meaningful\n// for MASKED. Verified live 2026-08-29.\ninterface GoDaddyForward {\n fqdn?: string;\n type?: string;\n url?: string;\n mask?: { title?: string; description?: string; keywords?: string };\n}\n\n// normalized DomainForwardType → the token the v2 write endpoint expects\nconst GD_FORWARD_TYPE: Record<'temporary' | 'permanent', string> = {\n permanent: 'REDIRECT_PERMANENT',\n temporary: 'REDIRECT_TEMPORARY',\n};\n// every token a v2 read might return → normalized DomainForwardType. Both the\n// write spelling (REDIRECT_*) and the read spelling (*_REDIRECT) are accepted so\n// the map is robust to either surface.\nconst GD_TYPE_TO_FORWARD: Record<string, DomainForwardType> = {\n REDIRECT_PERMANENT: 'permanent',\n REDIRECT_TEMPORARY: 'temporary',\n PERMANENT_REDIRECT: 'permanent',\n TEMPORARY_REDIRECT: 'temporary',\n MASKED: 'masked', // read-only; setDomainForwarding rejects it\n};\n\n// GoDaddy customerId is a UUID; a raw shopper/account number is not.\nconst UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\n// GoDaddy reports availability prices in micro-units (1,000,000 = 1 unit of currency)\nconst PRICE_MICRO_UNITS = 1_000_000;\n\n// --- v3 API shapes ---------------------------------------------------------\n// The v3 \"Domain Lifecycle Management\" API models money, domains, DNS, and\n// registration differently from v1. These interfaces cover only the fields we\n// read/write.\n\n// v3 \"Simple Money\": `value` is an integer in the currency's minor units\n// (cents for USD/EUR, whole units for zero-decimal currencies like JPY).\ninterface GdV3Money {\n currencyCode?: string;\n value?: number;\n}\n\ninterface GdV3TermPrice {\n period?: number;\n price?: GdV3Money;\n renewalPrice?: GdV3Money;\n}\n\ninterface GdV3Availability {\n domain: string;\n available?: boolean;\n prices?: GdV3TermPrice[];\n inventory?: string; // e.g. \"STANDARD\" | \"PREMIUM\"\n}\n\ninterface GdV3Domain {\n domain: string;\n status?: string;\n createdAt?: string;\n updatedAt?: string;\n expiresAt?: string;\n renewBy?: string;\n autoRenew?: boolean;\n privacy?: boolean;\n transferLock?: boolean;\n nameServers?: string[];\n}\n\ninterface GdV3Link {\n href: string;\n rel?: string;\n}\n\ninterface GdV3DomainCollection {\n items?: GdV3Domain[];\n links?: GdV3Link[];\n}\n\n// one DNS record in a v3 zone; `recordId` is server-assigned and required to\n// update/delete an individual record (v3 has no bulk replace).\ninterface GdV3DnsRecord {\n recordId?: string;\n name: string;\n type: string;\n data: string;\n ttl?: number;\n priority?: number;\n weight?: number;\n port?: number;\n service?: string;\n protocol?: string;\n flag?: number;\n tag?: string;\n}\n\ninterface GdV3DnsRecordPage {\n items?: GdV3DnsRecord[];\n totalPages?: number;\n links?: GdV3Link[];\n}\n\ninterface GdV3Fee {\n type: string;\n fee?: GdV3Money;\n}\n\ninterface GdV3Agreement {\n agreementType: string;\n title?: string;\n}\n\ninterface GdV3Quote {\n quoteToken?: string;\n requiredAgreements?: GdV3Agreement[];\n fees?: GdV3Fee[];\n}\n\ninterface GdV3Registration {\n registrationId?: string;\n operationId?: string;\n status?: string;\n}\n\ninterface GdV3Operation {\n operationId?: string;\n status?: string;\n error?: { code?: string; message?: string };\n}\n\n/**\n * GoDaddy Registrar\n * API docs: https://developer.godaddy.com/en/docs/api-users/domains\n *\n * GoDaddy runs two concurrent API surfaces and this provider is a hybrid:\n *\n * - **v3** (Domain Lifecycle Management) — the modern surface, PAT/Bearer only.\n * Covers discovery (availability/suggestions), registration (quote → execute),\n * DNS records, nameservers, and list/get. It has **no** endpoints for the\n * post-registration management operations.\n * - **v1** — the legacy surface, accepts either a PAT or the deprecated\n * `sso-key` credential. It's the only place renew, transfer, auto-renew,\n * lock/unlock, privacy, and contact updates live, and the only surface OTE\n * (the test environment) exposes — OTE has no v3.\n *\n * Routing (`useV3`): v3 is used only in production **with a PAT**. With an\n * sso-key, or against OTE/sandbox (which has no v3), every call falls back to\n * v1. The management operations above are always v1 regardless. This keeps the\n * full contract working in OTE (all-v1) while preferring v3 in production.\n *\n * Credentials: supply `apiToken` (a Personal Access Token) for production/v3, or\n * `apiKey` + `apiSecret` (an OTE Key/Secret) for sandbox testing. The auth\n * header is chosen automatically — `Bearer` when a token is present, else\n * `sso-key`.\n *\n * `registerDomain` / `transferIn` spend real money. In v3, register uses the\n * quote-then-execute flow (price-locked via `quoteToken`, agreements\n * acknowledged in the consent block); v3 takes the contact profile from the\n * account identity and derives `agreedBy` server-side, so only `consent` (the\n * agreement acknowledgement) is required. In v1 (OTE), register uses the legacy\n * purchase flow and requires `consent.agreedBy` = the consenting party's IP.\n * Callers omitting `consent` entirely get a `ConsentRequiredError`.\n */\nexport class GoDaddyRegistrar extends BaseRegistrar {\n readonly name = 'godaddy';\n\n static readonly displayName = 'GoDaddy';\n static readonly helpText =\n 'Authenticate one of two ways. For production, create a Personal Access ' +\n 'Token (PAT) at https://developer.godaddy.com and pass it as `apiToken` — ' +\n 'this enables the modern v3 API. For sandbox testing, create OTE ' +\n '(test environment) keys and pass `apiKey` + `apiSecret` with ' +\n '{ environment: \"sandbox\" }; OTE only exposes the legacy v1 API. The ' +\n 'sso-key (API Key/Secret) scheme is deprecated by GoDaddy in 2026. ' +\n 'Domain forwarding uses the v2 customer-scoped API — set `customerId` to ' +\n 'your GoDaddy customer UUID, or to your numeric shopper/account ID (which ' +\n 'the client resolves to the UUID via an sso-key-authenticated lookup).';\n static readonly configFields: ConfigField[] = [\n { name: 'apiToken', label: 'API Token (PAT)', type: 'password', required: false },\n { name: 'apiKey', label: 'API Key', type: 'password', required: false },\n { name: 'apiSecret', label: 'API Secret', type: 'password', required: false },\n { name: 'customerId', label: 'Customer ID or Shopper ID', type: 'text', required: false },\n ];\n // GoDaddy's OTE (\"Operational Test Environment\") is its sandbox\n static readonly supportsSandbox = true;\n // Beyond core: domain forwarding and transfer-out auth code (the `authCode`\n // field on the v1 domain-detail response). Forwarding uses the v2\n // customer-scoped route /v2/customers/{customerId}/domains/forwards/{fqdn}\n // (the old v1 /v1/domains/forwards routes now 404); it requires `customerId`\n // to be configured — verified live 2026-08-29. DNSSEC has no dedicated\n // endpoint (DS records go through the generic DNS API), and there's no\n // glue-record, email, or push-webhook API.\n static readonly extendedFeatures: readonly RegistrarFeature[] = [\n Feature.GetAuthCode,\n Feature.GetDomainForwarding,\n Feature.SetDomainForwarding,\n ];\n\n // true → prefer the v3 API (production + PAT). false → all calls use v1\n // (sso-key auth, or OTE/sandbox where v3 does not exist).\n private readonly useV3: boolean;\n\n // memoized v2 customerId (UUID) resolution; see resolveCustomerId()\n private customerIdPromise?: Promise<string>;\n\n constructor(credentials: RegistrarCredentials, options?: RegistrarOptions) {\n const authHeader = GoDaddyRegistrar.authHeader(credentials);\n super(\n credentials,\n {\n baseUrl: selectBaseUrl('GoDaddy', options?.environment, {\n production: 'https://api.godaddy.com',\n sandbox: 'https://api.ote-godaddy.com',\n }),\n headers: {\n 'Authorization': authHeader,\n 'Accept': 'application/json',\n 'Content-Type': 'application/json',\n },\n },\n options\n );\n // v3 requires a PAT and is not deployed to OTE, so only use it in production\n // when a token was supplied.\n this.useV3 = options?.environment !== 'sandbox' && !!credentials.apiToken;\n }\n\n // Choose the Authorization header: Bearer PAT if a token is supplied,\n // otherwise the legacy sso-key. Missing credentials produce a header that the\n // API rejects at request time (matching the other providers), rather than\n // throwing at construction.\n private static authHeader(credentials: RegistrarCredentials): string {\n if (credentials.apiToken) return `Bearer ${credentials.apiToken}`;\n return `sso-key ${credentials.apiKey ?? ''}:${credentials.apiSecret ?? ''}`;\n }\n\n override async testConnection(opts?: RequestOptions): Promise<ConnectionResult> {\n try {\n if (this.useV3) {\n await this.http.request<GdV3DomainCollection>({\n path: '/v3/domains/domain-names',\n query: { pageSize: 1 },\n ...opts,\n });\n } else {\n await this.http.request<GoDaddyDomain[]>({ path: '/v1/domains', ...opts });\n }\n return { success: true, message: 'Connection successful' };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n override async listDomains(opts?: ListDomainsOptions): Promise<Domain[]> {\n const { search, ...reqOpts } = opts ?? {};\n const domains = this.useV3\n ? await this.listDomainsV3(reqOpts)\n : await this.listDomainsV1(reqOpts);\n return filterDomains(domains, search);\n }\n\n // v3: cursor-paginated collection; follow the rel=\"next\" HATEOAS link.\n private async listDomainsV3(reqOpts: RequestOptions): Promise<Domain[]> {\n const domains: Domain[] = [];\n let path = '/v3/domains/domain-names';\n let query: Record<string, string | number> | undefined = { pageSize: 200 }; // v3 max\n for (;;) {\n const res = await this.http.request<GdV3DomainCollection>({ path, query, ...reqOpts });\n for (const d of res.items ?? []) domains.push(this.toDomainV3(d));\n const next = (res.links ?? []).find(l => l.rel === 'next')?.href;\n if (!next || !res.items?.length) break;\n path = next; // absolute URL; HttpClient passes it through as-is\n query = undefined; // the next link already carries its cursor\n }\n return domains;\n }\n\n // v1: `marker`-paginated array (marker = last domain name seen).\n private async listDomainsV1(reqOpts: RequestOptions): Promise<Domain[]> {\n // status filters exclude expired domains: visible (active), renewable\n // (expiring soon), redemption (grace period). statusGroups repeats in the\n // query string, so it is embedded in the path directly. `includes=nameServers`\n // folds nameservers into this list call (they are otherwise omitted). Its\n // page-size param is literally named `limit`, whose max is 1000.\n const statusGroups = 'statusGroups=VISIBLE&statusGroups=RENEWABLE&statusGroups=REDEMPTION';\n const perPage = 1000; // GoDaddy's maximum page size\n const domains: Domain[] = [];\n let marker: string | undefined;\n for (;;) {\n const markerParam = marker ? `&marker=${encodeURIComponent(marker)}` : '';\n const res = await this.http.request<GoDaddyDomain[]>({\n path: `/v1/domains?limit=${perPage}&includes=nameServers&${statusGroups}${markerParam}`,\n ...reqOpts,\n });\n const list = res ?? [];\n for (const d of list) domains.push(this.toDomain(d));\n if (list.length < perPage) break;\n marker = list[list.length - 1]?.domain;\n if (!marker) break;\n }\n return domains;\n }\n\n override async getDomain(domainName: string, opts?: RequestOptions): Promise<Domain> {\n if (this.useV3) {\n const d = await this.http.request<GdV3Domain>({\n path: `/v3/domains/domain-names/${encodeURIComponent(domainName)}`,\n ...opts,\n });\n return this.toDomainV3(d);\n }\n const d = await this.http.request<GoDaddyDomain>({\n path: `/v1/domains/${encodeURIComponent(domainName)}`,\n ...opts,\n });\n return this.toDomain(d);\n }\n\n override async getNameservers(domainName: string, opts?: RequestOptions): Promise<string[]> {\n const domain = await this.getDomain(domainName, opts);\n return domain.nameservers;\n }\n\n override async checkAvailability(\n domainNames: string[],\n opts?: RequestOptions\n ): Promise<DomainAvailability[]> {\n if (this.useV3) {\n // v3 bulk check: POST { domains: [...] }; the response wraps results in\n // `items` and prices are multi-term.\n const res = await this.http.request<{ items?: GdV3Availability[] }>({\n method: 'POST',\n path: '/v3/domains/check-availability',\n body: { domains: domainNames },\n ...opts,\n });\n return (res.items ?? []).map(d => {\n const term = pickTerm(d.prices);\n return {\n domainName: d.domain,\n available: d.available ?? false,\n premium: isPremiumInventory(d.inventory),\n price: moneyToMajor(term?.price),\n currency: term?.price?.currencyCode,\n period: term?.period,\n };\n });\n }\n // v1 bulk check: POST an array of domains. checkType=FULL consults the\n // registry (slower but authoritative) rather than GoDaddy's cache.\n const res = await this.http.request<GoDaddyAvailabilityResponse>({\n method: 'POST',\n path: '/v1/domains/available?checkType=FULL',\n body: domainNames,\n ...opts,\n });\n return (res.domains ?? []).map(d => ({\n domainName: d.domain,\n available: d.available ?? false,\n price: d.price != null ? d.price / PRICE_MICRO_UNITS : undefined,\n currency: d.currency,\n period: d.period,\n }));\n }\n\n /**\n * GoDaddy has no standalone TLD-pricing endpoint — registration price is\n * returned inline with an availability check. So `getPricing` requires a full\n * domain (e.g. \"example.com\"), checks its availability, and reports the\n * registration price. A bare TLD throws, since GoDaddy can't price a TLD\n * without a specific name. Only `registration` is known here (GoDaddy's\n * availability response carries no separate renewal/transfer price).\n */\n override async getPricing(tldOrDomain: string, opts?: RequestOptions): Promise<TldPricing> {\n if (!tldOrDomain.includes('.')) {\n throw new NotImplementedError(\n `${this.name}: getPricing needs a full domain (e.g. \"example.com\"); ` +\n 'GoDaddy exposes pricing only per-domain via availability, not per-TLD'\n );\n }\n const tld = tldOrDomain.slice(tldOrDomain.indexOf('.') + 1);\n if (this.useV3) {\n // v3 availability carries both registration and renewal price per term.\n const res = await this.http.request<{ items?: GdV3Availability[] }>({\n method: 'POST',\n path: '/v3/domains/check-availability',\n body: { domains: [tldOrDomain] },\n ...opts,\n });\n const term = pickTerm(res.items?.[0]?.prices);\n return {\n tld,\n currency: term?.price?.currencyCode ?? 'USD',\n registration: moneyToMajor(term?.price),\n renewal: moneyToMajor(term?.renewalPrice),\n };\n }\n const [result] = await this.checkAvailability([tldOrDomain], opts);\n return {\n tld,\n currency: result?.currency ?? 'USD',\n registration: result?.price,\n };\n }\n\n /**\n * Registers a domain via GoDaddy's purchase flow. Requires per-call `consent`\n * (with `agreedBy` = the consenting party's IP): this fetches the TLD's\n * agreement keys, then POSTs the purchase with a `consent` block referencing\n * them. GoDaddy requires all four contact roles, so any role the caller omits\n * falls back to the registrant.\n */\n override async registerDomain(\n domainName: string,\n input: RegisterDomainInput,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const registrant = input.contacts.registrant;\n if (!registrant) {\n throw new Error(`${this.name}: registration requires at least a registrant contact`);\n }\n if (this.useV3) return this.registerDomainV3(domainName, input, opts);\n const tld = domainName.slice(domainName.indexOf('.') + 1);\n const privacy = input.privacy ?? false;\n const consent = await this.buildConsent(input.consent, tld, privacy, false, opts);\n\n const body = {\n domain: domainName,\n consent,\n contactRegistrant: toGoDaddyContact(registrant),\n contactAdmin: toGoDaddyContact(input.contacts.admin ?? registrant),\n contactTech: toGoDaddyContact(input.contacts.tech ?? registrant),\n contactBilling: toGoDaddyContact(input.contacts.billing ?? registrant),\n period: input.years ?? 1,\n privacy,\n renewAuto: input.autoRenew ?? false,\n ...(input.nameservers ? { nameServers: input.nameservers } : {}),\n };\n return this.mutate(\n { method: 'POST', path: '/v1/domains/purchase', body },\n `Domain ${domainName} registered successfully`,\n opts\n );\n }\n\n /**\n * v3 registration: quote-then-execute. First POST a quote for the domain/term\n * (price-locked via `quoteToken`, returns the agreements + fees to\n * acknowledge), then POST the registration with the token, a consent block\n * (acknowledging every required agreement + quoted fee), and the contact\n * profile. Registration is async (202), so poll the returned operation to\n * completion. Spends real money; there is no v3 sandbox, so this is\n * documented-but-unverified against a live purchase.\n */\n private async registerDomainV3(\n domainName: string,\n input: RegisterDomainInput,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n if (!input.consent) {\n throw new ConsentRequiredError(\n `${this.name}: registration requires \\`consent\\` (accepting the registration agreements)`\n );\n }\n const period = input.years ?? 1;\n const quote = await this.http.request<GdV3Quote>({\n method: 'POST',\n path: '/v3/domains/registration-quotes',\n body: { domain: domainName, period },\n ...opts,\n });\n if (!quote.quoteToken) {\n throw new Error(`${this.name}: registration quote did not return a quoteToken`);\n }\n // v3 wants a MINIMAL body for a standard REGISTRY registration:\n // `{ domain, period, quoteToken, consent }`. Two hard-won gotchas:\n // - No `profile` block. Sending one (even just autoRenew/privacy) is\n // rejected `INVALID_BODY`. Contacts come from the account identity\n // (the quote's `resolved.contactSource: \"ACCOUNT\"`), and autoRenew /\n // nameservers are applied as post-registration steps below.\n // - `acknowledgedFees` must be OMITTED unless the quote carried fees\n // (the array is `minItems: 1`, so `[]` is rejected). `agreedBy` is\n // resolved server-side from the token + caller IP, so it's not sent.\n const consent = {\n agreementTypes: (quote.requiredAgreements ?? []).map(a => a.agreementType),\n agreedAt: input.consent.agreedAt ?? new Date().toISOString(),\n ...(quote.fees && quote.fees.length ? { acknowledgedFees: quote.fees } : {}),\n };\n const body = { domain: domainName, period, quoteToken: quote.quoteToken, consent };\n try {\n const reg = await this.http.request<GdV3Registration>({\n method: 'POST',\n path: '/v3/domains/registrations',\n body,\n // v3 requires an Idempotency-Key on every execute endpoint; a retry\n // with the same key returns the original result instead of double-buying\n headers: { 'Idempotency-Key': crypto.randomUUID() },\n ...opts,\n });\n if (reg.operationId) await this.pollOperation(reg.operationId, opts);\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n // Post-registration: the minimal body can't carry these, so apply the\n // caller's intent now. GoDaddy registers with the account's default\n // auto-renew (typically ON), so always assert the requested value.\n const warnings: string[] = [];\n try {\n await this.setAutoRenew(domainName, input.autoRenew ?? false, opts);\n } catch (error) {\n warnings.push(`auto-renew not applied (${toRegistrarError(error).message})`);\n }\n if (input.nameservers) {\n try {\n await this.updateNameservers(domainName, input.nameservers, opts);\n } catch (error) {\n warnings.push(`nameservers not applied (${toRegistrarError(error).message})`);\n }\n }\n const suffix = warnings.length ? ` (registered, but ${warnings.join('; ')})` : '';\n return { success: true, message: `Domain ${domainName} registered successfully${suffix}` };\n }\n\n /**\n * Poll a v3 async operation until it leaves the pending states. GoDaddy\n * reports COMPLETED / SUCCESS on success and FAILED / ERROR (with an `error`\n * body) on failure; a failed operation throws.\n */\n private async pollOperation(\n operationId: string,\n opts?: RequestOptions,\n attempts = 10,\n delayMs = 1500\n ): Promise<void> {\n for (let i = 0; i < attempts; i++) {\n const op = await this.http.request<GdV3Operation>({\n path: `/v3/domains/operations/${encodeURIComponent(operationId)}`,\n ...opts,\n });\n const status = (op.status ?? '').toUpperCase();\n if (status === 'COMPLETED' || status === 'SUCCESS' || status === 'SUCCEEDED') return;\n if (status === 'FAILED' || status === 'ERROR') {\n throw new Error(op.error?.message ?? `operation ${operationId} failed`);\n }\n await new Promise(resolve => setTimeout(resolve, delayMs));\n }\n // still pending after the budget — treat as accepted; the caller can re-check\n }\n\n /**\n * Transfers a domain in with its auth code. GoDaddy's transfer body is much\n * smaller than a purchase — just the auth code + a `consent` block (fetched\n * with `forTransfer=true`, since transfer agreements can differ) + optional\n * period/renewAuto/privacy. No contacts: the existing registration's carry\n * over. v3 has no transfer endpoint, so this is always the v1 flow (which is\n * also what OTE exposes for testing).\n */\n override async transferIn(\n domainName: string,\n input: TransferDomainInput,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const tld = domainName.slice(domainName.indexOf('.') + 1);\n const privacy = input.privacy ?? false;\n const consent = await this.buildConsent(input.consent, tld, privacy, true, opts);\n\n const body: Record<string, unknown> = {\n authCode: input.authCode,\n consent,\n privacy,\n renewAuto: input.autoRenew ?? false,\n };\n if (input.years != null) body.period = input.years;\n return this.mutate(\n { method: 'POST', path: `/v1/domains/${encodeURIComponent(domainName)}/transfer`, body },\n `Domain ${domainName} transfer requested successfully`,\n opts\n );\n }\n\n /**\n * Builds the GoDaddy `consent` block shared by register and transfer: validates\n * consent is present (with `agreedBy`), fetches the agreement keys for the TLD\n * (register vs. transfer agreements differ, hence `forTransfer`), and stamps\n * `agreedAt`.\n */\n private async buildConsent(\n consent: RegistrationConsent | undefined,\n tld: string,\n privacy: boolean,\n forTransfer: boolean,\n opts?: RequestOptions\n ): Promise<{ agreementKeys: string[]; agreedAt: string; agreedBy: string }> {\n if (!consent) {\n throw new ConsentRequiredError(\n `${this.name}: this operation requires consent — supply \\`consent\\` ` +\n '(accepting the registration agreements)'\n );\n }\n if (!consent.agreedBy) {\n throw new ConsentRequiredError(\n `${this.name}: consent.agreedBy is required and must be the consenting party's IP address`\n );\n }\n const query: Record<string, string | number | boolean> = { tlds: tld, privacy };\n if (forTransfer) query.forTransfer = true;\n const agreements = await this.http.request<GoDaddyAgreement[]>({\n path: '/v1/domains/agreements',\n query,\n ...opts,\n });\n const agreementKeys = (agreements ?? []).map(a => a.agreementKey);\n if (agreementKeys.length === 0) {\n throw new ConsentRequiredError(`${this.name}: no agreements were returned for .${tld}`);\n }\n return {\n agreementKeys,\n agreedAt: consent.agreedAt ?? new Date().toISOString(),\n agreedBy: consent.agreedBy,\n };\n }\n\n override async renewDomain(\n domainName: string,\n years = 1,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.mutate(\n {\n method: 'POST',\n path: `/v1/domains/${encodeURIComponent(domainName)}/renew`,\n body: { period: years },\n },\n 'Domain renewed successfully',\n opts\n );\n }\n\n override async setAutoRenew(\n domainName: string,\n enabled: boolean,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.mutate(\n {\n method: 'PATCH',\n path: `/v1/domains/${encodeURIComponent(domainName)}`,\n body: { renewAuto: enabled },\n },\n `Auto-renew ${enabled ? 'enabled' : 'disabled'} successfully`,\n opts\n );\n }\n\n override async updateNameservers(\n domainName: string,\n nameservers: string[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n if (nameservers.length < 1 || nameservers.length > 13) {\n throw new Error('GoDaddy requires 1-13 nameservers');\n }\n if (this.useV3) {\n // v3 replaces nameservers with a dedicated PUT; the body is a bare array.\n // Like /registrations, this execute endpoint requires an Idempotency-Key.\n return this.mutate(\n {\n method: 'PUT',\n path: `/v3/domains/domain-names/${encodeURIComponent(domainName)}/nameservers`,\n body: nameservers,\n headers: { 'Idempotency-Key': crypto.randomUUID() },\n },\n 'Nameservers updated successfully',\n opts\n );\n }\n return this.mutate(\n {\n method: 'PATCH',\n path: `/v1/domains/${encodeURIComponent(domainName)}`,\n body: { nameServers: nameservers },\n },\n 'Nameservers updated successfully',\n opts\n );\n }\n\n override async lockDomain(domainName: string, opts?: RequestOptions): Promise<OperationResult> {\n return this.mutate(\n {\n method: 'PATCH',\n path: `/v1/domains/${encodeURIComponent(domainName)}`,\n body: { locked: true },\n },\n 'Domain locked successfully',\n opts\n );\n }\n\n override async unlockDomain(domainName: string, opts?: RequestOptions): Promise<OperationResult> {\n return this.mutate(\n {\n method: 'PATCH',\n path: `/v1/domains/${encodeURIComponent(domainName)}`,\n body: { locked: false },\n },\n 'Domain unlocked successfully',\n opts\n );\n }\n\n /**\n * Disabling privacy is a simple DELETE. Enabling it is a paid purchase\n * (`POST /v1/domains/{domain}/privacy/purchase`) requiring a consent block and\n * payment, so it's left unimplemented rather than silently spending money.\n */\n override async setPrivacy(\n domainName: string,\n enabled: boolean,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n if (enabled) {\n throw new NotImplementedError(\n `${this.name}: enabling privacy is a paid purchase and is not implemented; ` +\n 'only disabling privacy is supported via the API'\n );\n }\n const encoded = encodeURIComponent(domainName);\n try {\n await this.http.request({\n method: 'DELETE',\n path: `/v1/domains/${encoded}/privacy`,\n ...opts,\n });\n return { success: true, message: 'Privacy disabled successfully' };\n } catch (error) {\n const err = toRegistrarError(error);\n // GoDaddy's free privacy (\"Free DBP\") can't be canceled via DELETE — it\n // returns 409 CONFLICTING_STATUS. The only way to turn it off is to expose\n // the WHOIS via a domain PATCH (`exposeWhois: true`), but GoDaddy requires a\n // full legal consent block on that PATCH (`agreedAt` + `agreedBy` = the\n // consenting party's IP + `agreementKeys`) — the same consent as a\n // registration. setPrivacy can't carry that (and this client is edge-safe\n // with no reliable IP source), so surface a clear, actionable error instead\n // of silently failing. Paid DBP still cancels through the DELETE above.\n if (err.status === 409) {\n return {\n success: false,\n message:\n `${this.name}: this domain uses free WHOIS privacy (Free DBP), which the API ` +\n 'only disables by exposing the WHOIS via a consent block (agreedAt + agreedBy IP ' +\n '+ agreementKeys) that setPrivacy cannot supply; disable it in the GoDaddy dashboard.',\n };\n }\n return { success: false, message: err.message };\n }\n }\n\n override async getContacts(domainName: string, opts?: RequestOptions): Promise<ContactSet> {\n // v3's domain record omits contacts, so read them from v1 in both modes.\n const d = await this.http.request<GoDaddyDomain>({\n path: `/v1/domains/${encodeURIComponent(domainName)}`,\n ...opts,\n });\n return {\n registrant: fromGoDaddyContact(d.contactRegistrant),\n admin: fromGoDaddyContact(d.contactAdmin),\n tech: fromGoDaddyContact(d.contactTech),\n billing: fromGoDaddyContact(d.contactBilling),\n };\n }\n\n override async updateContacts(\n domainName: string,\n contacts: ContactSet,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n // include only the roles the caller supplied\n const body: Record<string, GoDaddyContact> = {};\n if (contacts.registrant) body.contactRegistrant = toGoDaddyContact(contacts.registrant);\n if (contacts.admin) body.contactAdmin = toGoDaddyContact(contacts.admin);\n if (contacts.tech) body.contactTech = toGoDaddyContact(contacts.tech);\n if (contacts.billing) body.contactBilling = toGoDaddyContact(contacts.billing);\n if (Object.keys(body).length === 0) {\n throw new Error('GoDaddy updateContacts requires at least one contact');\n }\n return this.mutate(\n { method: 'PATCH', path: `/v1/domains/${encodeURIComponent(domainName)}/contacts`, body },\n 'Contacts updated successfully',\n opts\n );\n }\n\n override async getDnsRecords(domainName: string, opts?: RequestOptions): Promise<DnsRecord[]> {\n if (this.useV3) {\n return (await this.getV3Records(domainName, opts)).map(fromV3Record);\n }\n const records = await this.http.request<GoDaddyRecord[]>({\n path: `/v1/domains/${encodeURIComponent(domainName)}/records`,\n ...opts,\n });\n return (records ?? []).map(r => ({\n type: r.type,\n name: r.name,\n value: r.data,\n ttl: r.ttl,\n priority: r.priority,\n weight: r.weight,\n port: r.port,\n }));\n }\n\n /**\n * Replaces the entire record set (full-replace semantics): any record not\n * present in `records` is removed. GoDaddy requires a minimum TTL of 600\n * seconds, so records without an explicit TTL default to 3600.\n *\n * v1 does this in one bulk PUT. v3 has no bulk endpoint — only per-record\n * POST/PUT/DELETE — so the v3 path diffs the desired set against the current\n * one (keyed by type+name+value): delete records no longer wanted, add new\n * ones, and PUT matched records whose TTL/priority/etc. changed.\n */\n override async setDnsRecords(\n domainName: string,\n records: DnsRecord[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n if (this.useV3) return this.setDnsRecordsV3(domainName, records, opts);\n const body: GoDaddyRecord[] = records.map(r => {\n const record: GoDaddyRecord = {\n type: r.type.toUpperCase(),\n name: r.name,\n data: r.value,\n ttl: r.ttl ?? 3600,\n };\n if (r.priority != null) record.priority = r.priority;\n if (r.weight != null) record.weight = r.weight;\n if (r.port != null) record.port = r.port;\n return record;\n });\n return this.mutate(\n { method: 'PUT', path: `/v1/domains/${encodeURIComponent(domainName)}/records`, body },\n 'DNS records updated successfully',\n opts\n );\n }\n\n // Read every DNS record in a v3 zone, following pagination.\n private async getV3Records(domainName: string, opts?: RequestOptions): Promise<GdV3DnsRecord[]> {\n const zone = encodeURIComponent(domainName);\n const records: GdV3DnsRecord[] = [];\n let path: string | undefined = `/v3/domains/zones/${zone}/dns-records`;\n let query: Record<string, string | number> | undefined = { pageSize: 100 }; // v3 max\n while (path) {\n const page: GdV3DnsRecordPage = await this.http.request<GdV3DnsRecordPage>({\n path,\n query,\n ...opts,\n });\n for (const r of page.items ?? []) records.push(r);\n const next = (page.links ?? []).find(l => l.rel === 'next')?.href;\n path = next && page.items?.length ? next : undefined;\n query = undefined;\n }\n return records;\n }\n\n private async setDnsRecordsV3(\n domainName: string,\n records: DnsRecord[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const zone = encodeURIComponent(domainName);\n const base = `/v3/domains/zones/${zone}/dns-records`;\n try {\n const current = await this.getV3Records(domainName, opts);\n const currentByKey = new Map(current.map(r => [dnsKeyV3(r), r]));\n const desired = records.map(toV3Record);\n const desiredKeys = new Set(desired.map(dnsKeyV3));\n\n // delete records that are no longer desired\n for (const r of current) {\n if (!desiredKeys.has(dnsKeyV3(r)) && r.recordId) {\n await this.http.request({\n method: 'DELETE',\n path: `${base}/${encodeURIComponent(r.recordId)}`,\n ...opts,\n });\n }\n }\n // add new records; update matched records whose fields changed\n for (const d of desired) {\n const existing = currentByKey.get(dnsKeyV3(d));\n if (!existing) {\n await this.http.request({ method: 'POST', path: base, body: d, ...opts });\n } else if (existing.recordId && dnsFieldsDiffer(existing, d)) {\n await this.http.request({\n method: 'PUT',\n path: `${base}/${encodeURIComponent(existing.recordId)}`,\n body: d,\n ...opts,\n });\n }\n }\n return { success: true, message: 'DNS records updated successfully' };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n // --- extended capabilities ---------------------------------------------\n\n /**\n * Resolve the configured `customerId` to the UUID the v2 API expects, memoized\n * for the instance's lifetime. GoDaddy's v2 customer-scoped routes key on a\n * customer **UUID**, which differs from the numeric shopper/account ID shown in\n * most dashboards. Callers may configure either:\n * - a UUID → used directly, and\n * - a numeric shopper ID → resolved via `GET /v1/shoppers/{id}?includes=customerId`.\n * The shopper lookup is **sso-key-only** (it rejects a PAT with 401), so\n * resolving a numeric ID requires `apiKey` + `apiSecret`; supplying the UUID\n * directly avoids that dependency. Throws a ConfigurationError when\n * `customerId` is absent, or a clear error when a numeric ID can't be resolved.\n */\n private async resolveCustomerId(opts?: RequestOptions): Promise<string> {\n const configured = this.credentials.customerId?.trim();\n if (!configured) {\n throw new ConfigurationError(\n `${this.name}: domain forwarding uses the v2 customer-scoped API, which ` +\n 'requires a customer ID. Set `customerId` to your GoDaddy customer UUID ' +\n '(or your numeric shopper/account ID, which will be resolved to the UUID).'\n );\n }\n if (UUID_RE.test(configured)) return configured;\n // numeric shopper ID → resolve to the customer UUID (sso-key only)\n return (this.customerIdPromise ??= (async () => {\n if (!this.credentials.apiKey || !this.credentials.apiSecret) {\n throw new ConfigurationError(\n `${this.name}: resolving a numeric shopper ID (\"${configured}\") to a customer ` +\n 'UUID requires an sso-key (apiKey + apiSecret); the shopper lookup rejects a ' +\n 'PAT. Either supply the customer UUID directly as `customerId`, or add sso-key ' +\n 'credentials.'\n );\n }\n try {\n const shopper = await this.http.request<{ customerId?: string }>({\n // resolution is sso-key-only, so send the sso-key header explicitly\n // rather than the instance default (which may be a Bearer PAT).\n path: `/v1/shoppers/${encodeURIComponent(configured)}`,\n query: { includes: 'customerId' },\n headers: {\n Authorization: `sso-key ${this.credentials.apiKey}:${this.credentials.apiSecret}`,\n },\n ...opts,\n });\n if (!shopper.customerId) {\n throw new Error('response did not include a customerId');\n }\n return shopper.customerId;\n } catch (error) {\n this.customerIdPromise = undefined; // allow a later retry\n throw new ConfigurationError(\n `${this.name}: could not resolve shopper ID \"${configured}\" to a customer UUID ` +\n `(${toRegistrarError(error).message}). Supply the customer UUID directly as ` +\n '`customerId`.'\n );\n }\n })());\n }\n\n /**\n * Read URL forwarding via the v2 customer-scoped route\n * GET /v2/customers/{customerId}/domains/forwards/{fqdn}?includeSubs=true.\n * GoDaddy keys forwarding by fqdn (the domain or a subdomain), so each entry\n * maps to a DomainForward whose `host` is relative to the apex (\"@\" = domain).\n * A domain with no forwarding returns 404, which we treat as an empty list.\n */\n override async getDomainForwarding(\n domainName: string,\n opts?: RequestOptions\n ): Promise<DomainForward[]> {\n const customerId = await this.resolveCustomerId(opts);\n let forwards: GoDaddyForward[];\n try {\n forwards = await this.http.request<GoDaddyForward[]>({\n path: this.forwardPath(customerId, domainName),\n query: { includeSubs: true },\n ...opts,\n });\n } catch (error) {\n if (error instanceof NotFoundError) return [];\n throw error;\n }\n return (forwards ?? []).map(f => ({\n host: fqdnToHost(f.fqdn ?? domainName, domainName),\n url: f.url ?? '',\n type: GD_TYPE_TO_FORWARD[(f.type ?? '').toUpperCase()] ?? 'permanent',\n }));\n }\n\n /**\n * Replace URL forwarding (full replace; an empty list clears it). GoDaddy has\n * no bulk endpoint — forwarding is a per-fqdn PUT/DELETE — so we read the\n * current forwards, DELETE any fqdn no longer wanted, then PUT each desired\n * rule to /v2/customers/{customerId}/domains/forwards/{fqdn}.\n */\n override async setDomainForwarding(\n domainName: string,\n forwards: DomainForward[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n try {\n const settable = settableForwards(forwards); // reject masked before any write\n const customerId = await this.resolveCustomerId(opts);\n const current = await this.getDomainForwarding(domainName, opts);\n const desiredHosts = new Set(settable.map(f => f.host || '@'));\n\n for (const existing of current) {\n if (!desiredHosts.has(existing.host)) {\n const fqdn = hostToFqdn(existing.host, domainName);\n await this.http.request({\n method: 'DELETE',\n path: this.forwardPath(customerId, fqdn),\n ...opts,\n });\n }\n }\n\n for (const f of settable) {\n const fqdn = hostToFqdn(f.host || '@', domainName);\n const body: GoDaddyForward = { type: GD_FORWARD_TYPE[f.type], url: f.url };\n await this.http.request({\n method: 'PUT',\n path: this.forwardPath(customerId, fqdn),\n body,\n ...opts,\n });\n }\n return { success: true, message: 'Domain forwarding updated successfully' };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n // the v2 customer-scoped forwarding resource path for a given fqdn\n private forwardPath(customerId: string, fqdn: string): string {\n return `/v2/customers/${encodeURIComponent(customerId)}/domains/forwards/${encodeURIComponent(fqdn)}`;\n }\n\n /**\n * Transfer authorization (EPP) code. GoDaddy exposes it as the `authCode`\n * field on the v1 domain-detail response; transfers were never moved to v3,\n * so this always reads from v1 regardless of the `useV3` routing. Returned\n * synchronously in the body — not email-only. The domain generally needs to\n * be unlocked and out of the 60-day post-registration/transfer lock for the\n * code to be usable for an outbound transfer.\n */\n override async getAuthCode(domainName: string, opts?: RequestOptions): Promise<string> {\n const d = await this.http.request<GoDaddyDomain>({\n path: `/v1/domains/${encodeURIComponent(domainName)}`,\n ...opts,\n });\n return d.authCode ?? '';\n }\n\n // map a v1 GoDaddy domain payload to the normalized Domain shape\n private toDomain(d: GoDaddyDomain): Domain {\n return createDomain({\n domainName: d.domain,\n registrar: this.name,\n status: d.status,\n createdDate: d.createdAt,\n expirationDate: d.expires,\n renewalDate: d.renewDeadline,\n autoRenew: d.renewAuto ?? false,\n locked: d.locked ?? false,\n privacy: d.privacy ?? false,\n nameservers: d.nameServers ?? [],\n });\n }\n\n // map a v3 GoDaddy domain payload to the normalized Domain shape. v3 renames\n // several fields (transferLock → locked, renewBy → renewalDate, expiresAt →\n // expirationDate).\n private toDomainV3(d: GdV3Domain): Domain {\n return createDomain({\n domainName: d.domain,\n registrar: this.name,\n status: d.status,\n createdDate: d.createdAt,\n expirationDate: d.expiresAt,\n renewalDate: d.renewBy,\n autoRenew: d.autoRenew ?? false,\n locked: d.transferLock ?? false,\n privacy: d.privacy ?? false,\n nameservers: d.nameServers ?? [],\n });\n }\n\n private async mutate(\n req: { method: string; path: string; body?: unknown; headers?: Record<string, string> },\n successMessage: string,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n try {\n await this.http.request({ ...req, ...opts });\n return { success: true, message: successMessage };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n}\n\n// --- contact mapping between GoDaddy's shape and the normalized Contact ---\n\nfunction fromGoDaddyContact(c: GoDaddyContact | undefined): Contact | undefined {\n if (!c) return undefined;\n const a = c.addressMailing ?? {};\n return {\n firstName: c.nameFirst ?? '',\n lastName: c.nameLast ?? '',\n organization: c.organization,\n email: c.email ?? '',\n phone: c.phone ?? '',\n fax: c.fax,\n address1: a.address1 ?? '',\n address2: a.address2,\n city: a.city ?? '',\n state: a.state,\n postalCode: a.postalCode ?? '',\n country: a.country ?? '',\n };\n}\n\nfunction toGoDaddyContact(c: Contact): GoDaddyContact {\n return {\n nameFirst: c.firstName,\n nameLast: c.lastName,\n organization: c.organization,\n email: c.email,\n phone: c.phone,\n fax: c.fax,\n addressMailing: {\n address1: c.address1,\n address2: c.address2,\n city: c.city,\n state: c.state ?? '',\n postalCode: c.postalCode,\n country: c.country,\n },\n };\n}\n\n// resolve a forwarding host relative to the apex into a full fqdn, and back.\n// \"@\" (or \"\") denotes the apex domain itself.\nfunction hostToFqdn(host: string, domain: string): string {\n return !host || host === '@' ? domain : `${host}.${domain}`;\n}\nfunction fqdnToHost(fqdn: string, domain: string): string {\n if (fqdn === domain) return '@';\n const suffix = `.${domain}`;\n return fqdn.endsWith(suffix) ? fqdn.slice(0, -suffix.length) : fqdn;\n}\n\n// --- v3 helpers ------------------------------------------------------------\n\n// Pick the pricing term to report — prefer the 1-year term, else the first.\nfunction pickTerm(prices?: GdV3TermPrice[]): GdV3TermPrice | undefined {\n if (!prices || prices.length === 0) return undefined;\n return prices.find(p => p.period === 1) ?? prices[0];\n}\n\n// Classify a v3 availability `inventory` value. Standard registry names report\n// \"REGISTRY\" (or \"STANDARD\"); premium/aftermarket names report a PREMIUM-type\n// value. Undefined when the field is absent.\nfunction isPremiumInventory(inventory?: string): boolean | undefined {\n if (inventory == null) return undefined;\n return /PREMIUM/i.test(inventory);\n}\n\n// Convert v3 \"Simple Money\" (integer minor units) to major units. Assumes\n// 2-decimal currencies (USD/EUR/…); zero-decimal currencies like JPY would need\n// currency-aware scaling, but GoDaddy prices in USD by default.\nfunction moneyToMajor(m?: GdV3Money): number | undefined {\n if (!m || m.value == null) return undefined;\n return m.value / 100;\n}\n\n// map a v3 DNS record to the normalized DnsRecord shape\nfunction fromV3Record(r: GdV3DnsRecord): DnsRecord {\n return {\n type: r.type,\n name: r.name,\n value: r.data,\n ttl: r.ttl,\n priority: r.priority,\n weight: r.weight,\n port: r.port,\n };\n}\n\n// map a normalized DnsRecord to a v3 record body. GoDaddy requires a minimum\n// TTL of 600s, so records without an explicit TTL default to 3600.\nfunction toV3Record(r: DnsRecord): GdV3DnsRecord {\n const out: GdV3DnsRecord = {\n type: r.type.toUpperCase(),\n name: r.name || '@',\n data: r.value,\n ttl: r.ttl ?? 3600,\n };\n if (r.priority != null) out.priority = r.priority;\n if (r.weight != null) out.weight = r.weight;\n if (r.port != null) out.port = r.port;\n return out;\n}\n\n// identity of a record for full-replace diffing: type + name + value, joined by\n// a unit-separator (U+001F) that can't appear in a hostname or record value —\n// avoids collisions without embedding a NUL (which would make the file binary).\nfunction dnsKeyV3(r: GdV3DnsRecord): string {\n return `${r.type.toUpperCase()}\\u001f${r.name || '@'}\\u001f${r.data}`;\n}\n\n// whether two records that share a key differ in a mutable field (TTL/priority/\n// weight/port), meaning the existing one should be PUT-updated\nfunction dnsFieldsDiffer(a: GdV3DnsRecord, b: GdV3DnsRecord): boolean {\n return (\n (a.ttl ?? 3600) !== (b.ttl ?? 3600) ||\n (a.priority ?? null) !== (b.priority ?? null) ||\n (a.weight ?? null) !== (b.weight ?? null) ||\n (a.port ?? null) !== (b.port ?? null)\n );\n}\n\n// NOTE: v3 registration takes contacts from the account identity (the quote's\n// `resolved.contactSource: \"ACCOUNT\"`) and rejects a `profile.contacts` block,\n// so there is no v3 contact mapper — see `registerDomainV3`. v1 uses\n// `toGoDaddyContact` above.\n","import type {\n ConfigField,\n ConnectionResult,\n Contact,\n ContactSet,\n DnsRecord,\n Domain,\n DomainAvailability,\n ListDomainsOptions,\n OperationResult,\n RegisterDomainInput,\n RegistrarOptions,\n RequestOptions,\n TldPricing,\n} from '../types';\nimport { createDomain, filterDomains } from '../utils';\nimport { AuthenticationError, NotImplementedError, toRegistrarError } from '../errors';\nimport { BaseRegistrar, selectBaseUrl } from '../registrar';\nimport { Feature, type RegistrarFeature } from '../features';\nimport type { RegistrarCredentials } from '../types';\nimport type { RequestConfig } from '../http';\n\nconst TOKEN_URL = 'https://api.namebright.com/auth/token';\n\n// response from the OAuth2 token endpoint\ninterface NbToken {\n access_token?: string;\n token_type?: string;\n expires_in?: number;\n}\n\n// the order returned by purchase/register and purchase/renew\ninterface NbOrder {\n OrderId?: number;\n TotalPrice?: number;\n}\n\n// a domain record from GET account/domains. The list endpoint does not return\n// nameservers (those come from account/domains/{domain}/nameservers).\ninterface NbDomain {\n DomainName?: string;\n domain?: string;\n Status?: string;\n ExpirationDate?: string;\n RegistrationDate?: string;\n AutoRenew?: boolean;\n Locked?: boolean;\n WhoIsPrivacy?: boolean;\n AuthCode?: string;\n}\n\n// the paged wrapper GET account/domains returns\ninterface NbDomainsPage {\n ResultsTotal?: number;\n CurrentPage?: number;\n Domains?: NbDomain[];\n domains?: NbDomain[];\n}\n\n// GET account/domains/{domain}/nameservers → { DomainName, NameServers: [...] }.\n// Be lenient about casing and a possible bare array.\ninterface NbNameservers {\n DomainName?: string;\n NameServers?: string[];\n Nameservers?: string[];\n nameservers?: string[];\n}\n\n// a contact object inside GET account/domains/{domain}/contacts/all. NameBright\n// splits the phone into a country-code part and the number.\ninterface NbContact {\n FirstName?: string;\n LastName?: string;\n Organization?: string;\n Department?: string;\n Email?: string;\n Address1?: string;\n Address2?: string;\n City?: string;\n Region?: string;\n Country?: string;\n PostalCode?: string;\n // NameBright returns the country-code parts as numbers (e.g. 1), not strings\n PhoneCountry?: string | number;\n Phone?: string | number;\n FaxCountry?: string | number;\n Fax?: string | number;\n}\n\n// GET account/domains/{domain}/contacts/all. NameBright exposes registrant,\n// administrative, and technical roles only (no billing).\ninterface NbContactsResponse {\n DomainName?: string;\n RegistrantContact?: NbContact;\n AdministrativeContact?: NbContact;\n TechnicalContact?: NbContact;\n}\n\n// the per-type DNS host records from GET account/domains/{domain}/hostrecords/all.\n// Each carries a numeric RecordId used to address it for deletion\n// (DELETE account/domains/{domain}/hostrecords/{type}/{RecordId}).\ninterface NbARecord {\n Subdomain?: string;\n IPV4Address?: string;\n RecordId?: number;\n}\ninterface NbAAAARecord {\n Subdomain?: string;\n IPV6Address?: string;\n RecordId?: number;\n}\ninterface NbCNAMERecord {\n Subdomain?: string;\n RedirectDomain?: string;\n RecordId?: number;\n}\ninterface NbMXRecord {\n Subdomain?: string;\n MailServer?: string;\n Priority?: number;\n RecordId?: number;\n}\ninterface NbTXTRecord {\n Subdomain?: string;\n TextRecord?: string;\n RecordId?: number;\n}\ninterface NbSRVRecord {\n Service?: string;\n Protocol?: string;\n Priority?: number;\n Weight?: number;\n Port?: number;\n Target?: string;\n RecordId?: number;\n}\n\ninterface NbHostRecords {\n DomainName?: string;\n ARecords?: NbARecord[];\n AAAARecords?: NbAAAARecord[];\n CNAMERecords?: NbCNAMERecord[];\n MXRecords?: NbMXRecord[];\n TXTRecords?: NbTXTRecord[];\n SRVRecords?: NbSRVRecord[];\n}\n\n// GET purchase/availability/{domain}. NameBright returns a per-domain result\n// with the standard unit price and an optional promotional price.\ninterface NbAvailability {\n DomainName?: string;\n ProductTypeName?: string;\n Status?: string;\n UnitPrice?: number;\n Promotion?: {\n PromotionPrice?: number;\n Discount?: number;\n Description?: string;\n };\n}\n\n/**\n * NameBright Registrar\n * API docs: https://api.namebright.com/rest/Help\n *\n * Credentials: create an API Application at\n * https://my.namebright.com/my-account/api-management. Each application has a\n * name and an IP whitelist; NameBright issues a client secret. The OAuth2\n * `client_id` is formatted \"<accountName>:<applicationName>\".\n *\n * Auth: OAuth2 client-credentials. We POST to the token endpoint for a bearer\n * token (valid ~30 minutes), cache it, and send it as `Authorization: Bearer`\n * on each REST call.\n *\n * The read operations are implemented here (testConnection, listDomains,\n * getDomain, getNameservers, getContacts, getDnsRecords, checkAvailability,\n * getAuthCode). `getPricing` throws NotImplementedError — NameBright has no\n * per-TLD price table.\n *\n * Write operations verified against a live account: lock/unlock, setAutoRenew,\n * and setPrivacy all update the shared `PUT /account/domains/{domain}` endpoint\n * (which takes the full AccountDomain body — we read-merge to avoid clobbering\n * the other flags). setDnsRecords applies a desired-state diff via per-type\n * POST/DELETE on `hostrecords/{type}[/{RecordId}]` (a blind delete-all +\n * re-create trips NameBright's flaky \"Duplicate host record\" check).\n *\n * updateNameservers (DELETE-all + per-server PUT on `nameservers[/{ns}]`) is\n * built from the documented endpoints but NOT live-verified — replacing the\n * nameservers on a live domain has no safe test path.\n *\n * registerDomain / renewDomain use the `purchase/register` and `purchase/renew`\n * order endpoints. They spend real money (each returns an order with a\n * `TotalPrice`), so they're built from the documented request shape but NOT\n * exercised against the live account. transferIn remains NotImplementedError —\n * NameBright's REST API exposes no transfer-in endpoint.\n */\nexport class NameBrightRegistrar extends BaseRegistrar {\n readonly name = 'namebright';\n\n static readonly displayName = 'NameBright';\n static readonly helpText =\n 'API access is not enabled by default — you must request it from NameBright ' +\n '(contact support / your account manager) before the API Management page is ' +\n 'available. Once enabled, create an API Application under my.namebright.com > ' +\n 'My Account > API Management. The Client ID is \"<accountName>:<applicationName>\"; ' +\n 'NameBright issues the Client Secret. Note the application also enforces an IP whitelist.';\n static readonly configFields: ConfigField[] = [\n { name: 'clientId', label: 'Client ID', type: 'text', required: true },\n { name: 'clientSecret', label: 'Client Secret', type: 'password', required: true },\n ];\n static readonly supportsSandbox = false; // NameBright has no sandbox environment\n // REST/JSON API covering the core lifecycle plus transfer-out auth code (the\n // `AuthCode` field on the domain-detail response). No DNSSEC, forwarding, or\n // push webhooks.\n static readonly extendedFeatures: readonly RegistrarFeature[] = [Feature.GetAuthCode];\n\n private token?: string;\n private tokenExpiresAt = 0;\n\n constructor(credentials: RegistrarCredentials, options?: RegistrarOptions) {\n super(\n credentials,\n {\n baseUrl: selectBaseUrl('NameBright', options?.environment, {\n production: 'https://api.namebright.com/rest',\n }),\n },\n options\n );\n }\n\n // fetch (and cache) an OAuth2 bearer token via the client-credentials grant\n private async getToken(opts?: RequestOptions): Promise<string> {\n const now = Date.now();\n if (this.token && now < this.tokenExpiresAt) return this.token;\n\n const res = await this.http.request<NbToken>({\n method: 'POST',\n path: TOKEN_URL,\n body: {\n grant_type: 'client_credentials',\n client_id: this.credentials.clientId,\n client_secret: this.credentials.clientSecret,\n },\n ...opts,\n });\n if (!res.access_token) {\n throw new AuthenticationError('NameBright: token endpoint returned no access_token');\n }\n this.token = res.access_token;\n // tokens last ~30 minutes; refresh a minute early\n const ttlMs = (res.expires_in ?? 1800) * 1000;\n this.tokenExpiresAt = now + ttlMs - 60_000;\n return this.token;\n }\n\n // issue an authenticated REST request, attaching a fresh bearer token\n private async authed<T>(\n config: Omit<RequestConfig, 'headers'>,\n opts?: RequestOptions\n ): Promise<T> {\n const token = await this.getToken(opts);\n return this.http.request<T>({\n ...config,\n headers: { Authorization: `Bearer ${token}` },\n ...opts,\n });\n }\n\n override async testConnection(opts?: RequestOptions): Promise<ConnectionResult> {\n try {\n // GET /account succeeds only with a valid token\n await this.authed({ path: 'account' }, opts);\n return { success: true, message: 'Connection successful' };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n override async listDomains(opts?: ListDomainsOptions): Promise<Domain[]> {\n // The list endpoint has no name filter, so `search` is applied client-side.\n // Nameservers are not returned here (see NbDomain).\n const { search, ...reqOpts } = opts ?? {};\n const domains: Domain[] = [];\n const perPage = 100; // domainsPerPage maximum\n let page = 1;\n let hasMore = true;\n\n while (hasMore) {\n const data = await this.authed<NbDomainsPage | NbDomain[]>(\n { path: 'account/domains', query: { page, domainsPerPage: perPage } },\n reqOpts\n );\n // the response may be a bare array or a paged object; be lenient\n const list = Array.isArray(data) ? data : (data?.Domains ?? data?.domains ?? []);\n\n for (const d of list) domains.push(this.toDomain(d));\n\n hasMore = list.length === perPage;\n page++;\n }\n return filterDomains(domains, search);\n }\n\n /**\n * Fetch a single domain via GET account/domains/{domain}. This endpoint carries\n * the same core fields as the list endpoint (plus Category/UpgradedDomain/\n * AuthCode, which we don't map) but not nameservers — use `getNameservers` for\n * those, so `nameservers` comes back empty here.\n */\n override async getDomain(domainName: string, opts?: RequestOptions): Promise<Domain> {\n const d = await this.authed<NbDomain>(\n { path: `account/domains/${encodeURIComponent(domainName)}` },\n opts\n );\n return this.toDomain(d);\n }\n\n /**\n * Transfer authorization (EPP) code. NameBright carries it as the `AuthCode`\n * field on the domain-detail response (GET account/domains/{domain}), returned\n * synchronously in the body — not email-only.\n */\n override async getAuthCode(domainName: string, opts?: RequestOptions): Promise<string> {\n const d = await this.authed<NbDomain>(\n { path: `account/domains/${encodeURIComponent(domainName)}` },\n opts\n );\n return d.AuthCode ?? '';\n }\n\n override async getNameservers(domainName: string, opts?: RequestOptions): Promise<string[]> {\n const res = await this.authed<NbNameservers | string[]>(\n { path: `account/domains/${encodeURIComponent(domainName)}/nameservers` },\n opts\n );\n if (Array.isArray(res)) return res.map(String);\n return (res.NameServers ?? res.Nameservers ?? res.nameservers ?? []).map(String);\n }\n\n /**\n * Read the registrant/admin/tech contacts via GET\n * account/domains/{domain}/contacts/all. NameBright has no billing contact, so\n * `billing` is always omitted.\n */\n override async getContacts(domainName: string, opts?: RequestOptions): Promise<ContactSet> {\n const res = await this.authed<NbContactsResponse>(\n { path: `account/domains/${encodeURIComponent(domainName)}/contacts/all` },\n opts\n );\n return {\n registrant: fromNbContact(res.RegistrantContact),\n admin: fromNbContact(res.AdministrativeContact),\n tech: fromNbContact(res.TechnicalContact),\n };\n }\n\n /**\n * Read DNS host records via GET account/domains/{domain}/hostrecords/all, which\n * groups records by type. NameBright doesn't return a per-record TTL, so `ttl`\n * is left unset.\n */\n override async getDnsRecords(domainName: string, opts?: RequestOptions): Promise<DnsRecord[]> {\n const res = await this.authed<NbHostRecords>(\n { path: `account/domains/${encodeURIComponent(domainName)}/hostrecords/all` },\n opts\n );\n return flattenHostRecords(res).map(e => e.record);\n }\n\n /**\n * NameBright exposes no per-TLD price table — only a per-domain availability\n * check that returns a registration price (no renewal/transfer prices), so\n * there's no `TldPricing` to return. Mirrors Spaceship's `getPricing`.\n */\n override getPricing(_tldOrDomain: string, _opts?: RequestOptions): Promise<TldPricing> {\n return Promise.reject(\n new NotImplementedError(\n `${this.name}: getPricing is not available — NameBright exposes no per-TLD pricing ` +\n 'endpoint (only a per-domain registration price via checkAvailability)'\n )\n );\n }\n\n /**\n * Availability via GET purchase/availability/{domain}. NameBright's endpoint is\n * per-domain, so multiple names are checked sequentially. It reports a `Status`\n * (\"AvailableForRegistration\") plus a `UnitPrice`, discounted by an optional\n * `Promotion`. NameBright bills in USD (the response carries no currency code).\n */\n override async checkAvailability(\n domainNames: string[],\n opts?: RequestOptions\n ): Promise<DomainAvailability[]> {\n const results: DomainAvailability[] = [];\n for (const domainName of domainNames) {\n const res = await this.authed<NbAvailability>(\n { path: `purchase/availability/${encodeURIComponent(domainName)}` },\n opts\n );\n const price = res.Promotion?.PromotionPrice ?? res.UnitPrice;\n const result: DomainAvailability = {\n domainName: res.DomainName ?? domainName,\n available: res.Status === 'AvailableForRegistration',\n };\n // NameBright returns UnitPrice 0 for unavailable names; only surface a\n // meaningful (positive) registration price.\n if (typeof price === 'number' && Number.isFinite(price) && price > 0) {\n result.price = price;\n result.currency = 'USD';\n }\n results.push(result);\n }\n return results;\n }\n\n // --- write operations ---------------------------------------------------\n\n override lockDomain(domainName: string, opts?: RequestOptions): Promise<OperationResult> {\n return this.setDomainFlag(domainName, { Locked: true }, 'Domain locked successfully', opts);\n }\n\n override unlockDomain(domainName: string, opts?: RequestOptions): Promise<OperationResult> {\n return this.setDomainFlag(domainName, { Locked: false }, 'Domain unlocked successfully', opts);\n }\n\n override setAutoRenew(\n domainName: string,\n enabled: boolean,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.setDomainFlag(\n domainName,\n { AutoRenew: enabled },\n `Auto-renew ${enabled ? 'enabled' : 'disabled'} successfully`,\n opts\n );\n }\n\n override setPrivacy(\n domainName: string,\n enabled: boolean,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.setDomainFlag(\n domainName,\n { WhoIsPrivacy: enabled },\n `WHOIS privacy ${enabled ? 'enabled' : 'disabled'} successfully`,\n opts\n );\n }\n\n /**\n * Registers a domain via the `purchase/register` order endpoint. NameBright's\n * request carries only the name + term; nameservers, privacy, auto-renew, and\n * contacts aren't part of registration (they use account defaults and the\n * per-flag/nameserver endpoints afterwards). Spends real money — built from the\n * documented shape, not exercised against the live account.\n */\n override registerDomain(\n domainName: string,\n input: RegisterDomainInput,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.purchase('register', domainName, input.years ?? 1, 'registered', opts);\n }\n\n override renewDomain(\n domainName: string,\n years = 1,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.purchase('renew', domainName, years, 'renewed', opts);\n }\n\n // POST an order to purchase/{register|renew}. Both take the same body and\n // return an order (OrderId + TotalPrice); a returned OrderId signals success.\n private async purchase(\n operation: 'register' | 'renew',\n domainName: string,\n years: number,\n verb: string,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n try {\n const order = await this.authed<NbOrder>(\n {\n method: 'POST',\n path: `purchase/${operation}`,\n body: { DomainName: domainName, Years: years, CategoryId: 0, CategoryName: null },\n },\n opts\n );\n if (order?.OrderId == null) {\n return { success: false, message: `NameBright: ${operation} returned no order id` };\n }\n return {\n success: true,\n message: `Domain ${domainName} ${verb} successfully (order ${order.OrderId})`,\n };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n /**\n * Update one of the boolean domain flags (Locked / AutoRenew / WhoIsPrivacy)\n * via the shared PUT account/domains/{domain}. That endpoint takes the full\n * AccountDomain body, so we first GET the current record and merge the change\n * over it — sending a bare `{ Locked: true }` would otherwise reset the other\n * flags to their defaults. We deliberately drop AuthCode from the round-trip.\n */\n private async setDomainFlag(\n domainName: string,\n change: Partial<Pick<NbDomain, 'Locked' | 'AutoRenew' | 'WhoIsPrivacy'>>,\n successMessage: string,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n try {\n const path = `account/domains/${encodeURIComponent(domainName)}`;\n const current = await this.authed<NbDomain & { Category?: string; UpgradedDomain?: boolean }>(\n { path },\n opts\n );\n const body = {\n DomainName: current.DomainName,\n Status: current.Status,\n ExpirationDate: current.ExpirationDate,\n Locked: current.Locked ?? false,\n AutoRenew: current.AutoRenew ?? false,\n WhoIsPrivacy: current.WhoIsPrivacy ?? false,\n Category: current.Category,\n UpgradedDomain: current.UpgradedDomain,\n ...change,\n };\n await this.authed({ method: 'PUT', path, body }, opts);\n return { success: true, message: successMessage };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n /**\n * Replace the domain's nameservers. NameBright has no bulk set: remove all\n * existing servers, then PUT each new one (the server is a path segment, with\n * no request body).\n *\n * NOTE: built from the documented endpoints but not live-verified — there is\n * no safe way to test nameserver replacement against a live production domain.\n */\n override async updateNameservers(\n domainName: string,\n nameservers: string[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n try {\n const base = `account/domains/${encodeURIComponent(domainName)}/nameservers`;\n await this.authed({ method: 'DELETE', path: base }, opts);\n for (const ns of nameservers) {\n await this.authed({ method: 'PUT', path: `${base}/${encodeURIComponent(ns)}` }, opts);\n }\n return { success: true, message: 'Nameservers updated successfully' };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n /**\n * Replace the domain's DNS host records with `records` (desired-state\n * semantics). NameBright manages records individually — per-type POST to\n * create, DELETE by RecordId to remove — with no bulk set, so we diff against\n * the current records: delete the ones no longer wanted and create the ones\n * that are new, leaving unchanged records in place. (A blind delete-all +\n * re-create trips NameBright's flaky \"Duplicate host record\" check when a\n * record is deleted and immediately re-posted, so the diff both avoids that\n * and skips needless churn.) NameBright supports no per-record TTL, so `ttl`\n * is ignored.\n */\n override async setDnsRecords(\n domainName: string,\n records: DnsRecord[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n try {\n const base = `account/domains/${encodeURIComponent(domainName)}/hostrecords`;\n const current = flattenHostRecords(\n await this.authed<NbHostRecords>({ path: `${base}/all` }, opts)\n );\n\n const desiredKeys = new Set(records.map(dnsRecordKey));\n const currentKeys = new Set(current.map(e => dnsRecordKey(e.record)));\n\n // delete records that are present now but not desired\n for (const e of current) {\n if (e.recordId != null && !desiredKeys.has(dnsRecordKey(e.record))) {\n await this.authed({ method: 'DELETE', path: `${base}/${e.segment}/${e.recordId}` }, opts);\n }\n }\n // create desired records that aren't already present\n for (const r of records) {\n if (!currentKeys.has(dnsRecordKey(r))) {\n const { segment, body } = toNbHostRecord(r);\n await this.authed({ method: 'POST', path: `${base}/${segment}`, body }, opts);\n }\n }\n return { success: true, message: 'DNS records updated successfully' };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n // map a NameBright domain object (from list or single-domain endpoints) to the\n // normalized Domain shape. Neither endpoint returns nameservers.\n private toDomain(d: NbDomain): Domain {\n return createDomain({\n domainName: d.DomainName ?? d.domain,\n registrar: this.name,\n status: d.Status ?? 'ok',\n createdDate: d.RegistrationDate,\n expirationDate: d.ExpirationDate,\n renewalDate: d.ExpirationDate,\n autoRenew: d.AutoRenew ?? false,\n locked: d.Locked ?? false,\n privacy: d.WhoIsPrivacy ?? false,\n nameservers: [],\n });\n }\n}\n\n// map a NameBright contact object to the normalized Contact (undefined if the\n// role isn't present). NameBright splits the phone into country code + number.\nfunction fromNbContact(c: NbContact | undefined): Contact | undefined {\n if (!c) return undefined;\n return {\n firstName: c.FirstName ?? '',\n lastName: c.LastName ?? '',\n organization: c.Organization ? String(c.Organization) : undefined,\n email: c.Email ?? '',\n phone: joinPhone(c.PhoneCountry, c.Phone),\n fax: c.Fax ? joinPhone(c.FaxCountry, c.Fax) : undefined,\n address1: c.Address1 ?? '',\n address2: c.Address2 ? String(c.Address2) : undefined,\n city: c.City ?? '',\n state: c.Region ?? '',\n postalCode: c.PostalCode ?? '',\n country: c.Country ?? '',\n };\n}\n\n// flatten NameBright's per-type host-record groups into generic DnsRecords,\n// preserving each record's endpoint segment and RecordId so callers can address\n// it for deletion. Order is stable (A, AAAA, CNAME, MX, TXT, SRV).\ninterface FlatHostRecord {\n record: DnsRecord;\n segment: string;\n recordId?: number;\n}\nfunction flattenHostRecords(res: NbHostRecords): FlatHostRecord[] {\n const out: FlatHostRecord[] = [];\n for (const r of res.ARecords ?? []) {\n out.push({\n record: { type: 'A', name: r.Subdomain ?? '@', value: r.IPV4Address ?? '' },\n segment: 'a',\n recordId: r.RecordId,\n });\n }\n for (const r of res.AAAARecords ?? []) {\n out.push({\n record: { type: 'AAAA', name: r.Subdomain ?? '@', value: r.IPV6Address ?? '' },\n segment: 'aaaa',\n recordId: r.RecordId,\n });\n }\n for (const r of res.CNAMERecords ?? []) {\n out.push({\n record: { type: 'CNAME', name: r.Subdomain ?? '@', value: r.RedirectDomain ?? '' },\n segment: 'cname',\n recordId: r.RecordId,\n });\n }\n for (const r of res.MXRecords ?? []) {\n const record: DnsRecord = { type: 'MX', name: r.Subdomain ?? '@', value: r.MailServer ?? '' };\n if (r.Priority != null) record.priority = r.Priority;\n out.push({ record, segment: 'mx', recordId: r.RecordId });\n }\n for (const r of res.TXTRecords ?? []) {\n out.push({\n record: { type: 'TXT', name: r.Subdomain ?? '@', value: r.TextRecord ?? '' },\n segment: 'txt',\n recordId: r.RecordId,\n });\n }\n for (const r of res.SRVRecords ?? []) {\n // NameBright splits SRV into service/protocol; recompose the standard\n // \"_service._protocol\" name that our generic record carries.\n const name = [r.Service, r.Protocol].filter(Boolean).join('.') || '@';\n const record: DnsRecord = { type: 'SRV', name, value: r.Target ?? '' };\n if (r.Priority != null) record.priority = r.Priority;\n if (r.Weight != null) record.weight = r.Weight;\n if (r.Port != null) record.port = r.Port;\n out.push({ record, segment: 'srv', recordId: r.RecordId });\n }\n return out;\n}\n\n// canonical identity of a DNS record for diffing (ignores TTL, which NameBright\n// doesn't store). Two records with the same key are considered equal.\nfunction dnsRecordKey(r: DnsRecord): string {\n return [\n r.type.toUpperCase(),\n r.name || '@',\n r.value,\n r.priority ?? '',\n r.weight ?? '',\n r.port ?? '',\n ].join('|');\n}\n\n// map a generic DnsRecord to NameBright's per-type POST endpoint segment and\n// request body. The record's `name` is the subdomain (\"@\" for the apex); TTL is\n// unsupported by NameBright and ignored. Throws on record types NameBright's\n// host-record API does not expose.\nfunction toNbHostRecord(r: DnsRecord): { segment: string; body: Record<string, unknown> } {\n const type = r.type.toUpperCase();\n const subdomain = r.name || '@';\n switch (type) {\n case 'A':\n return { segment: 'a', body: { Subdomain: subdomain, IPV4Address: r.value } };\n case 'AAAA':\n return { segment: 'aaaa', body: { Subdomain: subdomain, IPV6Address: r.value } };\n case 'CNAME':\n return { segment: 'cname', body: { Subdomain: subdomain, RedirectDomain: r.value } };\n case 'MX':\n return {\n segment: 'mx',\n body: { Subdomain: subdomain, MailServer: r.value, Priority: r.priority ?? 10 },\n };\n case 'TXT':\n return { segment: 'txt', body: { Subdomain: subdomain, TextRecord: r.value } };\n case 'SRV': {\n // our generic name carries \"_service._protocol\"; NameBright splits them.\n const [service, protocol] = r.name.split('.');\n return {\n segment: 'srv',\n body: {\n Service: service,\n Protocol: protocol,\n Priority: r.priority ?? 0,\n Weight: r.weight ?? 0,\n Port: r.port ?? 0,\n Target: r.value,\n },\n };\n }\n default:\n throw new Error(`NameBright: unsupported DNS record type \"${r.type}\"`);\n }\n}\n\n// combine a country-code part and a local number into \"+<cc>.<number>\" form,\n// leaving an already-complete number untouched when no country code is given.\n// NameBright returns PhoneCountry/FaxCountry as numbers (e.g. 1), so coerce to\n// string before trimming.\nfunction joinPhone(\n countryCode: string | number | undefined,\n number: string | number | undefined\n): string {\n const num = String(number ?? '').trim();\n const cc = String(countryCode ?? '')\n .trim()\n .replace(/^\\+/, '');\n if (!cc) return num;\n if (!num) return cc ? `+${cc}` : '';\n return `+${cc}.${num}`;\n}\n","import { XMLParser, type X2jOptions } from 'fast-xml-parser';\nimport { ParsingError } from './errors';\n\n// Shared XML parsing for registrar APIs that speak XML (e.g. Namecheap, Enom).\n// fast-xml-parser is pure JS with no Node built-ins, so this stays safe in\n// browsers, Cloudflare Workers, Deno, Bun, and Node.\n\n// default options applied to all registrar XML responses:\n// - attributes are kept (prefixed with `@_`)\n// - values are left as raw strings; providers coerce them explicitly, so a\n// ZIP like \"01234\" or a flag like \"true\" never changes type unexpectedly\nconst DEFAULT_XML_OPTIONS: Partial<X2jOptions> = {\n ignoreAttributes: false,\n attributeNamePrefix: '@_',\n textNodeName: '#text',\n parseAttributeValue: false,\n parseTagValue: false,\n trimValues: true,\n};\n\n// parse an XML string into a plain object, throwing ParsingError on failure\nexport function parseXml<T = unknown>(xml: string, options?: Partial<X2jOptions>): T {\n try {\n const parser = new XMLParser({ ...DEFAULT_XML_OPTIONS, ...options });\n return parser.parse(xml) as T;\n } catch (error) {\n throw new ParsingError(\n `Failed to parse XML: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n}\n\n// coerce a value that may be a single item or an array into an array.\n// XML parsers collapse a single repeated element into one object; this\n// normalizes both cases to an array.\nexport function ensureArray<T>(value: T | T[] | undefined | null): T[] {\n if (value == null) return [];\n return Array.isArray(value) ? value : [value];\n}\n","import type {\n ConfigField,\n ConnectionResult,\n Contact,\n ContactSet,\n DnsRecord,\n Domain,\n DomainAvailability,\n DomainForward,\n DomainForwardType,\n EmailForward,\n ListDomainsOptions,\n OperationResult,\n RegisterDomainInput,\n RegistrarOptions,\n RequestOptions,\n TldPricing,\n TransferDomainInput,\n} from '../types';\nimport {\n createDomain,\n filterDomains,\n normalizeDomain,\n requireConsent,\n settableForwards,\n} from '../utils';\nimport { toRegistrarError } from '../errors';\nimport { ensureArray, parseXml } from '../xml';\nimport { BaseRegistrar, selectBaseUrl } from '../registrar';\nimport { Feature, type RegistrarFeature } from '../features';\nimport type { RegistrarCredentials } from '../types';\n\n// shape of a Namecheap XML response (attributes prefixed with `@_`, text `#text`)\ninterface NcError {\n '#text'?: string;\n '@_Number'?: string;\n}\n\ninterface NcDomainEl {\n '@_Name'?: string;\n '@_Created'?: string;\n '@_Expires'?: string;\n '@_AutoRenew'?: string;\n '@_IsLocked'?: string;\n '@_WhoisGuard'?: string;\n}\n\n// namecheap.domains.getInfo result\ninterface NcGetInfoResult {\n '@_Status'?: string;\n '@_DomainName'?: string;\n 'DomainDetails'?: { CreatedDate?: string; ExpiredDate?: string };\n 'Whoisguard'?: { '@_Enabled'?: string; 'ID'?: string | number };\n}\n\n// namecheap.domains.check result element (attributes only)\ninterface NcCheckEl {\n '@_Domain'?: string;\n '@_Available'?: string;\n '@_IsPremiumName'?: string;\n '@_PremiumRegistrationPrice'?: string;\n}\n\n// a contact group in namecheap.domains.getContacts (children are text elements)\ninterface NcContactEl {\n OrganizationName?: string;\n FirstName?: string;\n LastName?: string;\n Address1?: string;\n Address2?: string;\n City?: string;\n StateProvince?: string;\n PostalCode?: string;\n Country?: string;\n Phone?: string;\n Fax?: string;\n EmailAddress?: string;\n}\n\n// a <Forward mailbox=\"alias\">destination</Forward> in\n// namecheap.domains.dns.getEmailForwarding\ninterface NcForwardEl {\n '@_mailbox'?: string;\n '#text'?: string;\n}\n\n// a host record in namecheap.domains.dns.getHosts (attributes only)\ninterface NcHostEl {\n '@_Name'?: string;\n '@_Type'?: string;\n '@_Address'?: string;\n '@_MXPref'?: string;\n '@_TTL'?: string;\n}\n\n// namecheap.users.getPricing is ProductType > ProductCategory > Product > Price\ninterface NcPriceEl {\n '@_Duration'?: string;\n '@_DurationType'?: string;\n '@_Price'?: string;\n '@_Currency'?: string;\n}\ninterface NcProductEl {\n '@_Name'?: string;\n 'Price'?: NcPriceEl | NcPriceEl[];\n}\ninterface NcProductCategoryEl {\n '@_Name'?: string;\n 'Product'?: NcProductEl | NcProductEl[];\n}\ninterface NcProductTypeEl {\n '@_Name'?: string;\n 'ProductCategory'?: NcProductCategoryEl | NcProductCategoryEl[];\n}\n\ninterface NcCommandResponse {\n DomainGetListResult?: { Domain?: NcDomainEl | NcDomainEl[] };\n DomainCheckResult?: NcCheckEl | NcCheckEl[];\n DomainGetInfoResult?: NcGetInfoResult;\n DomainDNSGetListResult?: {\n '@_Domain'?: string;\n '@_IsUsingOurDNS'?: string;\n 'Nameserver'?: string | string[];\n };\n // the docs show <Host>, but the live API has historically returned <host>\n DomainDNSGetHostsResult?: { Host?: NcHostEl | NcHostEl[]; host?: NcHostEl | NcHostEl[] };\n DomainDNSGetEmailForwardingResult?: {\n '@_Domain'?: string;\n 'Forward'?: NcForwardEl | NcForwardEl[];\n };\n DomainContactsResult?: {\n Registrant?: NcContactEl;\n Admin?: NcContactEl;\n Tech?: NcContactEl;\n AuxBilling?: NcContactEl;\n };\n UserGetPricingResult?: { ProductType?: NcProductTypeEl | NcProductTypeEl[] };\n // namecheap.domains.getRegistrarLock — the authoritative per-domain lock state\n DomainGetRegistrarLockResult?: { '@_RegistrarLockStatus'?: string };\n // namecheap.domains.setAutoRenew result (carries its own IsSuccess flag)\n SetAutoRenewResult?: { '@_IsSuccess'?: string };\n}\n\ninterface NcResponse {\n ApiResponse?: {\n '@_Status'?: string;\n 'Errors'?: { Error?: NcError | NcError[] | string };\n 'CommandResponse'?: NcCommandResponse;\n };\n}\n\n// Namecheap caps domains.check at 50 domains per request\nconst CHECK_BATCH_SIZE = 50;\n// the four contact roles Namecheap requires on every setContacts call, mapped\n// to our ContactSet keys (Namecheap calls the billing role \"AuxBilling\")\nconst NC_CONTACT_ROLES = [\n { prefix: 'Registrant', key: 'registrant' },\n { prefix: 'Admin', key: 'admin' },\n { prefix: 'Tech', key: 'tech' },\n { prefix: 'AuxBilling', key: 'billing' },\n] as const;\n\n/**\n * Namecheap Registrar\n * API docs: https://www.namecheap.com/support/api/intro/\n *\n * Credentials: enable API access under Profile > Tools > API Access, generate\n * an API key, and whitelist the IP(s) requests will originate from (Namecheap\n * enforces IP whitelisting). Supply that whitelisted IP as `clientIp`.\n *\n * Namecheap authenticates via query-string parameters (ApiUser, ApiKey,\n * UserName, ClientIp) and responds with XML — including for errors, which come\n * back as `<Errors>` nodes inside a 200 OK envelope, so success is read from the\n * root `Status=\"OK\"` attribute (`isOk`), not the HTTP status. XML is parsed via\n * the shared `parseXml` helper (fast-xml-parser).\n *\n * `setAutoRenew` uses `namecheap.domains.setAutoRenew` (DomainName + IsAutoRenew).\n * The command isn't in Namecheap's published method index but is live and keys on\n * DomainName (an SLD/TLD form is rejected); it returns its own `IsSuccess` flag,\n * which this reads rather than the envelope status.\n *\n * `registerDomain`/`transferIn` are implemented and require per-call `consent`;\n * they spend real money and are documented-but-unverified. Registration sends the\n * full four-role contact set but not yet per-TLD extended attributes (.us, .eu,\n * …), so those TLDs aren't supported for registration.\n */\nexport class NamecheapRegistrar extends BaseRegistrar {\n readonly name = 'namecheap';\n\n static readonly displayName = 'Namecheap';\n static readonly helpText =\n 'Enable API access in your Namecheap account under Profile > Tools > API Access, ' +\n 'generate an API key, and whitelist your request IP(s) in the API settings. ' +\n 'Provide the whitelisted IP as the Client IP field.';\n static readonly configFields: ConfigField[] = [\n { name: 'username', label: 'Username', type: 'text', required: true },\n { name: 'apiKey', label: 'API Key', type: 'password', required: true },\n { name: 'clientIp', label: 'Client IP', type: 'text', required: false, default: '0.0.0.0' },\n ];\n // Namecheap runs a sandbox at api.sandbox.namecheap.com (separate account at\n // sandbox.namecheap.com with its own API key)\n static readonly supportsSandbox = true;\n // XML API. Beyond core, read+write alias-style email forwarding (via the\n // dedicated dns.getEmailForwarding/setEmailForwarding commands) and URL/domain\n // forwarding (URL/URL301/FRAME host records, read+written through the host set).\n // No DNSSEC or webhooks; auth-code retrieval and glue records are dashboard-\n // gated / unconfirmed, so they're left undeclared until verified live.\n static readonly extendedFeatures: readonly RegistrarFeature[] = [\n Feature.GetEmailForwarding,\n Feature.SetEmailForwarding,\n Feature.GetDomainForwarding,\n Feature.SetDomainForwarding,\n ];\n\n constructor(credentials: RegistrarCredentials, options?: RegistrarOptions) {\n super(\n credentials,\n {\n baseUrl: selectBaseUrl('Namecheap', options?.environment, {\n production: 'https://api.namecheap.com/xml.response',\n sandbox: 'https://api.sandbox.namecheap.com/xml.response',\n }),\n },\n options\n );\n }\n\n // common query parameters (credentials + command) for every Namecheap call\n private baseQuery(command: string, extra: Record<string, string> = {}): Record<string, string> {\n return {\n ApiUser: this.credentials.username,\n ApiKey: this.credentials.apiKey,\n UserName: this.credentials.username,\n // Namecheap validates against whitelisted IPs configured in the account\n ClientIp: this.credentials.clientIp || '0.0.0.0',\n Command: command,\n ...extra,\n };\n }\n\n // issue a command and parse the XML response\n private async call(\n command: string,\n extra: Record<string, string>,\n opts?: RequestOptions\n ): Promise<NcResponse> {\n const xml = await this.http.requestText({\n path: '',\n query: this.baseQuery(command, extra),\n ...opts,\n });\n return parseXml<NcResponse>(xml);\n }\n\n // issue a command and return its CommandResponse, throwing on an error status\n private async command(\n command: string,\n extra: Record<string, string>,\n opts?: RequestOptions\n ): Promise<NcCommandResponse> {\n const res = await this.call(command, extra, opts);\n if (!isOk(res)) throw new Error(errorText(res) ?? 'Namecheap API request failed');\n return res.ApiResponse?.CommandResponse ?? {};\n }\n\n override async testConnection(opts?: RequestOptions): Promise<ConnectionResult> {\n try {\n const res = await this.call('namecheap.domains.getList', {}, opts);\n return isOk(res)\n ? { success: true, message: 'Connection successful' }\n : { success: false, message: errorText(res) ?? 'Unknown error' };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n override async listDomains(opts?: ListDomainsOptions): Promise<Domain[]> {\n const { search, ...reqOpts } = opts ?? {};\n const domains: Domain[] = [];\n const perPage = 100; // Namecheap PageSize maximum (10..100)\n // `SearchTerm` filters by name substring server-side.\n const searchTerm = search?.trim();\n let page = 1;\n let hasMore = true;\n\n while (hasMore) {\n const cr = await this.command(\n 'namecheap.domains.getList',\n {\n PageSize: String(perPage),\n Page: String(page),\n ...(searchTerm ? { SearchTerm: searchTerm } : {}),\n },\n reqOpts\n );\n\n const elements = ensureArray(cr.DomainGetListResult?.Domain);\n for (const d of elements) {\n domains.push(\n createDomain({\n domainName: d['@_Name'],\n registrar: this.name,\n status: 'ok', // the list endpoint does not return a per-domain status\n createdDate: d['@_Created'],\n expirationDate: d['@_Expires'],\n renewalDate: d['@_Expires'],\n autoRenew: d['@_AutoRenew'] === 'true',\n locked: d['@_IsLocked'] === 'true',\n privacy: d['@_WhoisGuard'] === 'ENABLED',\n nameservers: [], // the list endpoint does not return nameservers\n })\n );\n }\n\n hasMore = elements.length === perPage;\n page++;\n }\n return filterDomains(domains, search);\n }\n\n /**\n * getInfo carries status, dates, and WhoisGuard state but not nameservers, so\n * `nameservers` comes back empty here — use `getNameservers` (dns.getList) for\n * those. The registrar transfer-lock flag isn't in getInfo either (its `Status`\n * reflects the domain lifecycle, e.g. \"Ok\"/\"Expired\", not the transfer lock),\n * so `locked` is read from the dedicated `getRegistrarLock` command, which is\n * the authoritative real-time source (getList's per-row `IsLocked` can lag —\n * confirmed stale in the sandbox after a lock the API had already applied).\n */\n override async getDomain(domainName: string, opts?: RequestOptions): Promise<Domain> {\n const cr = await this.command('namecheap.domains.getInfo', { DomainName: domainName }, opts);\n const info = cr.DomainGetInfoResult ?? {};\n const status = info['@_Status'] ?? '';\n return createDomain({\n domainName: info['@_DomainName'] ?? domainName,\n registrar: this.name,\n status,\n createdDate: info.DomainDetails?.CreatedDate,\n expirationDate: info.DomainDetails?.ExpiredDate,\n renewalDate: info.DomainDetails?.ExpiredDate,\n locked: await this.getRegistrarLock(domainName, opts),\n privacy: (info.Whoisguard?.['@_Enabled'] ?? '').toLowerCase() === 'true',\n nameservers: [],\n });\n }\n\n /**\n * Reads the registrar transfer-lock flag for a single domain via the dedicated\n * `getRegistrarLock` command (`RegistrarLockStatus`). getInfo doesn't expose the\n * lock, and getList's per-row `IsLocked` can lag the real state — verified live:\n * after a lock the API reported as applied, getList still showed `IsLocked=false`\n * while getRegistrarLock correctly returned `RegistrarLockStatus=true`.\n */\n private async getRegistrarLock(domainName: string, opts?: RequestOptions): Promise<boolean> {\n const cr = await this.command(\n 'namecheap.domains.getRegistrarLock',\n { DomainName: normalizeDomain(domainName) },\n opts\n );\n return cr.DomainGetRegistrarLockResult?.['@_RegistrarLockStatus'] === 'true';\n }\n\n /**\n * Availability via domains.check (batched at 50 per request, Namecheap's cap).\n * The check response only carries a price for *premium* names\n * (`PremiumRegistrationPrice`); regular registration pricing comes from\n * `getPricing`, so `price` is set only for premium results.\n */\n override async checkAvailability(\n domainNames: string[],\n opts?: RequestOptions\n ): Promise<DomainAvailability[]> {\n const results: DomainAvailability[] = [];\n for (let i = 0; i < domainNames.length; i += CHECK_BATCH_SIZE) {\n const batch = domainNames.slice(i, i + CHECK_BATCH_SIZE);\n const cr = await this.command(\n 'namecheap.domains.check',\n { DomainList: batch.join(',') },\n opts\n );\n for (const el of ensureArray(cr.DomainCheckResult)) {\n const premium = el['@_IsPremiumName'] === 'true';\n const premiumPrice = premium ? Number(el['@_PremiumRegistrationPrice']) : NaN;\n results.push({\n domainName: el['@_Domain'] ?? '',\n available: el['@_Available'] === 'true',\n premium,\n price: Number.isFinite(premiumPrice) && premiumPrice > 0 ? premiumPrice : undefined,\n });\n }\n }\n return results;\n }\n\n /**\n * Per-TLD pricing via users.getPricing — unlike GoDaddy/Dynadot, Namecheap has\n * a real price table, so a bare TLD works (a full domain is reduced to its\n * TLD). Reads the 1-year register/renew/transfer prices.\n */\n override async getPricing(tldOrDomain: string, opts?: RequestOptions): Promise<TldPricing> {\n const tld = (\n tldOrDomain.includes('.') ? tldOrDomain.slice(tldOrDomain.indexOf('.') + 1) : tldOrDomain\n ).toLowerCase();\n\n const cr = await this.command(\n 'namecheap.users.getPricing',\n { ProductType: 'DOMAIN', ProductName: tld },\n opts\n );\n const categories = ensureArray(\n ensureArray(cr.UserGetPricingResult?.ProductType)[0]?.ProductCategory\n );\n\n // find the 1-year Price for a given action category (REGISTER/RENEW/TRANSFER)\n const findPrice = (action: string): NcPriceEl | undefined => {\n const category = categories.find(c => c['@_Name']?.toUpperCase() === action);\n const product = ensureArray(category?.Product).find(p => p['@_Name']?.toLowerCase() === tld);\n const prices = ensureArray(product?.Price);\n return prices.find(p => p['@_Duration'] === '1') ?? prices[0];\n };\n\n const register = findPrice('REGISTER');\n const renew = findPrice('RENEW');\n const transfer = findPrice('TRANSFER');\n return {\n tld,\n currency: register?.['@_Currency'] ?? renew?.['@_Currency'] ?? 'USD',\n registration: toPrice(register),\n renewal: toPrice(renew),\n transfer: toPrice(transfer),\n };\n }\n\n /**\n * Registers a domain via domains.create, which requires all four contact roles\n * (omitted roles fall back to the registrant) and toggles free WhoisGuard when\n * privacy is requested. Note: TLDs that need per-TLD extended attributes (.us,\n * .eu, .ca, …) are not yet supported — those params aren't sent.\n */\n override async registerDomain(\n domainName: string,\n input: RegisterDomainInput,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n requireConsent(this.name, input.consent);\n const registrant = input.contacts.registrant;\n if (!registrant) {\n throw new Error(`${this.name}: registration requires at least a registrant contact`);\n }\n const params: Record<string, string> = {\n DomainName: domainName,\n Years: String(input.years ?? 1),\n };\n for (const { prefix, key } of NC_CONTACT_ROLES) {\n Object.assign(params, toNcContactParams(prefix, input.contacts[key] ?? registrant));\n }\n if (input.nameservers?.length) params.Nameservers = input.nameservers.join(',');\n if (input.privacy) {\n params.AddFreeWhoisguard = 'yes';\n params.WGEnabled = 'yes';\n }\n const res = await this.call('namecheap.domains.create', params, opts);\n return statusResult(res);\n }\n\n /**\n * Transfers a domain in via domains.transfer.create. Namecheap takes no\n * contacts on transfer (the existing registrant's carry over); it needs the\n * auth code as `EPPCode` and a `Years` of 1. Note: the privacy-enable param is\n * `WGenable` here (lowercase), unlike `WGEnabled` on create.\n */\n override async transferIn(\n domainName: string,\n input: TransferDomainInput,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n requireConsent(this.name, input.consent);\n const params: Record<string, string> = {\n DomainName: domainName,\n Years: String(input.years ?? 1),\n EPPCode: input.authCode,\n };\n if (input.privacy != null) {\n params.AddFreeWhoisguard = input.privacy ? 'yes' : 'no';\n params.WGenable = input.privacy ? 'yes' : 'no';\n }\n const res = await this.call('namecheap.domains.transfer.create', params, opts);\n return statusResult(res);\n }\n\n override async renewDomain(\n domainName: string,\n years = 1,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const res = await this.call(\n 'namecheap.domains.renew',\n { DomainName: domainName, Years: String(years) },\n opts\n );\n return statusResult(res);\n }\n\n /**\n * Toggles auto-renew via `namecheap.domains.setAutoRenew`. The command carries\n * its own `IsSuccess` flag inside an otherwise-OK envelope (a malformed request\n * comes back `Status=\"OK\"` with `IsSuccess=\"false\"`), so success is read from\n * that flag, not the envelope status.\n */\n override async setAutoRenew(\n domainName: string,\n enabled: boolean,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const cr = await this.command(\n 'namecheap.domains.setAutoRenew',\n { DomainName: domainName, IsAutoRenew: enabled ? 'true' : 'false' },\n opts\n );\n if (cr.SetAutoRenewResult?.['@_IsSuccess'] === 'true') {\n return { success: true, message: 'OK' };\n }\n return { success: false, message: `Failed to ${enabled ? 'enable' : 'disable'} auto-renew` };\n }\n\n override async getNameservers(domainName: string, opts?: RequestOptions): Promise<string[]> {\n const { sld, tld } = splitDomain(domainName);\n const cr = await this.command('namecheap.domains.dns.getList', { SLD: sld, TLD: tld }, opts);\n return ensureArray(cr.DomainDNSGetListResult?.Nameserver).map(String);\n }\n\n override async updateNameservers(\n domainName: string,\n nameservers: string[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n if (nameservers.length < 2 || nameservers.length > 12) {\n throw new Error('Namecheap requires 2-12 nameservers');\n }\n const { sld, tld } = splitDomain(domainName);\n const res = await this.call(\n 'namecheap.domains.dns.setCustom',\n { SLD: sld, TLD: tld, Nameservers: nameservers.join(',') },\n opts\n );\n return statusResult(res);\n }\n\n override async lockDomain(domainName: string, opts?: RequestOptions): Promise<OperationResult> {\n const res = await this.call(\n 'namecheap.domains.setRegistrarLock',\n { DomainName: domainName, LockAction: 'LOCK' },\n opts\n );\n return statusResult(res);\n }\n\n override async unlockDomain(domainName: string, opts?: RequestOptions): Promise<OperationResult> {\n const res = await this.call(\n 'namecheap.domains.setRegistrarLock',\n { DomainName: domainName, LockAction: 'UNLOCK' },\n opts\n );\n return statusResult(res);\n }\n\n /**\n * Toggles WhoisGuard (Namecheap's domain privacy), which is a separate entity\n * keyed by a numeric `WhoisguardID` (read from getInfo). Enabling additionally\n * needs a `ForwardedToEmail` — the address WhoisGuard-masked mail is relayed to\n * — which is taken from the domain's registrant contact. Throws if the domain\n * has no WhoisGuard allotted (e.g. TLDs that don't offer it).\n */\n override async setPrivacy(\n domainName: string,\n enabled: boolean,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const cr = await this.command('namecheap.domains.getInfo', { DomainName: domainName }, opts);\n const id = cr.DomainGetInfoResult?.Whoisguard?.ID;\n if (id == null || String(id) === '0') {\n throw new Error(`${this.name}: ${domainName} has no WhoisGuard subscription to toggle`);\n }\n if (!enabled) {\n const res = await this.call(\n 'namecheap.whoisguard.disable',\n { WhoisguardID: String(id) },\n opts\n );\n return statusResult(res);\n }\n // enabling requires a forwarding address — use the registrant's email\n const contacts = await this.getContacts(domainName, opts);\n const email = contacts.registrant?.email || contacts.admin?.email;\n if (!email) {\n throw new Error(\n `${this.name}: cannot enable WhoisGuard without a registrant email to forward to`\n );\n }\n const res = await this.call(\n 'namecheap.whoisguard.enable',\n { WhoisguardID: String(id), ForwardedToEmail: email },\n opts\n );\n return statusResult(res);\n }\n\n override async getContacts(domainName: string, opts?: RequestOptions): Promise<ContactSet> {\n const cr = await this.command(\n 'namecheap.domains.getContacts',\n { DomainName: domainName },\n opts\n );\n const result = cr.DomainContactsResult ?? {};\n return {\n registrant: fromNcContact(result.Registrant),\n admin: fromNcContact(result.Admin),\n tech: fromNcContact(result.Tech),\n billing: fromNcContact(result.AuxBilling),\n };\n }\n\n /**\n * Namecheap's setContacts requires all four roles (Registrant/Admin/Tech/\n * AuxBilling) on every call, so any role the caller omits falls back to the\n * registrant. A registrant is therefore mandatory.\n */\n override async updateContacts(\n domainName: string,\n contacts: ContactSet,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const registrant = contacts.registrant;\n if (!registrant) {\n throw new Error('Namecheap updateContacts requires at least a registrant contact');\n }\n const params: Record<string, string> = { DomainName: domainName };\n for (const { prefix, key } of NC_CONTACT_ROLES) {\n Object.assign(params, toNcContactParams(prefix, contacts[key] ?? registrant));\n }\n const res = await this.call('namecheap.domains.setContacts', params, opts);\n return statusResult(res);\n }\n\n override async getDnsRecords(domainName: string, opts?: RequestOptions): Promise<DnsRecord[]> {\n const { sld, tld } = splitDomain(domainName);\n const cr = await this.command('namecheap.domains.dns.getHosts', { SLD: sld, TLD: tld }, opts);\n const result = cr.DomainDNSGetHostsResult ?? {};\n // the docs show <Host> but the live API has historically returned <host>\n const hosts = ensureArray(result.Host ?? result.host);\n return hosts.map(h => {\n const type = (h['@_Type'] ?? '').toUpperCase();\n const record: DnsRecord = {\n type,\n name: h['@_Name'] ?? '',\n value: h['@_Address'] ?? '',\n };\n if (h['@_TTL'] != null) record.ttl = Number(h['@_TTL']);\n if (type === 'MX' && h['@_MXPref'] != null) record.priority = Number(h['@_MXPref']);\n return record;\n });\n }\n\n /**\n * Replaces the entire record set via dns.setHosts (full-replace: any record\n * not sent is removed). Host params are 1-indexed. `EmailType` is set to `MX`\n * when MX records are present so mail routing follows the records; otherwise\n * it's omitted to leave Namecheap's default.\n */\n override async setDnsRecords(\n domainName: string,\n records: DnsRecord[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const { sld, tld } = splitDomain(domainName);\n const params: Record<string, string> = { SLD: sld, TLD: tld };\n let hasMx = false;\n\n records.forEach((r, idx) => {\n const n = idx + 1; // Namecheap host params are 1-based\n const type = r.type.toUpperCase();\n params[`HostName${n}`] = r.name || '@';\n params[`RecordType${n}`] = type;\n params[`Address${n}`] = r.value;\n if (type === 'MX') {\n hasMx = true;\n params[`MXPref${n}`] = String(r.priority ?? 10);\n }\n if (r.ttl != null) params[`TTL${n}`] = String(r.ttl);\n });\n if (hasMx) params.EmailType = 'MX';\n\n const res = await this.call('namecheap.domains.dns.setHosts', params, opts);\n return statusResult(res);\n }\n\n // --- extended: email forwarding ---\n\n override async getEmailForwarding(\n domainName: string,\n opts?: RequestOptions\n ): Promise<EmailForward[]> {\n const cr = await this.command(\n 'namecheap.domains.dns.getEmailForwarding',\n { DomainName: domainName },\n opts\n );\n return ensureArray(cr.DomainDNSGetEmailForwardingResult?.Forward)\n .map(f => ({\n alias: (f['@_mailbox'] ?? '').toString(),\n forwardTo: (f['#text'] ?? '').toString().trim(),\n }))\n .filter(f => f.alias && f.forwardTo);\n }\n\n /**\n * Full-replace via dns.setEmailForwarding: mailbox/forward params are 1-indexed\n * and any alias not sent is removed, so an empty `forwards` clears all\n * forwarding. Requires the domain to use Namecheap's DNS.\n */\n override async setEmailForwarding(\n domainName: string,\n forwards: EmailForward[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const params: Record<string, string> = { DomainName: domainName };\n forwards.forEach((f, idx) => {\n const n = idx + 1; // Namecheap forwarding params are 1-based\n params[`MailBox${n}`] = f.alias;\n params[`ForwardTo${n}`] = f.forwardTo;\n });\n const res = await this.call('namecheap.domains.dns.setEmailForwarding', params, opts);\n return statusResult(res);\n }\n\n // --- extended: domain (URL) forwarding ---\n\n /**\n * Namecheap has no dedicated domain-forwarding endpoint; URL forwarding lives in\n * the host-record set as URL/URL301/FRAME records, so this reads the hosts and\n * returns just the forwarding ones.\n */\n override async getDomainForwarding(\n domainName: string,\n opts?: RequestOptions\n ): Promise<DomainForward[]> {\n const records = await this.getDnsRecords(domainName, opts);\n return records\n .filter(r => isUrlRecordType(r.type))\n .map(r => ({\n host: r.name || '@',\n url: r.value,\n type: NC_URL_TYPE_TO_FORWARD[r.type.toUpperCase()],\n }));\n }\n\n /**\n * Because URL forwarding is stored in the host set and dns.setHosts is a full\n * replace, this preserves every non-forwarding record and swaps in the new\n * URL-family records — so an empty `forwards` clears URL forwarding while\n * leaving the rest of the zone intact.\n */\n override async setDomainForwarding(\n domainName: string,\n forwards: DomainForward[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const settable = settableForwards(forwards); // reject masked before any write\n const existing = await this.getDnsRecords(domainName, opts);\n const kept = existing.filter(r => !isUrlRecordType(r.type));\n const urlRecords: DnsRecord[] = settable.map(f => ({\n type: NC_FORWARD_TO_URL_TYPE[f.type],\n name: f.host || '@',\n value: f.url,\n }));\n return this.setDnsRecords(domainName, [...kept, ...urlRecords], opts);\n }\n}\n\n// Namecheap URL host-record types <-> the normalized DomainForward.type\nconst NC_URL_TYPE_TO_FORWARD: Record<string, DomainForwardType> = {\n URL: 'temporary',\n URL301: 'permanent',\n FRAME: 'masked', // read-only; setDomainForwarding rejects it\n};\nconst NC_FORWARD_TO_URL_TYPE: Record<'temporary' | 'permanent', string> = {\n temporary: 'URL',\n permanent: 'URL301',\n};\n\n// whether a host-record type is one of Namecheap's URL-forwarding pseudo-records\nfunction isUrlRecordType(type: string): boolean {\n return type.toUpperCase() in NC_URL_TYPE_TO_FORWARD;\n}\n\n// whether the response's root Status attribute is \"OK\"\nfunction isOk(res: NcResponse): boolean {\n return res.ApiResponse?.['@_Status'] === 'OK';\n}\n\n// extract the first error message from an error response, if present\nfunction errorText(res: NcResponse): string | null {\n const error = res.ApiResponse?.Errors?.Error;\n if (!error) return null;\n const first = ensureArray(error)[0];\n if (typeof first === 'string') return first.trim() || null;\n return first?.['#text']?.trim() ?? null;\n}\n\n// map a Namecheap response's root Status to an OperationResult\nfunction statusResult(res: NcResponse): OperationResult {\n if (isOk(res)) return { success: true, message: 'OK' };\n return { success: false, message: errorText(res) ?? 'Unknown response' };\n}\n\n// split a domain into second-level label + TLD (the TLD may contain a dot, e.g.\n// \"co.uk\"). Namecheap's DNS/nameserver commands take SLD and TLD separately.\nfunction splitDomain(domain: string): { sld: string; tld: string } {\n const dot = domain.indexOf('.');\n return dot === -1\n ? { sld: domain, tld: '' }\n : { sld: domain.slice(0, dot), tld: domain.slice(dot + 1) };\n}\n\n// parse a Namecheap price element's Price attribute into a number, or undefined\nfunction toPrice(price: NcPriceEl | undefined): number | undefined {\n if (!price?.['@_Price']) return undefined;\n const n = Number(price['@_Price']);\n return Number.isFinite(n) ? n : undefined;\n}\n\n// --- contact mapping between Namecheap's shape and the normalized Contact ---\n\nfunction fromNcContact(c: NcContactEl | undefined): Contact | undefined {\n if (!c) return undefined;\n const text = (v: string | undefined): string => (v ?? '').toString();\n return {\n firstName: text(c.FirstName),\n lastName: text(c.LastName),\n organization: c.OrganizationName ? String(c.OrganizationName) : undefined,\n email: text(c.EmailAddress),\n phone: text(c.Phone),\n fax: c.Fax ? String(c.Fax) : undefined,\n address1: text(c.Address1),\n address2: c.Address2 ? String(c.Address2) : undefined,\n city: text(c.City),\n state: text(c.StateProvince),\n postalCode: text(c.PostalCode),\n country: text(c.Country),\n };\n}\n\n// build the prefixed request params (e.g. RegistrantFirstName) for one role\nfunction toNcContactParams(prefix: string, c: Contact): Record<string, string> {\n const params: Record<string, string> = {\n [`${prefix}FirstName`]: c.firstName,\n [`${prefix}LastName`]: c.lastName,\n [`${prefix}Address1`]: c.address1,\n [`${prefix}City`]: c.city,\n [`${prefix}StateProvince`]: c.state ?? '',\n [`${prefix}PostalCode`]: c.postalCode,\n [`${prefix}Country`]: c.country,\n [`${prefix}Phone`]: c.phone,\n [`${prefix}EmailAddress`]: c.email,\n };\n if (c.organization) params[`${prefix}OrganizationName`] = c.organization;\n if (c.address2) params[`${prefix}Address2`] = c.address2;\n if (c.fax) params[`${prefix}Fax`] = c.fax;\n return params;\n}\n","import type {\n ConfigField,\n ConnectionResult,\n Contact,\n ContactSet,\n DnsRecord,\n DnssecStatus,\n Domain,\n DomainAvailability,\n DomainForward,\n DomainForwardType,\n EmailForward,\n ListDomainsOptions,\n OperationResult,\n RegisterDomainInput,\n RegistrarOptions,\n RequestOptions,\n TldPricing,\n TransferDomainInput,\n} from '../types';\nimport { createDomain, filterDomains, settableForwards } from '../utils';\nimport { NotFoundError, toRegistrarError } from '../errors';\nimport { ensureArray, parseXml } from '../xml';\nimport { BaseRegistrar, selectBaseUrl } from '../registrar';\nimport { Feature, type RegistrarFeature } from '../features';\nimport type { RegistrarCredentials } from '../types';\n\n// NameSilo returns a `{ request, reply }` envelope for every operation. All\n// calls return HTTP 200; success/failure is signalled by `reply.code` (300 = ok).\ninterface NsReply {\n code?: number | string;\n detail?: string;\n domains?: unknown;\n pager?: { page?: number; page_size?: number; total_count?: number };\n // getDomainInfo fields (present only on that call's reply)\n created?: string;\n expires?: string;\n status?: string;\n locked?: string;\n private?: string;\n auto_renew?: string;\n nameservers?: unknown;\n // getDomainInfo also returns the per-role internal contact IDs\n contact_ids?: NsContactIds;\n // contactList returns full contact records (single object or array)\n contact?: NsContact | NsContact[];\n // contactAdd returns the new contact's id\n contact_id?: string | number;\n // dnsListRecords returns resource_record entries (single object or array)\n resource_record?: NsResourceRecord | NsResourceRecord[];\n // dnsSecListRecords returns ds_record entries (single object or array)\n ds_record?: NsDsRecord | NsDsRecord[];\n // listEmailForwards returns addresses entries (single object or array)\n addresses?: NsEmailAddresses | NsEmailAddresses[];\n // getDomainInfo also carries the apex URL-forwarding config\n forward_url?: string;\n forward_type?: string;\n traffic_type?: string;\n // checkRegisterAvailability groups results; each group wraps `domain` entries\n available?: unknown;\n unavailable?: unknown;\n invalid?: unknown;\n // getPrices returns one node per TLD keyed directly on the reply (e.g.\n // reply.com = { registration, renew, transfer }); read via a Record cast\n}\n\n// one DS record from dnsSecListRecords (read fields are snake_case)\ninterface NsDsRecord {\n digest?: string;\n digest_type?: string | number;\n algorithm?: string | number;\n key_tag?: string | number;\n}\n\n// one mailbox from listEmailForwards: `email` is the local part, `forwards_to`\n// is one address or an array of them\ninterface NsEmailAddresses {\n email?: string;\n forwards_to?: string | string[];\n}\n\ninterface NsResponse {\n reply?: NsReply;\n}\n\n// getDomainInfo.contact_ids: internal NameSilo IDs per role (strings)\ninterface NsContactIds {\n registrant?: string | number;\n administrative?: string | number;\n technical?: string | number;\n billing?: string | number;\n}\n\n// a full contact record from contactList (empty XML elements parse to '' or {})\ninterface NsContact {\n contact_id?: string | number;\n first_name?: unknown;\n last_name?: unknown;\n company?: unknown;\n address?: unknown;\n address2?: unknown;\n city?: unknown;\n state?: unknown;\n zip?: unknown;\n country?: unknown;\n email?: unknown;\n phone?: unknown;\n fax?: unknown;\n}\n\n// a DNS record from dnsListRecords (distance carries the MX priority)\ninterface NsResourceRecord {\n record_id?: string | number;\n type?: unknown;\n host?: unknown;\n value?: unknown;\n ttl?: unknown;\n distance?: unknown;\n}\n\n// one TLD's price node from getPrices\ninterface NsPriceNode {\n registration?: unknown;\n renew?: unknown;\n transfer?: unknown;\n}\n\n// a normalized availability entry parsed from a checkRegisterAvailability group\ninterface NsAvailEntry {\n name: string;\n price?: number;\n premium?: boolean;\n duration?: number;\n}\n\n// a domain entry from listDomains, which may arrive as a bare name or an object\ninterface NsDomainEntry {\n domain?: string;\n created?: string;\n expires?: string;\n}\n\n/**\n * NameSilo Registrar\n * API docs: https://www.namesilo.com/api-reference\n *\n * Credentials: generate an API key in your NameSilo account under\n * Account Options > API Manager. The key may optionally be restricted to up to\n * five IP addresses there.\n *\n * Note: NameSilo uses a simple HTTP GET API — every call hits\n * `/{operation}` with `version`, `type=json`, and `key` query parameters (the\n * key travels in the URL, per their API design). Responses carry a numeric\n * `reply.code` (300 = success) rather than using HTTP status codes.\n */\nexport class NameSiloRegistrar extends BaseRegistrar {\n readonly name = 'namesilo';\n\n static readonly displayName = 'NameSilo';\n static readonly helpText =\n 'Generate an API key in your NameSilo account under Account Options > API Manager. ' +\n 'You can optionally restrict the key to specific IP addresses there. For sandbox ' +\n 'testing, use { environment: \"sandbox\" } (OTE host ote.namesilo.com) — OTE ' +\n 'credentials are not self-service; you must contact NameSilo support to be issued them.';\n static readonly configFields: ConfigField[] = [\n { name: 'apiKey', label: 'API Key', type: 'password', required: true },\n ];\n // NameSilo runs an OTE/test environment at ote.namesilo.com; sandbox keys are\n // issued by emailing NameSilo support (not self-service).\n static readonly supportsSandbox = true;\n // JSON API with broad coverage. Beyond core: DNSSEC read/disable, email\n // forwarding, and domain (URL) forwarding. GetAuthCode is intentionally NOT\n // declared — NameSilo's retrieveAuthCode emails the EPP code to the\n // registrant and never returns it, so it can't satisfy the getAuthCode\n // contract. No webhooks (polling only).\n static readonly extendedFeatures: readonly RegistrarFeature[] = [\n Feature.GetDnssec,\n Feature.DisableDnssec,\n Feature.GetEmailForwarding,\n Feature.SetEmailForwarding,\n Feature.GetDomainForwarding,\n Feature.SetDomainForwarding,\n ];\n\n constructor(credentials: RegistrarCredentials, options?: RegistrarOptions) {\n super(\n credentials,\n {\n baseUrl: selectBaseUrl('NameSilo', options?.environment, {\n production: 'https://www.namesilo.com/api',\n sandbox: 'https://ote.namesilo.com/api',\n }),\n },\n options\n );\n }\n\n // issue an operation with the standard auth params merged in\n private call(\n operation: string,\n extra: Record<string, string | number> = {},\n opts?: RequestOptions\n ): Promise<NsResponse> {\n return this.http.request<NsResponse>({\n path: `/${operation}`,\n query: { version: 1, type: 'json', key: this.credentials.apiKey, ...extra },\n ...opts,\n });\n }\n\n override async testConnection(opts?: RequestOptions): Promise<ConnectionResult> {\n try {\n // getAccountBalance is the cheapest read-only call that validates the key\n const res = await this.call('getAccountBalance', {}, opts);\n return replyOk(res)\n ? { success: true, message: 'Connection successful' }\n : { success: false, message: replyDetail(res) };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n /**\n * listDomains returns names + created/expires dates only. Nameservers, status,\n * lock, privacy, and auto-renew are NOT in the list response and cannot be\n * batched in — use `getDomain` per domain for those. `search` is applied\n * client-side (NameSilo has no server-side name filter).\n */\n override async listDomains(opts?: ListDomainsOptions): Promise<Domain[]> {\n const { search, ...reqOpts } = opts ?? {};\n const domains: Domain[] = [];\n const perPage = 100; // NameSilo page size\n let page = 1;\n let hasMore = true;\n\n while (hasMore) {\n const res = await this.call('listDomains', { page, pageSize: perPage }, reqOpts);\n if (!replyOk(res)) {\n throw new Error(replyDetail(res));\n }\n\n const entries = extractDomainEntries(res.reply?.domains);\n for (const entry of entries) {\n domains.push(\n createDomain({\n domainName: entry.domain,\n registrar: this.name,\n status: 'ok', // the list endpoint does not return a per-domain status\n createdDate: entry.created,\n expirationDate: entry.expires,\n renewalDate: entry.expires,\n nameservers: [], // not returned by listDomains (see getDomain)\n })\n );\n }\n\n hasMore = entries.length === perPage;\n page++;\n }\n return filterDomains(domains, search);\n }\n\n /**\n * getDomainInfo carries the details listDomains omits: status, lock, privacy,\n * auto-renew, and nameservers. This is the only way to get NS for a NameSilo\n * domain (one call per domain).\n */\n override async getDomain(domainName: string, opts?: RequestOptions): Promise<Domain> {\n const res = await this.call('getDomainInfo', { domain: domainName }, opts);\n if (!replyOk(res)) {\n throw new NotFoundError(`NameSilo: domain '${domainName}' not found (${replyDetail(res)})`);\n }\n const r = res.reply ?? {};\n return createDomain({\n domainName,\n registrar: this.name,\n status: r.status,\n createdDate: r.created,\n expirationDate: r.expires,\n renewalDate: r.expires,\n autoRenew: isYes(r.auto_renew),\n locked: isYes(r.locked),\n privacy: isYes(r.private),\n nameservers: extractNsHosts(r.nameservers),\n });\n }\n\n override async getNameservers(domainName: string, opts?: RequestOptions): Promise<string[]> {\n const domain = await this.getDomain(domainName, opts);\n return domain.nameservers;\n }\n\n /**\n * NameSilo has no per-domain contact read: getDomainInfo returns only the\n * internal contact IDs per role, so we resolve them against the full account\n * contact profiles from `contactList` (one extra call), matching by ID.\n */\n override async getContacts(domainName: string, opts?: RequestOptions): Promise<ContactSet> {\n const infoRes = await this.call('getDomainInfo', { domain: domainName }, opts);\n if (!replyOk(infoRes)) {\n throw new NotFoundError(\n `NameSilo: domain '${domainName}' not found (${replyDetail(infoRes)})`\n );\n }\n const ids = infoRes.reply?.contact_ids ?? {};\n\n const listRes = await this.call('contactList', {}, opts);\n if (!replyOk(listRes)) {\n throw new Error(replyDetail(listRes));\n }\n const byId = new Map<string, NsContact>();\n for (const c of ensureArray(listRes.reply?.contact)) {\n byId.set(text(c.contact_id), c);\n }\n\n const lookup = (id: string | number | undefined): Contact | undefined => {\n const key = text(id);\n return key ? fromNsContact(byId.get(key)) : undefined;\n };\n return {\n registrant: lookup(ids.registrant),\n admin: lookup(ids.administrative),\n tech: lookup(ids.technical),\n billing: lookup(ids.billing),\n };\n }\n\n override async getDnsRecords(domainName: string, opts?: RequestOptions): Promise<DnsRecord[]> {\n const res = await this.call('dnsListRecords', { domain: domainName }, opts);\n if (!replyOk(res)) {\n throw new Error(replyDetail(res));\n }\n return ensureArray(res.reply?.resource_record).map(rr => {\n const type = text(rr.type).toUpperCase();\n const record: DnsRecord = {\n type,\n name: text(rr.host),\n value: text(rr.value),\n };\n const ttl = Number(rr.ttl);\n if (Number.isFinite(ttl)) record.ttl = ttl;\n // NameSilo carries the MX priority in `distance`\n const distance = Number(rr.distance);\n if (type === 'MX' && Number.isFinite(distance)) record.priority = distance;\n return record;\n });\n }\n\n /**\n * Per-TLD pricing via getPrices, which returns every supported TLD keyed\n * directly on the reply (e.g. reply.com = { registration, renew, transfer }).\n * Prices are already in major USD units. A bare TLD works; a full domain is\n * reduced to its TLD.\n */\n override async getPricing(tldOrDomain: string, opts?: RequestOptions): Promise<TldPricing> {\n const tld = (\n tldOrDomain.includes('.') ? tldOrDomain.slice(tldOrDomain.indexOf('.') + 1) : tldOrDomain\n ).toLowerCase();\n\n const res = await this.call('getPrices', {}, opts);\n if (!replyOk(res)) {\n throw new Error(replyDetail(res));\n }\n const reply = (res.reply ?? {}) as Record<string, unknown>;\n const node = reply[tld];\n if (!node || typeof node !== 'object') {\n throw new NotFoundError(`NameSilo: no pricing found for TLD '${tld}'`);\n }\n const price = node as NsPriceNode;\n return {\n tld,\n currency: 'USD',\n registration: toPrice(price.registration),\n renewal: toPrice(price.renew),\n transfer: toPrice(price.transfer),\n };\n }\n\n /**\n * Availability via checkRegisterAvailability (up to 200 domains per request).\n * The reply splits names into `available`, `unavailable`, and `invalid`\n * groups; available entries carry `price`/`premium`/`duration` attributes.\n * Malformed names land in `invalid` and are omitted from the result.\n */\n override async checkAvailability(\n domainNames: string[],\n opts?: RequestOptions\n ): Promise<DomainAvailability[]> {\n const res = await this.call(\n 'checkRegisterAvailability',\n { domains: domainNames.join(',') },\n opts\n );\n if (!replyOk(res)) {\n throw new Error(replyDetail(res));\n }\n const reply = res.reply ?? {};\n const results: DomainAvailability[] = [];\n\n for (const entry of extractAvailEntries(reply.available)) {\n const result: DomainAvailability = { domainName: entry.name, available: true };\n if (entry.premium != null) result.premium = entry.premium;\n if (entry.price != null) {\n result.price = entry.price;\n result.currency = 'USD';\n }\n if (entry.duration != null) result.period = entry.duration;\n results.push(result);\n }\n for (const entry of extractAvailEntries(reply.unavailable)) {\n results.push({ domainName: entry.name, available: false });\n }\n return results;\n }\n\n override async renewDomain(\n domainName: string,\n years = 1,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const res = await this.call('renewDomain', { domain: domainName, years }, opts);\n return statusResult(res);\n }\n\n override async updateNameservers(\n domainName: string,\n nameservers: string[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n if (nameservers.length < 2 || nameservers.length > 13) {\n throw new Error('NameSilo requires 2-13 nameservers');\n }\n const query: Record<string, string | number> = { domain: domainName };\n nameservers.forEach((ns, i) => {\n query[`ns${i + 1}`] = ns; // ns1..ns13\n });\n const res = await this.call('changeNameServers', query, opts);\n return statusResult(res);\n }\n\n override async lockDomain(domainName: string, opts?: RequestOptions): Promise<OperationResult> {\n // 252 = \"already locked\" — treat as an idempotent success\n const res = await this.call('domainLock', { domain: domainName }, opts);\n return statusResult(res, [252]);\n }\n\n override async unlockDomain(domainName: string, opts?: RequestOptions): Promise<OperationResult> {\n // 253 = \"already unlocked\" — treat as an idempotent success\n const res = await this.call('domainUnlock', { domain: domainName }, opts);\n return statusResult(res, [253]);\n }\n\n // --- extended capabilities ---------------------------------------------\n\n /**\n * DNSSEC status via dnsSecListRecords, which returns zero or more `ds_record`\n * entries (snake_case fields on read). A non-empty list means DNSSEC is on.\n */\n override async getDnssec(domainName: string, opts?: RequestOptions): Promise<DnssecStatus> {\n const res = await this.call('dnsSecListRecords', { domain: domainName }, opts);\n if (!replyOk(res)) throw new Error(replyDetail(res));\n const list = ensureArray<NsDsRecord>(res.reply?.ds_record);\n return {\n enabled: list.length > 0,\n dsRecords: list.map(d => ({\n keyTag: Number(d.key_tag) || 0,\n algorithm: Number(d.algorithm) || 0,\n digestType: Number(d.digest_type) || 0,\n digest: text(d.digest),\n })),\n };\n }\n\n /**\n * Disable DNSSEC by deleting every DS record (dnsSecDeleteRecord, once per\n * record — NameSilo has no bulk off). The delete params are camelCase and echo\n * the record's identifying fields.\n */\n override async disableDnssec(\n domainName: string,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n try {\n const res = await this.call('dnsSecListRecords', { domain: domainName }, opts);\n if (!replyOk(res)) return statusResult(res);\n for (const d of ensureArray<NsDsRecord>(res.reply?.ds_record)) {\n const del = await this.call(\n 'dnsSecDeleteRecord',\n {\n domain: domainName,\n digest: text(d.digest),\n keyTag: text(d.key_tag),\n digestType: text(d.digest_type),\n alg: text(d.algorithm),\n },\n opts\n );\n if (!replyOk(del)) return statusResult(del);\n }\n return { success: true, message: 'DNSSEC disabled successfully' };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n /**\n * Read the raw email-forward rows via listEmailForwards. NameSilo's `type=json`\n * output for this one call is lossy — it drops the alias (the `<email>` tag) and\n * returns only nested `forwards_to` arrays — so this call is fetched as XML and\n * parsed. The XML `<email>` is the full address (alias@domain); return just the\n * local part, plus its destinations.\n */\n private async listEmailForwards(\n domainName: string,\n opts?: RequestOptions\n ): Promise<{ alias: string; forwardsTo: string[] }[]> {\n const xml = await this.http.requestText({\n path: '/listEmailForwards',\n query: { version: 1, type: 'xml', key: this.credentials.apiKey, domain: domainName },\n ...opts,\n });\n const reply = parseXml<{ namesilo?: NsResponse }>(xml)?.namesilo?.reply;\n if (!reply || Number(reply.code) !== 300) {\n throw new Error(reply?.detail ? text(reply.detail) : 'NameSilo: listEmailForwards failed');\n }\n const suffix = `@${domainName.toLowerCase()}`;\n return ensureArray<NsEmailAddresses>(reply.addresses).map(a => {\n const full = text(a.email);\n const alias = full.toLowerCase().endsWith(suffix)\n ? full.slice(0, full.length - suffix.length)\n : full;\n return { alias, forwardsTo: ensureArray<string>(a.forwards_to).map(text).filter(Boolean) };\n });\n }\n\n /**\n * Read email forwarding. Expands each alias's destinations into its own\n * {alias, forwardTo} row.\n */\n override async getEmailForwarding(\n domainName: string,\n opts?: RequestOptions\n ): Promise<EmailForward[]> {\n const rows = await this.listEmailForwards(domainName, opts);\n const out: EmailForward[] = [];\n for (const { alias, forwardsTo } of rows) {\n for (const dest of forwardsTo) {\n if (alias && dest) out.push({ alias, forwardTo: dest });\n }\n }\n return out;\n }\n\n /**\n * Replace email forwarding (full replace; empty clears). NameSilo has no bulk\n * endpoint, so diff by mailbox: configureEmailForward upserts one alias with up\n * to 5 destinations (forward1..forward5); deleteEmailForward removes an alias.\n */\n override async setEmailForwarding(\n domainName: string,\n forwards: EmailForward[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n try {\n const desired = new Map<string, string[]>();\n for (const f of forwards) {\n const list = desired.get(f.alias) ?? [];\n list.push(f.forwardTo);\n desired.set(f.alias, list);\n }\n const currentAliases = new Set(\n (await this.listEmailForwards(domainName, opts)).map(r => r.alias).filter(Boolean)\n );\n\n for (const alias of currentAliases) {\n if (!desired.has(alias)) {\n const del = await this.call(\n 'deleteEmailForward',\n { domain: domainName, email: alias },\n opts\n );\n if (!replyOk(del)) return statusResult(del);\n }\n }\n for (const [alias, destinations] of desired) {\n const query: Record<string, string | number> = { domain: domainName, email: alias };\n // NameSilo supports up to 5 destinations: forward1..forward5\n destinations.slice(0, 5).forEach((dest, i) => {\n query[`forward${i + 1}`] = dest;\n });\n const set = await this.call('configureEmailForward', query, opts);\n if (!replyOk(set)) return statusResult(set);\n }\n return { success: true, message: 'Email forwarding updated successfully' };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n /**\n * Read the apex URL forwarding from getDomainInfo (`forward_url`/`forward_type`).\n * NameSilo has no forwarding-list endpoint, so only the apex forward is\n * readable — per-subdomain forwards can be set but not enumerated.\n */\n override async getDomainForwarding(\n domainName: string,\n opts?: RequestOptions\n ): Promise<DomainForward[]> {\n const res = await this.call('getDomainInfo', { domain: domainName }, opts);\n if (!replyOk(res)) throw new Error(replyDetail(res));\n // NameSilo keeps the last `forward_url` even after forwarding is switched off,\n // so gate on `traffic_type` — only \"Forwarded\" means an active apex forward.\n // (A never-forwarded domain also reports forward_url \"N/A\".)\n if (text(res.reply?.traffic_type) !== 'Forwarded') return [];\n const url = text(res.reply?.forward_url);\n if (!url || url === 'N/A') return [];\n return [{ host: '@', url, type: nsForwardType(res.reply?.forward_type) }];\n }\n\n /**\n * Set apex URL forwarding via domainForward (method 301/302/cloaked). NameSilo\n * can't list per-subdomain forwards, so this interface supports the apex forward\n * only (host \"@\"); an empty list clears it by restoring NameSilo's default\n * nameservers (there is no dedicated \"stop forwarding\" command).\n */\n override async setDomainForwarding(\n domainName: string,\n forwards: DomainForward[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n if (forwards.length === 0) {\n return this.updateNameservers(domainName, NAMESILO_DEFAULT_NS, opts);\n }\n if (forwards.length > 1) {\n throw new Error('NameSilo supports a single apex (\"@\") forward via this interface');\n }\n const [f] = settableForwards(forwards); // reject masked before any write\n if (f.host && f.host !== '@') {\n throw new Error(\n 'NameSilo per-subdomain forwards are not listable, so only the apex (\"@\") forward is supported'\n );\n }\n const scheme = /^(https?):\\/\\/(.*)$/i.exec(f.url);\n const protocol = scheme ? scheme[1].toLowerCase() : 'http';\n const address = scheme ? scheme[2] : f.url;\n const res = await this.call(\n 'domainForward',\n { domain: domainName, protocol, address, method: NS_FORWARD_METHOD[f.type] },\n opts\n );\n return statusResult(res);\n }\n\n override async setAutoRenew(\n domainName: string,\n enabled: boolean,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n // 300 on change; 280 = \"already set to that value\" — idempotent success\n const res = await this.call(\n enabled ? 'addAutoRenewal' : 'removeAutoRenewal',\n { domain: domainName },\n opts\n );\n return statusResult(res, [280]);\n }\n\n override async setPrivacy(\n domainName: string,\n enabled: boolean,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n // 300 on change; 280 = \"already in that state\" — idempotent success\n const res = await this.call(\n enabled ? 'addPrivacy' : 'removePrivacy',\n { domain: domainName },\n opts\n );\n return statusResult(res, [280]);\n }\n\n /**\n * Replaces the record set. NameSilo has no atomic \"set all\" endpoint — records\n * are added/deleted individually by id — so this diffs against the current\n * records: it adds records not already present and deletes those no longer in\n * the desired set, leaving unchanged records (and their ids) untouched. The\n * delegation nameservers aren't part of this list (see `updateNameservers`).\n */\n override async setDnsRecords(\n domainName: string,\n records: DnsRecord[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const listRes = await this.call('dnsListRecords', { domain: domainName }, opts);\n if (!replyOk(listRes)) return { success: false, message: replyDetail(listRes) };\n const existing = ensureArray(listRes.reply?.resource_record);\n\n const existingByKey = new Map<string, string>(); // record key -> record_id\n for (const rr of existing) {\n const k = dnsKey(text(rr.type), text(rr.host), text(rr.value), Number(rr.distance));\n existingByKey.set(k, text(rr.record_id));\n }\n\n // add desired records that aren't already present\n const desiredKeys = new Set<string>();\n for (const r of records) {\n const type = r.type.toUpperCase();\n const k = dnsKey(type, r.name || '@', r.value, r.priority);\n desiredKeys.add(k);\n if (existingByKey.has(k)) continue;\n const query: Record<string, string | number> = {\n domain: domainName,\n rrtype: type,\n rrhost: r.name === '@' ? '' : r.name, // NameSilo wants a bare host, empty at the apex\n rrvalue: r.value,\n rrttl: r.ttl ?? 7207, // NameSilo's default TTL\n };\n if (type === 'MX') query.rrdistance = r.priority ?? 10;\n const addRes = await this.call('dnsAddRecord', query, opts);\n if (!replyOk(addRes)) return { success: false, message: replyDetail(addRes) };\n }\n\n // delete existing records no longer in the desired set\n for (const [k, rrid] of existingByKey) {\n if (desiredKeys.has(k) || !rrid) continue;\n const delRes = await this.call('dnsDeleteRecord', { domain: domainName, rrid }, opts);\n if (!replyOk(delRes)) return { success: false, message: replyDetail(delRes) };\n }\n return { success: true, message: 'DNS records updated successfully' };\n }\n\n /**\n * Updates contact roles. NameSilo contacts are account-level records referenced\n * by id, so this creates a new contact profile per supplied role (`contactAdd`)\n * and points the domain's roles at the new ids (`contactDomainAssociate`).\n * Identical contacts across roles are created once. Roles not supplied keep\n * their current association.\n */\n override async updateContacts(\n domainName: string,\n contacts: ContactSet,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const roles: [keyof ContactSet, string][] = [\n ['registrant', 'registrant'],\n ['admin', 'administrative'],\n ['tech', 'technical'],\n ['billing', 'billing'],\n ];\n const association: Record<string, string | number> = { domain: domainName };\n const idByContact = new Map<Contact, string>();\n for (const [role, param] of roles) {\n const contact = contacts[role];\n if (!contact) continue;\n let id = idByContact.get(contact);\n if (!id) {\n const addRes = await this.call('contactAdd', toNsContactParams(contact), opts);\n if (!replyOk(addRes)) return { success: false, message: replyDetail(addRes) };\n id = text(addRes.reply?.contact_id);\n if (!id) return { success: false, message: 'NameSilo: contactAdd returned no contact_id' };\n idByContact.set(contact, id);\n }\n association[param] = id;\n }\n if (Object.keys(association).length === 1) {\n throw new Error('NameSilo: updateContacts requires at least one contact role');\n }\n const assocRes = await this.call('contactDomainAssociate', association, opts);\n return statusResult(assocRes);\n }\n\n /**\n * Registers a domain. NameSilo registers the domain against the account's\n * default contact profile (use `updateContacts` afterwards to set specific\n * contacts). `private`/`auto_renew` are honored, and initial nameservers are\n * passed when supplied. Spends real money; not exercised against a live account.\n */\n override async registerDomain(\n domainName: string,\n input: RegisterDomainInput,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const query: Record<string, string | number> = {\n domain: domainName,\n years: input.years ?? 1,\n private: input.privacy ? 1 : 0,\n auto_renew: input.autoRenew ? 1 : 0,\n };\n (input.nameservers ?? []).forEach((ns, i) => {\n query[`ns${i + 1}`] = ns;\n });\n const res = await this.call('registerDomain', query, opts);\n return statusResult(res);\n }\n\n /**\n * Transfers a domain in with its EPP auth code. `private`/`auto_renew` are\n * honored; contacts come from the account default. Spends real money; not\n * exercised against a live account.\n */\n override async transferIn(\n domainName: string,\n input: TransferDomainInput,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const query: Record<string, string | number> = {\n domain: domainName,\n auth: input.authCode,\n private: input.privacy ? 1 : 0,\n auto_renew: input.autoRenew ? 1 : 0,\n };\n const res = await this.call('transferDomain', query, opts);\n return statusResult(res);\n }\n}\n\n// safely stringify an unknown XML value: strings/numbers/booleans pass through\n// (trimmed), everything else (e.g. an empty `{}` from a self-closing element)\n// becomes ''. Guards against no-base-to-string on arbitrary objects.\nfunction text(v: unknown): string {\n if (typeof v === 'string') return v.trim();\n if (typeof v === 'number' || typeof v === 'boolean') return String(v);\n return '';\n}\n\n// a stable identity key for a DNS record: type + relative host (apex as \"@\") +\n// value, plus the MX distance (priority) which is part of an MX record's identity\nfunction dnsKey(type: string, host: string, value: string, distance: number | undefined): string {\n const t = type.toUpperCase();\n const dist = t === 'MX' && Number.isFinite(distance) ? String(distance) : '';\n return [t, host || '@', value, dist].join('\\x00');\n}\n\n// map the normalized Contact to NameSilo's contactAdd parameters (fn/ln/ad/…)\nfunction toNsContactParams(c: Contact): Record<string, string | number> {\n const params: Record<string, string | number> = {\n fn: c.firstName,\n ln: c.lastName,\n ad: c.address1,\n cy: c.city,\n st: c.state ?? '',\n zp: c.postalCode,\n ct: c.country,\n em: c.email,\n ph: c.phone,\n };\n if (c.organization) params.cp = c.organization;\n if (c.address2) params.ad2 = c.address2;\n if (c.fax) params.fx = c.fax;\n return params;\n}\n\n// parse an unknown price-ish value into a positive number, or undefined\nfunction toPrice(v: unknown): number | undefined {\n if (typeof v !== 'string' && typeof v !== 'number') return undefined;\n const n = Number(v);\n return Number.isFinite(n) ? n : undefined;\n}\n\n// map a NameSilo contact record to the normalized Contact shape\nfunction fromNsContact(c: NsContact | undefined): Contact | undefined {\n if (!c) return undefined;\n const opt = (v: unknown): string | undefined => {\n const s = text(v);\n return s ? s : undefined;\n };\n return {\n firstName: text(c.first_name),\n lastName: text(c.last_name),\n organization: opt(c.company),\n email: text(c.email),\n phone: text(c.phone),\n fax: opt(c.fax),\n address1: text(c.address),\n address2: opt(c.address2),\n city: text(c.city),\n state: text(c.state),\n postalCode: text(c.zip),\n country: text(c.country),\n };\n}\n\n// normalize a checkRegisterAvailability group into availability entries. A group\n// is `{ domain: <entry|entry[]> }`; each entry is a bare domain string, or (for\n// available names) an object carrying the name plus price/premium/duration.\n// NameSilo's JSON attribute naming isn't contractually documented, so read the\n// bare, `@`, and `@_` forms defensively (mirroring extractNsHosts' #text guard).\nfunction extractAvailEntries(group: unknown): NsAvailEntry[] {\n if (!group) return [];\n const raw =\n typeof group === 'object' && !Array.isArray(group) && 'domain' in group\n ? ((group as { domain?: unknown }).domain ?? [])\n : group;\n return ensureArray(raw)\n .map((item): NsAvailEntry => {\n if (typeof item === 'string') return { name: item.trim() };\n if (item && typeof item === 'object') {\n const o = item as Record<string, unknown>;\n const name = text(o['#text'] ?? o.value ?? o.domain);\n const priceRaw = o.price ?? o['@price'] ?? o['@_price'];\n const premiumRaw = o.premium ?? o['@premium'] ?? o['@_premium'];\n const durationRaw = o.duration ?? o['@duration'] ?? o['@_duration'];\n const entry: NsAvailEntry = { name };\n const price = toPrice(priceRaw);\n if (price != null && price > 0) entry.price = price;\n if (premiumRaw != null && text(premiumRaw) !== '') entry.premium = isYes(premiumRaw);\n const duration = toPrice(durationRaw);\n if (duration != null && duration > 0) entry.duration = duration;\n return entry;\n }\n return { name: '' };\n })\n .filter(e => e.name);\n}\n\n// NameSilo booleans arrive as \"Yes\"/\"No\" (or 1/0) strings\nfunction isYes(v: unknown): boolean {\n if (typeof v !== 'string' && typeof v !== 'number' && typeof v !== 'boolean') return false;\n const s = String(v).trim().toLowerCase();\n return s === 'yes' || s === '1' || s === 'true';\n}\n\n// NameSilo's DNS-hosting nameservers (DNSOWL). There is no dedicated \"stop\n// forwarding\" command; re-pointing the domain at these flips its `traffic_type`\n// from \"Forwarded\" back to \"Custom DNS\", which deactivates the apex forward.\n// (The parking servers ns1/ns2.namesilo.com do NOT clear forwarding.)\nconst NAMESILO_DEFAULT_NS = ['ns1.dnsowl.com', 'ns2.dnsowl.com', 'ns3.dnsowl.com'];\n\n// map our generic (settable) forward type to NameSilo's domainForward `method`\nconst NS_FORWARD_METHOD: Record<'temporary' | 'permanent', string> = {\n permanent: '301',\n temporary: '302',\n};\n\n// interpret NameSilo's read-side forward_type into our generic type. A masked/\n// cloaked forward is reported as read-only `masked` (setDomainForwarding rejects it).\nfunction nsForwardType(v: string | undefined): DomainForwardType {\n const s = (v ?? '').toLowerCase();\n if (s.includes('cloak') || s.includes('frame') || s.includes('mask')) return 'masked';\n if (s.includes('302') || s.includes('temp')) return 'temporary';\n return 'permanent';\n}\n\n// getDomainInfo returns nameservers as an array of `{ nameserver: \"HOST\",\n// position: N }`. Some other endpoints wrap them as `{ nameserver: [...] }` or\n// carry the host in `#text`, so all forms are handled defensively.\nfunction extractNsHosts(ns: unknown): string[] {\n if (!ns) return [];\n const raw =\n typeof ns === 'object' && !Array.isArray(ns) && 'nameserver' in ns\n ? ((ns as { nameserver?: unknown }).nameserver ?? [])\n : ns;\n const list = Array.isArray(raw) ? raw : [raw];\n return list\n .map(item => {\n if (typeof item === 'string') return item;\n if (item && typeof item === 'object') {\n const o = item as Record<string, unknown>;\n if (typeof o.nameserver === 'string') return o.nameserver; // { nameserver: \"HOST\", position }\n if (typeof o['#text'] === 'string') return o['#text'];\n }\n return '';\n })\n .filter(Boolean);\n}\n\n// whether the response's reply.code is in the success family (300)\nfunction replyOk(res: NsResponse): boolean {\n return Number(res.reply?.code) === 300;\n}\n\n// human-readable detail from a reply, for error messages\nfunction replyDetail(res: NsResponse): string {\n return res.reply?.detail?.trim() || 'Unknown response';\n}\n\n// map a reply to an OperationResult; extra codes are also treated as success\nfunction statusResult(res: NsResponse, okCodes: number[] = []): OperationResult {\n const code = Number(res.reply?.code);\n if (code === 300 || okCodes.includes(code)) {\n return { success: true, message: res.reply?.detail?.trim() || 'success' };\n }\n return { success: false, message: replyDetail(res) };\n}\n\n// listDomains may return domains as an array of names, an array of objects, or\n// an object wrapping a `domain` array — normalize all shapes to entry objects\nfunction extractDomainEntries(domains: unknown): NsDomainEntry[] {\n if (!domains) return [];\n const raw = Array.isArray(domains)\n ? domains\n : typeof domains === 'object' && 'domain' in domains\n ? ((domains as { domain?: unknown }).domain ?? [])\n : [];\n const list = Array.isArray(raw) ? raw : [raw];\n return list.map(item => (typeof item === 'string' ? { domain: item } : (item as NsDomainEntry)));\n}\n","import type {\n ConfigField,\n Contact,\n ConnectionResult,\n ContactSet,\n DnsRecord,\n DnssecStatus,\n Domain,\n DomainAvailability,\n DomainForward,\n DomainForwardType,\n ListDomainsOptions,\n OperationResult,\n RegisterDomainInput,\n RegistrarOptions,\n RequestOptions,\n TldPricing,\n TransferDomainInput,\n} from '../types';\nimport { createDomain, filterDomains, normalizeDomain, settableForwards } from '../utils';\nimport { NotFoundError, NotImplementedError, toRegistrarError } from '../errors';\nimport { BaseRegistrar, selectBaseUrl } from '../registrar';\nimport { Feature, type RegistrarFeature } from '../features';\nimport type { RegistrarCredentials } from '../types';\n\n// Porkbun returns `{ status: \"SUCCESS\" | \"ERROR\", ... }` for every operation.\ninterface PbResponse {\n status?: string;\n message?: string;\n domains?: PbDomain[];\n}\n\ninterface PbDomain {\n domain?: string;\n status?: string;\n createDate?: string;\n expireDate?: string;\n securityLock?: string | number;\n whoisPrivacy?: string | number;\n autoRenew?: string | number;\n}\n\n// domain/getNs response — `ns` is the current nameserver list\ninterface PbNsResponse extends PbResponse {\n ns?: string[];\n}\n\n// a single DNS record from dns/retrieve. All fields arrive as strings.\ninterface PbDnsRecord {\n id?: string;\n name?: string; // fully-qualified host, e.g. \"www.example.com\" (\"example.com\" at apex)\n type?: string;\n content?: string; // record data (for SRV: \"weight port target\")\n ttl?: string;\n prio?: string; // priority, for MX / SRV\n notes?: string;\n}\n\ninterface PbDnsResponse extends PbResponse {\n records?: PbDnsRecord[];\n}\n\n// one TLD's price points from pricing/get. Values are strings in major USD units.\ninterface PbTldPrice {\n registration?: string;\n renewal?: string;\n transfer?: string;\n}\n\ninterface PbPricingResponse extends PbResponse {\n pricing?: Record<string, PbTldPrice>;\n}\n\n// bulk/per-domain response (e.g. domain/updateAutoRenew) — the per-domain\n// outcome is nested under `results`, keyed by domain name.\ninterface PbBulkResponse extends PbResponse {\n results?: Record<string, { status?: string; message?: string }>;\n}\n\n// domain/getUrlForwarding — one URL-forward rule. `type` is\n// permanent/temporary/masked; `redirectType` is the matching 301/302.\ninterface PbUrlForward {\n id?: string;\n subdomain?: string; // \"\" at the apex\n location?: string; // destination URL\n type?: string;\n includePath?: string;\n wildcard?: string;\n}\ninterface PbUrlForwardResponse extends PbResponse {\n forwards?: PbUrlForward[];\n}\n\n// dns/getDnssecRecords — DS records keyed by key tag (or null when none)\ninterface PbDnssecRecord {\n keyTag?: string | number;\n alg?: string | number;\n digestType?: string | number;\n digest?: string;\n maxSigLife?: string;\n}\ninterface PbDnssecResponse extends PbResponse {\n records?: Record<string, PbDnssecRecord> | null;\n}\n\n// map between our generic (settable) forward type and Porkbun's `type` value\nconst FORWARD_TO_PB_TYPE: Record<'temporary' | 'permanent', string> = {\n temporary: 'temporary', // 302\n permanent: 'permanent', // 301\n};\nconst PB_TYPE_TO_FORWARD: Record<string, DomainForwardType> = {\n temporary: 'temporary',\n permanent: 'permanent',\n masked: 'masked', // read-only; setDomainForwarding rejects it\n};\n\n// Porkbun's contact shape: phone is split into a national number plus a numeric\n// country code, distinct from the library's single international `phone`.\ninterface PbContact {\n firstName: string;\n lastName: string;\n organization?: string;\n email: string;\n phone: string;\n phoneCountryCode: string;\n address1: string;\n address2?: string;\n city: string;\n state?: string;\n postalCode: string;\n country: string;\n}\n\n// domain/checkDomain response — availability sits under `response`. With\n// `priceType: \"renewal\"`, per-operation prices appear under `additional`\n// (`additional.renewal.price` is the exact renewal, premium included). The\n// top-level `price` stays the first-year registration price regardless.\ninterface PbCheckResponse extends PbResponse {\n response?: {\n avail?: string; // \"yes\" | \"no\"\n type?: string; // \"registration\" | ...\n price?: string;\n regularPrice?: string;\n premium?: string; // \"yes\" | \"no\"\n additional?: {\n renewal?: { type?: string; price?: string; regularPrice?: string };\n transfer?: { type?: string; price?: string; regularPrice?: string };\n };\n };\n}\n\n/**\n * Porkbun Registrar\n * API docs: https://porkbun.com/api/json/v3/documentation\n *\n * Credentials: create an API key + secret under Account > API Access, then\n * enable API access for each domain you want to manage (Porkbun gates most\n * operations behind a per-domain \"API Access\" toggle in the domain's settings).\n *\n * Note: Porkbun uses a JSON POST API; credentials travel in the request body as\n * `apikey` / `secretapikey`. Success is signalled by `status: \"SUCCESS\"`.\n *\n * Write field notes (all verified end-to-end in the sandbox): register and renew\n * take a `cost` in pennies that must exactly match the current price (fetched\n * from `checkDomain`/`pricing/get`), plus `agreeToTerms: \"yes\"` on register;\n * Porkbun always registers/renews the registry-minimum term, so `years` is not\n * honored. `create` carries no nameservers/auto-renew/contacts fields, so those\n * are applied as follow-up calls (contacts default to the account WHOIS at\n * registration — set them afterwards with `updateContacts`). Auto-renew is\n * toggled with `status: \"on\"|\"off\"` and reports its result in a nested\n * `results[domain]` object. Transfer-in needs `authCode` + the transfer `cost`.\n * Porkbun manages the apex NS records itself (creating NS at the apex is\n * rejected and its default nameservers auto-restore), so `setDnsRecords` leaves\n * them untouched.\n *\n * API gaps (left as NotImplementedError): the transfer lock is read-only via the\n * API (`securityLock` is exposed but has no toggle endpoint), WHOIS privacy has\n * no post-registration toggle (settable only at registration), and there is no\n * contact-read (WHOIS) endpoint.\n */\nexport class PorkbunRegistrar extends BaseRegistrar {\n readonly name = 'porkbun';\n\n static readonly displayName = 'Porkbun';\n static readonly helpText =\n 'Create an API key and secret in your Porkbun account under Account > API Access, ' +\n 'then enable \"API Access\" on each domain you want to manage (per-domain toggle in ' +\n 'the domain details). For testing, use a sandbox key (prefixed \"pk1_sb_\") with ' +\n '{ environment: \"sandbox\" } — it hits the same base URL but an isolated test ' +\n 'environment with $1,000 of fake credit and no real charges (top up or reset via ' +\n 'POST /sandbox/topup and POST /sandbox/reset).';\n static readonly configFields: ConfigField[] = [\n { name: 'apiKey', label: 'API Key', type: 'password', required: true },\n { name: 'secretApiKey', label: 'Secret API Key', type: 'password', required: true },\n ];\n // Porkbun's sandbox is the SAME base URL with a swapped key: a sandbox key is\n // prefixed `pk1_sb_` and runs against an isolated test environment (no real\n // registry actions, no DNS changes, no charges). Each sandbox starts with\n // $1,000 of fake credit and every response includes `\"sandbox\": true`. Top up\n // or reset a sandbox with `POST /sandbox/topup` / `POST /sandbox/reset` using a\n // sandbox key. Because only the key differs, the sandbox base URL equals\n // production — selecting `environment: 'sandbox'` just avoids throwing.\n static readonly supportsSandbox = true;\n // JSON API. Beyond core: DNSSEC read/disable and URL (domain) forwarding, both\n // implemented and verified in the sandbox. No auth-code retrieval or email\n // forwarding via the API; transfer lock and WHOIS-privacy toggles have no write\n // endpoint (privacy is set only at registration).\n static readonly extendedFeatures: readonly RegistrarFeature[] = [\n Feature.GetDnssec,\n Feature.DisableDnssec,\n Feature.GetDomainForwarding,\n Feature.SetDomainForwarding,\n ];\n\n constructor(credentials: RegistrarCredentials, options?: RegistrarOptions) {\n super(\n credentials,\n {\n baseUrl: selectBaseUrl('Porkbun', options?.environment, {\n production: 'https://api.porkbun.com/api/json/v3',\n // sandbox shares the production URL; the `pk1_sb_` key selects the\n // isolated test environment server-side.\n sandbox: 'https://api.porkbun.com/api/json/v3',\n }),\n },\n options\n );\n }\n\n // POST an operation with the credentials merged into the JSON body\n private call<T extends PbResponse = PbResponse>(\n path: string,\n extra: Record<string, unknown> = {},\n opts?: RequestOptions\n ): Promise<T> {\n return this.http.request<T>({\n method: 'POST',\n path,\n body: {\n apikey: this.credentials.apiKey,\n secretapikey: this.credentials.secretApiKey,\n ...extra,\n },\n ...opts,\n });\n }\n\n override async testConnection(opts?: RequestOptions): Promise<ConnectionResult> {\n try {\n const res = await this.call('/ping', {}, opts);\n return isOk(res)\n ? { success: true, message: 'Connection successful' }\n : { success: false, message: res.message ?? 'Unknown error' };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n override async listDomains(opts?: ListDomainsOptions): Promise<Domain[]> {\n // listAll has no name filter, so `search` is applied client-side. Porkbun\n // returns fixed 1000-domain chunks and pages by `start` offset.\n const { search, ...reqOpts } = opts ?? {};\n const domains: Domain[] = [];\n const chunk = 1000; // Porkbun returns up to 1000 domains per call\n let start = 0;\n let hasMore = true;\n\n while (hasMore) {\n const res = await this.call('/domain/listAll', { start, includeLabels: 'no' }, reqOpts);\n if (!isOk(res)) {\n throw new Error(res.message ?? 'API request failed');\n }\n\n const list = res.domains ?? [];\n for (const d of list) {\n domains.push(\n createDomain({\n domainName: d.domain,\n registrar: this.name,\n status: d.status ?? 'ok',\n createdDate: d.createDate,\n expirationDate: d.expireDate,\n renewalDate: d.expireDate,\n autoRenew: isYes(d.autoRenew),\n locked: isYes(d.securityLock),\n privacy: isYes(d.whoisPrivacy),\n nameservers: [], // not returned by listAll (see domain/getNs)\n })\n );\n }\n\n hasMore = list.length === chunk;\n start += chunk;\n }\n return filterDomains(domains, search);\n }\n\n /**\n * Porkbun has no per-domain \"get info\" endpoint, so this lists the account and\n * returns the matching record. `listDomains` already normalizes every field, so\n * the result carries the same shape as any other provider's `getDomain`. Throws\n * NotFoundError when the domain isn't in the account.\n */\n override async getDomain(domainName: string, opts?: RequestOptions): Promise<Domain> {\n const target = normalizeDomain(domainName);\n const domains = await this.listDomains(opts);\n const match = domains.find(d => normalizeDomain(d.domainName) === target);\n if (!match) {\n throw new NotFoundError(`${this.name}: domain ${domainName} not found in this account`);\n }\n return match;\n }\n\n override async getNameservers(domainName: string, opts?: RequestOptions): Promise<string[]> {\n const res = await this.call<PbNsResponse>(\n `/domain/getNs/${encodeURIComponent(domainName)}`,\n {},\n opts\n );\n if (!isOk(res)) throw new Error(res.message ?? 'API request failed');\n return res.ns ?? [];\n }\n\n /**\n * Porkbun exposes no WHOIS/contact retrieval endpoint — contact details are\n * only settable at registration and never read back through the API — so there\n * is no way to fulfil this. (Mirrors Spaceship's `getPricing` gap handling.)\n */\n override getContacts(_domainName: string, _opts?: RequestOptions): Promise<ContactSet> {\n return Promise.reject(\n new NotImplementedError(\n `${this.name}: getContacts is not available — Porkbun's API has no contact-read ` +\n '(WHOIS) endpoint'\n )\n );\n }\n\n override async getDnsRecords(domainName: string, opts?: RequestOptions): Promise<DnsRecord[]> {\n const res = await this.call<PbDnsResponse>(\n `/dns/retrieve/${encodeURIComponent(domainName)}`,\n {},\n opts\n );\n if (!isOk(res)) throw new Error(res.message ?? 'API request failed');\n return (res.records ?? []).map(r => toDnsRecord(r, domainName));\n }\n\n /**\n * Renewal price for a specific name (premium included) when given a full\n * domain; the standard per-TLD price table when given a bare TLD.\n *\n * For a full domain, `checkDomain` with `priceType: \"renewal\"` returns the\n * exact renewal fee for that exact name under `additional.renewal.price` —\n * elevated for premium names — and it works whether or not the domain is in the\n * account. `pricing/get` only has the generic per-TLD rate, which misses\n * premium renewals, so we deliberately do NOT fall back to it here: if the\n * per-name check can't price the domain we return no renewal, leaving the\n * caller to fill from its own base pricing.\n *\n * For a bare TLD (as the renew/transfer write flows pass), there is no specific\n * name to price, so this returns the `pricing/get` table entry directly.\n */\n override async getPricing(tldOrDomain: string, opts?: RequestOptions): Promise<TldPricing> {\n // A dot means a full domain (e.g. \"example.com\"); a bare label is a TLD.\n if (tldOrDomain.includes('.')) {\n const tld = extractTld(tldOrDomain);\n const checked = await this.renewPriceCheck(tldOrDomain, opts);\n return checked\n ? { tld, currency: checked.currency, renewal: checked.renewal }\n : { tld, currency: 'USD' };\n }\n return this.tldPricing(tldOrDomain, opts);\n }\n\n /**\n * The standard per-TLD price points from `pricing/get` (strings in major USD\n * units). Throws NotFoundError when the TLD isn't in the table. Used by the\n * renew/transfer flows and by `getPricing` for a bare TLD.\n */\n private async tldPricing(tld: string, opts?: RequestOptions): Promise<TldPricing> {\n const res = await this.call<PbPricingResponse>('/pricing/get', {}, opts);\n if (!isOk(res)) throw new Error(res.message ?? 'API request failed');\n const price = res.pricing?.[tld];\n if (!price) {\n throw new NotFoundError(`${this.name}: no pricing found for TLD .${tld}`);\n }\n return {\n tld,\n currency: 'USD', // Porkbun prices are always quoted in USD\n registration: toPrice(price.registration),\n renewal: toPrice(price.renewal),\n transfer: toPrice(price.transfer),\n };\n }\n\n /**\n * The exact renewal fee for a specific name via `checkDomain` +\n * `priceType: \"renewal\"`, read from `additional.renewal.price` (premium\n * included). Returns null when the name can't be priced (error, rate limit, or\n * a missing renewal figure) so `getPricing` can fall back. Note: Porkbun\n * rate-limits `checkDomain` to one call per ~10s; the shared HTTP layer retries\n * on the 429 (honoring Retry-After).\n */\n private async renewPriceCheck(\n domain: string,\n opts?: RequestOptions\n ): Promise<{ renewal: number; currency: string } | null> {\n try {\n const res = await this.call<PbCheckResponse>(\n `/domain/checkDomain/${encodeURIComponent(domain)}`,\n { priceType: 'renewal' },\n opts\n );\n if (!isOk(res)) return null;\n const renewal = toPrice(res.response?.additional?.renewal?.price);\n return renewal != null ? { renewal, currency: 'USD' } : null;\n } catch {\n return null;\n }\n }\n\n /**\n * Porkbun's checkDomain takes a single domain per call, so this issues one\n * request per name. The price it reports (major USD units) is the first-year\n * registration price for both regular and premium names.\n */\n override async checkAvailability(\n domainNames: string[],\n opts?: RequestOptions\n ): Promise<DomainAvailability[]> {\n const results: DomainAvailability[] = [];\n for (const domainName of domainNames) {\n const res = await this.call<PbCheckResponse>(\n `/domain/checkDomain/${encodeURIComponent(domainName)}`,\n {},\n opts\n );\n if (!isOk(res)) throw new Error(res.message ?? 'API request failed');\n const info = res.response ?? {};\n const price = toPrice(info.price);\n results.push({\n domainName,\n available: info.avail === 'yes',\n premium: info.premium === 'yes',\n price,\n currency: price != null ? 'USD' : undefined,\n period: price != null ? 1 : undefined,\n });\n }\n return results;\n }\n\n override async updateNameservers(\n domainName: string,\n nameservers: string[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n if (nameservers.length < 2) {\n throw new Error('Porkbun requires at least 2 nameservers');\n }\n const res = await this.call(\n `/domain/updateNs/${encodeURIComponent(domainName)}`,\n { ns: nameservers },\n opts\n );\n return statusResult(res);\n }\n\n /**\n * Registers a domain. Porkbun's `create` requires a `cost` (pennies) that\n * exactly matches the domain's current price — fetched here via `checkDomain`\n * — plus agreement to its terms (sent automatically; invoking this method is\n * the agreement). It always registers the registry-minimum term, so `years` is\n * ignored. Contacts aren't accepted at registration (Porkbun applies the\n * account-default WHOIS); use `updateContacts` afterwards to set them.\n * Nameservers and auto-renew have no `create` field, so they're applied as\n * follow-up calls when provided.\n */\n override async registerDomain(\n domainName: string,\n input: RegisterDomainInput,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const [availability] = await this.checkAvailability([domainName], opts);\n if (!availability?.available) {\n throw new Error(`${this.name}: ${domainName} is not available for registration`);\n }\n if (availability.price == null) {\n throw new Error(`${this.name}: could not determine the registration price for ${domainName}`);\n }\n const body: Record<string, unknown> = {\n cost: toPennies(availability.price),\n agreeToTerms: 'yes',\n };\n // whoisPrivacy is optional; omitting it uses the account default\n if (input.privacy != null) body.whoisPrivacy = input.privacy;\n\n const res = await this.call(`/domain/create/${encodeURIComponent(domainName)}`, body, opts);\n if (!isOk(res)) return statusResult(res);\n\n // create has no nameserver / auto-renew fields — apply them separately\n if (input.nameservers && input.nameservers.length > 0) {\n await this.updateNameservers(domainName, input.nameservers, opts);\n }\n if (input.autoRenew != null) {\n await this.setAutoRenew(domainName, input.autoRenew, opts);\n }\n return { success: true, message: `Domain ${domainName} registered successfully` };\n }\n\n /**\n * Renews a domain. Porkbun renews the registry-minimum term (usually 1 year)\n * and ignores any requested `years`; it requires a `cost` (pennies) matching\n * the domain's current renewal price, fetched here from `pricing/get`. Premium\n * renewals aren't supported via the API.\n */\n override async renewDomain(\n domainName: string,\n _years = 1,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const pricing = await this.tldPricing(extractTld(domainName), opts);\n if (pricing.renewal == null) {\n throw new Error(`${this.name}: could not determine the renewal price for ${domainName}`);\n }\n const res = await this.call(\n `/domain/renew/${encodeURIComponent(domainName)}`,\n { cost: toPennies(pricing.renewal) },\n opts\n );\n return statusResult(res);\n }\n\n override async setAutoRenew(\n domainName: string,\n enabled: boolean,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const res = await this.call<PbBulkResponse>(\n `/domain/updateAutoRenew/${encodeURIComponent(domainName)}`,\n { status: enabled ? 'on' : 'off' },\n opts\n );\n // updateAutoRenew reports the real outcome in a nested results[domain] entry,\n // even when the top-level status is SUCCESS.\n return bulkResult(\n res,\n domainName,\n `Auto-renew ${enabled ? 'enabled' : 'disabled'} successfully`\n );\n }\n\n /**\n * Transfers a domain in with its EPP auth code. Porkbun's `transfer` requires a\n * `cost` (pennies) matching the current transfer price, fetched here from\n * `pricing/get`. The transfer body carries no contacts/privacy/auto-renew — the\n * existing registration's details carry over — and premium/`.uk` transfers\n * aren't supported via the API.\n */\n override async transferIn(\n domainName: string,\n input: TransferDomainInput,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const pricing = await this.tldPricing(extractTld(domainName), opts);\n if (pricing.transfer == null) {\n throw new Error(`${this.name}: could not determine the transfer price for ${domainName}`);\n }\n const res = await this.call(\n `/domain/transfer/${encodeURIComponent(domainName)}`,\n { authCode: input.authCode, cost: toPennies(pricing.transfer) },\n opts\n );\n return statusResult(res, `Domain ${domainName} transfer requested successfully`);\n }\n\n /**\n * Updates contact roles. Only the roles present in `contacts` are changed;\n * unspecified roles are left as-is. Porkbun splits the phone into a national\n * number plus a numeric country code, and runs Google Address Validation on\n * registrant changes for address-validated TLDs.\n */\n override async updateContacts(\n domainName: string,\n contacts: ContactSet,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const roles: Record<string, PbContact> = {};\n if (contacts.registrant) roles.registrant = toPorkbunContact(contacts.registrant);\n if (contacts.admin) roles.admin = toPorkbunContact(contacts.admin);\n if (contacts.tech) roles.tech = toPorkbunContact(contacts.tech);\n if (contacts.billing) roles.billing = toPorkbunContact(contacts.billing);\n if (Object.keys(roles).length === 0) {\n throw new Error(`${this.name}: updateContacts requires at least one contact role`);\n }\n const res = await this.call(\n `/domain/updateContacts/${encodeURIComponent(domainName)}`,\n { contacts: roles },\n opts\n );\n return statusResult(res, 'Contacts updated successfully');\n }\n\n /**\n * Replaces the entire editable record set (full-replace / PUT semantics):\n * retrieves the current records, deletes them, then creates the supplied set.\n * The apex NS records are Porkbun-managed (it rejects creating NS at the apex\n * and auto-restores its defaults), so they're skipped on both delete and\n * create. Because Porkbun has no atomic \"set all\" endpoint, this issues one\n * call per record.\n */\n override async setDnsRecords(\n domainName: string,\n records: DnsRecord[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const zone = normalizeDomain(domainName);\n const existing = await this.call<PbDnsResponse>(\n `/dns/retrieve/${encodeURIComponent(domainName)}`,\n {},\n opts\n );\n if (!isOk(existing)) return statusResult(existing);\n\n for (const r of existing.records ?? []) {\n if (isApexNs(r.type, r.name, zone) || r.id == null) continue;\n const del = await this.call(\n `/dns/delete/${encodeURIComponent(domainName)}/${r.id}`,\n {},\n opts\n );\n if (!isOk(del)) return statusResult(del);\n }\n\n for (const record of records) {\n const name = relativeName(record.name, domainName);\n const type = record.type.toUpperCase();\n if (type === 'NS' && (name === '@' || name === '')) continue; // apex NS is managed by Porkbun\n const create = await this.call(\n `/dns/create/${encodeURIComponent(domainName)}`,\n toPorkbunDnsRecord(record, name, type),\n opts\n );\n if (!isOk(create)) return statusResult(create);\n }\n return { success: true, message: 'DNS records updated successfully' };\n }\n\n // --- extended capabilities ---------------------------------------------\n\n /**\n * DNSSEC status via dns/getDnssecRecords, which returns DS records keyed by key\n * tag (or `null` when there are none). A non-empty set means DNSSEC is enabled.\n */\n override async getDnssec(domainName: string, opts?: RequestOptions): Promise<DnssecStatus> {\n const res = await this.call<PbDnssecResponse>(\n `/dns/getDnssecRecords/${encodeURIComponent(domainName)}`,\n {},\n opts\n );\n if (!isOk(res)) throw new Error(res.message ?? 'API request failed');\n const dsRecords = Object.values(res.records ?? {}).map(r => ({\n keyTag: Number(r.keyTag) || 0,\n algorithm: Number(r.alg) || 0,\n digestType: Number(r.digestType) || 0,\n digest: r.digest ?? '',\n }));\n return { enabled: dsRecords.length > 0, dsRecords };\n }\n\n /**\n * Disable DNSSEC by removing every DS record. Porkbun has no single \"off\" call,\n * so read the current records and delete each by its key tag.\n */\n override async disableDnssec(\n domainName: string,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n try {\n const res = await this.call<PbDnssecResponse>(\n `/dns/getDnssecRecords/${encodeURIComponent(domainName)}`,\n {},\n opts\n );\n if (!isOk(res)) return statusResult(res);\n for (const keyTag of Object.keys(res.records ?? {})) {\n const del = await this.call(\n `/dns/deleteDnssecRecord/${encodeURIComponent(domainName)}/${encodeURIComponent(keyTag)}`,\n {},\n opts\n );\n if (!isOk(del)) return statusResult(del);\n }\n return { success: true, message: 'DNSSEC disabled successfully' };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n /**\n * Read URL forwarding via domain/getUrlForwarding. Porkbun forwards per\n * subdomain (\"\" = apex), so each rule maps to a DomainForward with `host` set\n * to the subdomain (or \"@\" at the apex).\n */\n override async getDomainForwarding(\n domainName: string,\n opts?: RequestOptions\n ): Promise<DomainForward[]> {\n const res = await this.call<PbUrlForwardResponse>(\n `/domain/getUrlForwarding/${encodeURIComponent(domainName)}`,\n {},\n opts\n );\n if (!isOk(res)) throw new Error(res.message ?? 'API request failed');\n return (res.forwards ?? []).map(f => ({\n host: f.subdomain || '@',\n url: f.location ?? '',\n type: PB_TYPE_TO_FORWARD[(f.type ?? '').toLowerCase()] ?? 'permanent',\n }));\n }\n\n /**\n * Replace URL forwarding (full replace; an empty list clears it). Porkbun has\n * no bulk set, so delete every existing forward by id, then add each desired\n * one via domain/addUrlForward.\n */\n override async setDomainForwarding(\n domainName: string,\n forwards: DomainForward[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n try {\n const settable = settableForwards(forwards); // reject masked before any write\n const enc = encodeURIComponent(domainName);\n const existing = await this.call<PbUrlForwardResponse>(\n `/domain/getUrlForwarding/${enc}`,\n {},\n opts\n );\n if (!isOk(existing)) return statusResult(existing);\n for (const f of existing.forwards ?? []) {\n if (f.id == null) continue;\n const del = await this.call(\n `/domain/deleteUrlForward/${enc}/${encodeURIComponent(f.id)}`,\n {},\n opts\n );\n if (!isOk(del)) return statusResult(del);\n }\n for (const f of settable) {\n const add = await this.call(\n `/domain/addUrlForward/${enc}`,\n {\n subdomain: f.host === '@' ? '' : f.host,\n location: f.url,\n type: FORWARD_TO_PB_TYPE[f.type],\n includePath: 'no',\n wildcard: 'no',\n },\n opts\n );\n if (!isOk(add)) return statusResult(add);\n }\n return { success: true, message: 'Domain forwarding updated successfully' };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n}\n\n// whether the response status is \"SUCCESS\"\nfunction isOk(res: PbResponse): boolean {\n return res.status === 'SUCCESS';\n}\n\n// map a response's status to an OperationResult\nfunction statusResult(res: PbResponse, successMessage = 'SUCCESS'): OperationResult {\n if (isOk(res)) return { success: true, message: res.message ?? successMessage };\n return { success: false, message: res.message ?? 'Unknown response' };\n}\n\n// map a bulk/per-domain response (e.g. updateAutoRenew) to an OperationResult.\n// The top-level status can be SUCCESS while the per-domain entry failed, so the\n// real outcome is read from results[domain].\nfunction bulkResult(\n res: PbBulkResponse,\n domainName: string,\n successMessage: string\n): OperationResult {\n const entry = res.results?.[domainName];\n if (isOk(res) && (!entry || entry.status === 'SUCCESS')) {\n return { success: true, message: entry?.message ?? successMessage };\n }\n return { success: false, message: entry?.message ?? res.message ?? 'Unknown response' };\n}\n\n// Porkbun booleans arrive as \"1\"/\"0\" (sometimes numbers) — normalize to boolean\nfunction isYes(value: string | number | undefined): boolean {\n return value === '1' || value === 1 || value === 'yes';\n}\n\n// reduce a TLD or full domain to its bare TLD (no leading dot, lowercased). A\n// multi-label TLD (e.g. \"co.uk\") is preserved by taking everything after the\n// first label of a full domain.\nfunction extractTld(tldOrDomain: string): string {\n const value = tldOrDomain.trim().toLowerCase().replace(/^\\.+/, '');\n return value.includes('.') ? value.slice(value.indexOf('.') + 1) : value;\n}\n\n// convert major USD units (e.g. 11.08) to integer pennies (1108), as Porkbun's\n// `cost` field requires\nfunction toPennies(major: number): number {\n return Math.round(major * 100);\n}\n\n// whether a record is an apex NS record (Porkbun-managed: can't be created and\n// auto-restores, so setDnsRecords must leave it alone). `name` may be the\n// fully-qualified host from a retrieve, or \"@\"/\"\" for the apex.\nfunction isApexNs(type: string | undefined, name: string | undefined, zone: string): boolean {\n if ((type ?? '').toUpperCase() !== 'NS') return false;\n const n = normalizeDomain(name ?? '');\n return n === zone || n === '' || name === '@';\n}\n\n// map a normalized DnsRecord to a Porkbun dns/create body. `name` is already the\n// zone-relative host (\"@\"/\"\" at the apex); Porkbun wants the bare subdomain\n// (empty string at the apex). SRV data is packed as \"<weight> <port> <target>\".\nfunction toPorkbunDnsRecord(\n record: DnsRecord,\n name: string,\n type: string\n): Record<string, unknown> {\n const body: Record<string, unknown> = {\n name: name === '@' ? '' : name,\n type,\n content: record.value,\n };\n if (record.ttl != null) body.ttl = String(record.ttl);\n if (record.priority != null) body.prio = String(record.priority);\n if (type === 'SRV') {\n body.content = `${record.weight ?? 0} ${record.port ?? 0} ${record.value}`;\n }\n return body;\n}\n\n// map the library's Contact to Porkbun's shape, splitting the international\n// phone (\"+1.4805551234\") into a national number + numeric country code\nfunction toPorkbunContact(c: Contact): PbContact {\n const { countryCode, national } = splitPhone(c.phone);\n const contact: PbContact = {\n firstName: c.firstName,\n lastName: c.lastName,\n email: c.email,\n phone: national,\n phoneCountryCode: countryCode,\n address1: c.address1,\n city: c.city,\n postalCode: c.postalCode,\n country: c.country,\n };\n if (c.organization) contact.organization = c.organization;\n if (c.address2) contact.address2 = c.address2;\n if (c.state) contact.state = c.state;\n return contact;\n}\n\n// split an international phone (\"+1.4805551234\" — \"+<cc>.<national>\") into its\n// numeric country code and national number (digits only). Falls back gracefully\n// for values without the leading \"+\" or the \".\" separator.\nfunction splitPhone(phone: string): { countryCode: string; national: string } {\n const trimmed = (phone ?? '').trim();\n const dot = trimmed.indexOf('.');\n if (trimmed.startsWith('+') && dot > 1) {\n return {\n countryCode: trimmed.slice(1, dot).replace(/\\D/g, ''),\n national: trimmed.slice(dot + 1).replace(/\\D/g, ''),\n };\n }\n // no recognizable separator: return all digits as the national number\n return { countryCode: '', national: trimmed.replace(/\\D/g, '') };\n}\n\n// parse a Porkbun price string (major USD units) into a number, or undefined\nfunction toPrice(value: string | undefined): number | undefined {\n if (value == null || value === '') return undefined;\n const n = Number(value);\n return Number.isFinite(n) ? n : undefined;\n}\n\n// convert a Porkbun fully-qualified record name to a name relative to the zone\n// apex (\"@\" at the apex), matching the DnsRecord contract.\nfunction relativeName(name: string, domainName: string): string {\n const fqdn = normalizeDomain(name);\n const zone = normalizeDomain(domainName);\n if (fqdn === zone || fqdn === '') return '@';\n if (fqdn.endsWith(`.${zone}`)) return fqdn.slice(0, -(zone.length + 1));\n return fqdn;\n}\n\n// map a Porkbun DNS record to the normalized DnsRecord shape. Porkbun stores SRV\n// data as prio=priority and content=\"weight port target\"; other types put their\n// value in `content`.\nfunction toDnsRecord(r: PbDnsRecord, domainName: string): DnsRecord {\n const type = (r.type ?? '').toUpperCase();\n const record: DnsRecord = {\n type,\n name: relativeName(r.name ?? '', domainName),\n value: r.content ?? '',\n };\n if (r.ttl != null && r.ttl !== '') {\n const ttl = Number(r.ttl);\n if (Number.isFinite(ttl)) record.ttl = ttl;\n }\n const prio = r.prio != null && r.prio !== '' ? Number(r.prio) : NaN;\n if ((type === 'MX' || type === 'SRV') && Number.isFinite(prio)) {\n record.priority = prio;\n }\n if (type === 'SRV') {\n // content is \"<weight> <port> <target>\"\n const parts = (r.content ?? '').trim().split(/\\s+/);\n if (parts.length === 3) {\n const weight = Number(parts[0]);\n const port = Number(parts[1]);\n if (Number.isFinite(weight)) record.weight = weight;\n if (Number.isFinite(port)) record.port = port;\n record.value = parts[2];\n }\n }\n return record;\n}\n","import type {\n ConfigField,\n ConnectionResult,\n Contact,\n ContactSet,\n DnsRecord,\n Domain,\n DomainAvailability,\n ListDomainsOptions,\n OperationResult,\n RegisterDomainInput,\n RegistrarOptions,\n RequestOptions,\n TldPricing,\n TransferDomainInput,\n} from '../types';\nimport { createDomain, filterDomains, requireConsent, sleep } from '../utils';\nimport { NotImplementedError, toRegistrarError } from '../errors';\nimport { BaseRegistrar, selectBaseUrl } from '../registrar';\nimport { Feature, type RegistrarFeature } from '../features';\nimport type { RegistrarCredentials } from '../types';\n\ninterface SpaceshipNameservers {\n provider?: string;\n hosts?: string[];\n}\n\ninterface SpaceshipPrivacy {\n contactForm?: boolean;\n level?: string; // \"public\" | \"high\"\n}\n\ninterface SpaceshipDomainContacts {\n registrant?: string;\n admin?: string;\n tech?: string;\n billing?: string;\n}\n\ninterface SpaceshipDomain {\n name: string;\n unicodeName?: string;\n isPremium?: boolean;\n autoRenew?: boolean;\n registrationDate?: string;\n expirationDate?: string;\n lifecycleStatus?: string;\n eppStatuses?: string[];\n privacyProtection?: SpaceshipPrivacy;\n nameservers?: SpaceshipNameservers;\n contacts?: SpaceshipDomainContacts;\n}\n\ninterface SpaceshipPage<T> {\n items?: T[];\n total?: number;\n}\n\n// one premium price point from an availability check\ninterface SpaceshipPremiumPrice {\n operation?: string; // \"register\" | \"transfer\" | \"renew\" | \"restore\"\n price?: number;\n currency?: string;\n}\n\ninterface SpaceshipAvailability {\n domain?: string;\n result?: string; // \"available\" | \"taken\" | \"invalidDomainName\" | ...\n premiumPricing?: SpaceshipPremiumPrice[];\n}\n\n// a contact record (ContactDetails)\ninterface SpaceshipContact {\n firstName?: string;\n lastName?: string;\n organization?: string;\n email?: string;\n address1?: string;\n address2?: string;\n city?: string;\n stateProvince?: string;\n postalCode?: string;\n country?: string;\n phone?: string;\n phoneExt?: string;\n fax?: string;\n}\n\n// a DNS record (ResourceRecord — a discriminated union on `type`)\ninterface SpaceshipRecord {\n type?: string;\n name?: string;\n ttl?: number;\n group?: { type?: string }; // \"custom\" | \"product\" | \"personalNs\" (read-only)\n address?: string; // A / AAAA\n cname?: string; // CNAME\n nameserver?: string; // NS\n value?: string; // TXT / CAA\n exchange?: string; // MX\n preference?: number; // MX priority\n target?: string; // SRV / ALIAS\n priority?: number; // SRV\n weight?: number; // SRV\n port?: number; // SRV\n}\n\n// DNS types this provider can write from our generic DnsRecord shape. Others\n// (SRV, CAA, HTTPS, …) need sub-fields our record doesn't carry, so writing them\n// throws rather than sending an incomplete record. Reads handle every type.\nconst WRITABLE_DNS_TYPES = new Set(['A', 'AAAA', 'CNAME', 'NS', 'TXT', 'MX']);\n\n/**\n * Spaceship Registrar\n * API docs: https://docs.spaceship.dev/\n *\n * Credentials: generate an API key + secret in the Spaceship API Manager\n * (\"New API key\"). Both are sent as X-Api-Key and X-Api-Secret headers.\n *\n * Modern REST/JSON API (`/api/v1`). A few operations are asynchronous — register,\n * transfer, and renew return `202` with a `spaceship-async-operationid` header\n * and complete out of band (poll `GET /async-operations/{id}`); the rest are\n * synchronous 2xx/204.\n *\n * `registerDomain`/`transferIn` are implemented (async, 202) and require\n * per-call `consent`; they spend real money and haven't been exercised against a\n * funded account, so treat them as documented-but-unverified.\n *\n * `getPricing` is overridden to throw a specific error: Spaceship exposes no\n * pricing endpoint at all (only per-domain premium prices via an availability\n * check), so there's no TLD price to return.\n */\nexport class SpaceshipRegistrar extends BaseRegistrar {\n readonly name = 'spaceship';\n\n static readonly displayName = 'Spaceship';\n static readonly helpText =\n 'Generate your API key and secret in the API Manager at Spaceship using the ' +\n '\"New API key\" button. The API requires both X-API-Key and X-API-Secret headers.';\n static readonly configFields: ConfigField[] = [\n { name: 'apiKey', label: 'API Key', type: 'password', required: true },\n { name: 'apiSecret', label: 'API Secret', type: 'password', required: true },\n ];\n static readonly supportsSandbox = false; // Spaceship has no public sandbox environment\n // Modern REST API. Beyond core: transfer-out auth-code retrieval\n // (GET .../transfer/auth-code). No DNSSEC or forwarding via the API; Spacemail\n // (email) has no public API.\n static readonly extendedFeatures: readonly RegistrarFeature[] = [Feature.GetAuthCode];\n\n constructor(credentials: RegistrarCredentials, options?: RegistrarOptions) {\n super(\n credentials,\n {\n baseUrl: selectBaseUrl('Spaceship', options?.environment, {\n production: 'https://spaceship.dev/api',\n }),\n headers: {\n 'X-API-Key': credentials.apiKey,\n 'X-API-Secret': credentials.apiSecret,\n 'Content-Type': 'application/json',\n },\n },\n options\n );\n }\n\n override async testConnection(opts?: RequestOptions): Promise<ConnectionResult> {\n try {\n await this.http.request<SpaceshipPage<SpaceshipDomain>>({\n path: '/v1/domains',\n query: { take: 1, skip: 0 },\n ...opts,\n });\n return { success: true, message: 'Connection successful' };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n override async listDomains(opts?: ListDomainsOptions): Promise<Domain[]> {\n // No server-side name filter on this endpoint, so `search` is client-side.\n const { search, ...reqOpts } = opts ?? {};\n const domains: Domain[] = [];\n const take = 100; // Spaceship API maximum page size (1-100)\n let skip = 0;\n let hasMore = true;\n\n while (hasMore) {\n const res = await this.http.request<SpaceshipPage<SpaceshipDomain>>({\n path: '/v1/domains',\n query: { take, skip },\n ...reqOpts,\n });\n const list = res.items ?? [];\n for (const d of list) domains.push(this.toDomain(d));\n hasMore = list.length === take;\n skip += take;\n if (hasMore) await sleep(200); // gentle rate limiting between pages\n }\n return filterDomains(domains, search);\n }\n\n override async getDomain(domainName: string, opts?: RequestOptions): Promise<Domain> {\n return this.toDomain(await this.getRaw(domainName, opts));\n }\n\n override async getNameservers(domainName: string, opts?: RequestOptions): Promise<string[]> {\n const d = await this.getRaw(domainName, opts);\n return d.nameservers?.hosts ?? [];\n }\n\n /**\n * Transfer authorization (EPP) code via GET /v1/domains/{domain}/transfer/auth-code.\n * Synchronous; the code is returned in `authCode`. Requires the API key to\n * carry the `domains:transfer` scope.\n */\n override async getAuthCode(domainName: string, opts?: RequestOptions): Promise<string> {\n const res = await this.http.request<{ authCode?: string }>({\n path: `/v1/domains/${encodeURIComponent(domainName)}/transfer/auth-code`,\n ...opts,\n });\n return res.authCode ?? '';\n }\n\n /**\n * Bulk availability via POST /v1/domains/available. Spaceship reports a `result`\n * enum (not a bool) and only carries a price for *premium* names, so `price` is\n * set from the premium \"register\" price when present.\n */\n override async checkAvailability(\n domainNames: string[],\n opts?: RequestOptions\n ): Promise<DomainAvailability[]> {\n const res = await this.http.request<{ domains?: SpaceshipAvailability[] }>({\n method: 'POST',\n path: '/v1/domains/available',\n body: { domains: domainNames },\n ...opts,\n });\n return (res.domains ?? []).map(a => {\n const premium = (a.premiumPricing?.length ?? 0) > 0;\n const registerPrice = a.premiumPricing?.find(p => p.operation === 'register');\n return {\n domainName: a.domain ?? '',\n available: a.result === 'available',\n premium,\n price: registerPrice?.price,\n currency: registerPrice?.currency,\n };\n });\n }\n\n override getPricing(_tldOrDomain: string, _opts?: RequestOptions): Promise<TldPricing> {\n return Promise.reject(\n new NotImplementedError(\n `${this.name}: getPricing is not available — Spaceship exposes no pricing endpoint ` +\n '(only per-domain premium prices via an availability check)'\n )\n );\n }\n\n /**\n * Registers a domain. Contacts are separate resources, so this saves each\n * supplied contact (getting an id) and references the ids on the domain;\n * omitted roles fall back to the registrant. Registration is async (202).\n */\n override async registerDomain(\n domainName: string,\n input: RegisterDomainInput,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n requireConsent(this.name, input.consent);\n if (!input.contacts.registrant) {\n throw new Error(`${this.name}: registration requires at least a registrant contact`);\n }\n try {\n const contacts = await this.saveContactSet(input.contacts, opts);\n const body = {\n autoRenew: input.autoRenew ?? false,\n years: input.years ?? 1,\n privacyProtection: { level: input.privacy ? 'high' : 'public', userConsent: true },\n contacts,\n };\n await this.http.request({\n method: 'POST',\n path: `/v1/domains/${encodeURIComponent(domainName)}`,\n body,\n ...opts,\n });\n return { success: true, message: `Domain ${domainName} registration requested successfully` };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n /**\n * Transfers a domain in with its auth code. Contacts are optional (Spaceship\n * carries over the existing registration's where not supplied); when given,\n * they're saved and referenced by id. Async (202).\n */\n override async transferIn(\n domainName: string,\n input: TransferDomainInput,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n requireConsent(this.name, input.consent);\n try {\n const body: Record<string, unknown> = {\n authCode: input.authCode,\n autoRenew: input.autoRenew ?? false,\n };\n if (input.privacy != null) {\n body.privacyProtection = { level: input.privacy ? 'high' : 'public', userConsent: true };\n }\n if (input.contacts) body.contacts = await this.saveContactSet(input.contacts, opts);\n await this.http.request({\n method: 'POST',\n path: `/v1/domains/${encodeURIComponent(domainName)}/transfer`,\n body,\n ...opts,\n });\n return { success: true, message: `Domain ${domainName} transfer requested successfully` };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n /**\n * Renewal is async (202 + operation id). Spaceship requires the current\n * expiration date as a guard, so this fetches the domain first to supply it.\n */\n override async renewDomain(\n domainName: string,\n years = 1,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const d = await this.getRaw(domainName, opts);\n if (!d.expirationDate) {\n throw new Error(`Spaceship: could not determine current expiration date for ${domainName}`);\n }\n return this.mutate(\n {\n method: 'POST',\n path: `/v1/domains/${encodeURIComponent(domainName)}/renew`,\n body: { years, currentExpirationDate: d.expirationDate },\n },\n 'Domain renewal requested successfully',\n opts\n );\n }\n\n override async setAutoRenew(\n domainName: string,\n enabled: boolean,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.mutate(\n {\n method: 'PUT',\n path: `/v1/domains/${encodeURIComponent(domainName)}/autorenew`,\n body: { isEnabled: enabled },\n },\n `Auto-renew ${enabled ? 'enabled' : 'disabled'} successfully`,\n opts\n );\n }\n\n override async updateNameservers(\n domainName: string,\n nameservers: string[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.mutate(\n {\n method: 'PUT',\n path: `/v1/domains/${encodeURIComponent(domainName)}/nameservers`,\n // custom nameservers go under a provider wrapper\n body: { provider: 'custom', hosts: nameservers },\n },\n 'Nameservers updated successfully',\n opts\n );\n }\n\n override async lockDomain(domainName: string, opts?: RequestOptions): Promise<OperationResult> {\n return this.mutate(\n {\n method: 'PUT',\n path: `/v1/domains/${encodeURIComponent(domainName)}/transfer/lock`,\n body: { isLocked: true },\n },\n 'Domain transfer lock enabled successfully',\n opts\n );\n }\n\n override async unlockDomain(domainName: string, opts?: RequestOptions): Promise<OperationResult> {\n return this.mutate(\n {\n method: 'PUT',\n path: `/v1/domains/${encodeURIComponent(domainName)}/transfer/lock`,\n body: { isLocked: false },\n },\n 'Domain transfer lock disabled successfully',\n opts\n );\n }\n\n /**\n * WHOIS privacy via the privacy preference (`public` = details visible, `high`\n * = protected). Enabling requires consent, which calling this with\n * `enabled = true` supplies.\n */\n override async setPrivacy(\n domainName: string,\n enabled: boolean,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.mutate(\n {\n method: 'PUT',\n path: `/v1/domains/${encodeURIComponent(domainName)}/privacy/preference`,\n body: { privacyLevel: enabled ? 'high' : 'public', userConsent: enabled },\n },\n `Privacy ${enabled ? 'enabled' : 'disabled'} successfully`,\n opts\n );\n }\n\n override async getContacts(domainName: string, opts?: RequestOptions): Promise<ContactSet> {\n const d = await this.getRaw(domainName, opts);\n const refs = d.contacts ?? {};\n // contacts are referenced by id; resolve each present role in parallel\n const [registrant, admin, tech, billing] = await Promise.all([\n this.getContact(refs.registrant, opts),\n this.getContact(refs.admin, opts),\n this.getContact(refs.tech, opts),\n this.getContact(refs.billing, opts),\n ]);\n return { registrant, admin, tech, billing };\n }\n\n /**\n * Two-step: save each supplied contact (which returns a contact id), then\n * assign the ids to the domain. Spaceship requires a registrant on assignment,\n * so any omitted role falls back to the registrant.\n */\n override async updateContacts(\n domainName: string,\n contacts: ContactSet,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n if (!contacts.registrant) {\n throw new Error(`${this.name}: updateContacts requires at least a registrant contact`);\n }\n try {\n const contactIds = await this.saveContactSet(contacts, opts);\n await this.http.request({\n method: 'PUT',\n path: `/v1/domains/${encodeURIComponent(domainName)}/contacts`,\n body: contactIds,\n ...opts,\n });\n return { success: true, message: 'Contacts updated successfully' };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n override async getDnsRecords(domainName: string, opts?: RequestOptions): Promise<DnsRecord[]> {\n const records = await this.fetchRecords(domainName, opts);\n return records.map(toDnsRecord);\n }\n\n /**\n * Spaceship's DNS API is upsert-based (PUT adds/updates; there is no atomic\n * replace). To honor replace semantics, this upserts the new set, then deletes\n * any custom records whose (type, name) is no longer present — done in that\n * order so the zone is never momentarily empty. Only the common record types\n * are writable from the generic shape (see `WRITABLE_DNS_TYPES`).\n */\n override async setDnsRecords(\n domainName: string,\n records: DnsRecord[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const items = records.map(toSpaceshipRecord);\n try {\n const existing = await this.fetchRecords(domainName, opts);\n\n // The upsert endpoint rejects an empty `items` array (422), so skip it when\n // there's nothing to add/replace — clearing a zone is then handled entirely\n // by the stale-delete pass below.\n if (items.length > 0) {\n await this.http.request({\n method: 'PUT',\n path: `/v1/dns/records/${encodeURIComponent(domainName)}`,\n body: { force: true, items },\n ...opts,\n });\n }\n\n // delete custom records whose (type, name) no longer appears in the new\n // set. Spaceship's delete endpoint matches on the full record, so it needs\n // each record's value field (address/cname/value/exchange/…) — send the\n // existing records with only the read-only `group` metadata stripped.\n const keep = new Set(items.map(r => recordKey(r.type, r.name)));\n const stale = existing\n .filter(r => (r.group?.type ?? 'custom') === 'custom')\n .filter(r => !keep.has(recordKey(r.type, r.name)))\n .map(({ group: _group, ...rr }) => rr);\n if (stale.length > 0) {\n await this.http.request({\n method: 'DELETE',\n path: `/v1/dns/records/${encodeURIComponent(domainName)}`,\n body: stale,\n ...opts,\n });\n }\n return { success: true, message: 'DNS records updated successfully' };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n // --- internal helpers ---\n\n // GET a single domain's raw payload\n private getRaw(domainName: string, opts?: RequestOptions): Promise<SpaceshipDomain> {\n return this.http.request<SpaceshipDomain>({\n path: `/v1/domains/${encodeURIComponent(domainName)}`,\n ...opts,\n });\n }\n\n // resolve one contact id to a normalized Contact (undefined if unset)\n private async getContact(\n id: string | undefined,\n opts?: RequestOptions\n ): Promise<Contact | undefined> {\n if (!id) return undefined;\n const c = await this.http.request<SpaceshipContact>({\n path: `/v1/contacts/${encodeURIComponent(id)}`,\n ...opts,\n });\n return fromSpaceshipContact(c);\n }\n\n // save all four contact roles and return their ids (Spaceship requires a\n // registrant; omitted roles fall back to it)\n private async saveContactSet(\n contacts: ContactSet,\n opts?: RequestOptions\n ): Promise<SpaceshipDomainContacts> {\n if (!contacts.registrant) {\n throw new Error(`${this.name}: a registrant contact is required`);\n }\n const registrant = await this.saveContact(contacts.registrant, opts);\n return {\n registrant,\n admin: contacts.admin ? await this.saveContact(contacts.admin, opts) : registrant,\n tech: contacts.tech ? await this.saveContact(contacts.tech, opts) : registrant,\n billing: contacts.billing ? await this.saveContact(contacts.billing, opts) : registrant,\n };\n }\n\n // save a contact and return its Spaceship contact id\n private async saveContact(contact: Contact, opts?: RequestOptions): Promise<string> {\n const res = await this.http.request<{ contactId: string }>({\n method: 'PUT',\n path: '/v1/contacts',\n body: toSpaceshipContact(contact),\n ...opts,\n });\n return res.contactId;\n }\n\n // fetch all DNS records for a domain (paginated; take/skip are required)\n private async fetchRecords(\n domainName: string,\n opts?: RequestOptions\n ): Promise<SpaceshipRecord[]> {\n const records: SpaceshipRecord[] = [];\n const take = 100;\n let skip = 0;\n let hasMore = true;\n while (hasMore) {\n const res = await this.http.request<SpaceshipPage<SpaceshipRecord>>({\n path: `/v1/dns/records/${encodeURIComponent(domainName)}`,\n query: { take, skip },\n ...opts,\n });\n const items = res.items ?? [];\n records.push(...items);\n hasMore = items.length === take;\n skip += take;\n if (hasMore) await sleep(200);\n }\n return records;\n }\n\n // map a Spaceship domain payload to the normalized Domain shape\n private toDomain(d: SpaceshipDomain): Domain {\n return createDomain({\n domainName: d.name,\n registrar: this.name,\n status: d.lifecycleStatus ?? '',\n createdDate: d.registrationDate,\n expirationDate: d.expirationDate,\n renewalDate: d.expirationDate,\n autoRenew: d.autoRenew ?? false,\n // transfer lock shows up as an EPP status, not a dedicated flag\n locked: (d.eppStatuses ?? []).includes('clientTransferProhibited'),\n privacy: d.privacyProtection?.level === 'high',\n // normalizeNameservers understands the { hosts } shape\n nameservers: d.nameservers,\n });\n }\n\n // run a mutating request; success is any 2xx (async ops return 202)\n private async mutate(\n req: { method: string; path: string; body?: unknown },\n successMessage: string,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n try {\n await this.http.request({ ...req, ...opts });\n return { success: true, message: successMessage };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n}\n\n// --- record mapping between Spaceship's per-type shape and our DnsRecord ---\n\n// extract the primary value for a Spaceship record based on its type\nfunction spaceshipRecordValue(r: SpaceshipRecord, type: string): string {\n switch (type) {\n case 'A':\n case 'AAAA':\n return r.address ?? '';\n case 'CNAME':\n return r.cname ?? '';\n case 'NS':\n return r.nameserver ?? '';\n case 'MX':\n return r.exchange ?? '';\n case 'SRV':\n case 'ALIAS':\n return r.target ?? '';\n default:\n return r.value ?? '';\n }\n}\n\nfunction toDnsRecord(r: SpaceshipRecord): DnsRecord {\n const type = (r.type ?? '').toUpperCase();\n const record: DnsRecord = { type, name: r.name ?? '', value: spaceshipRecordValue(r, type) };\n if (r.ttl != null) record.ttl = r.ttl;\n if (type === 'MX' && r.preference != null) record.priority = r.preference;\n if (type === 'SRV') {\n if (r.priority != null) record.priority = r.priority;\n if (r.weight != null) record.weight = r.weight;\n if (r.port != null) record.port = r.port;\n }\n return record;\n}\n\nfunction toSpaceshipRecord(r: DnsRecord): SpaceshipRecord {\n const type = r.type.toUpperCase();\n if (!WRITABLE_DNS_TYPES.has(type)) {\n throw new Error(`Spaceship: writing DNS record type '${type}' is not supported`);\n }\n const record: SpaceshipRecord = { type, name: r.name || '@' };\n if (r.ttl != null) record.ttl = r.ttl;\n switch (type) {\n case 'A':\n case 'AAAA':\n record.address = r.value;\n break;\n case 'CNAME':\n record.cname = r.value;\n break;\n case 'NS':\n record.nameserver = r.value;\n break;\n case 'MX':\n record.exchange = r.value;\n record.preference = r.priority ?? 10;\n break;\n default: // TXT\n record.value = r.value;\n }\n return record;\n}\n\n// a stable key for a (type, name) pair, for set membership\nfunction recordKey(type: string | undefined, name: string | undefined): string {\n return `${(type ?? '').toUpperCase()}\\x00${name ?? '@'}`;\n}\n\n// --- contact mapping between Spaceship's shape and the normalized Contact ---\n\nfunction fromSpaceshipContact(c: SpaceshipContact): Contact {\n return {\n firstName: c.firstName ?? '',\n lastName: c.lastName ?? '',\n organization: c.organization,\n email: c.email ?? '',\n phone: c.phone ?? '',\n fax: c.fax,\n address1: c.address1 ?? '',\n address2: c.address2,\n city: c.city ?? '',\n state: c.stateProvince,\n postalCode: c.postalCode ?? '',\n country: c.country ?? '',\n };\n}\n\nfunction toSpaceshipContact(c: Contact): SpaceshipContact {\n return {\n firstName: c.firstName,\n lastName: c.lastName,\n organization: c.organization,\n email: c.email,\n phone: c.phone,\n fax: c.fax,\n address1: c.address1,\n address2: c.address2,\n city: c.city,\n stateProvince: c.state,\n postalCode: c.postalCode,\n country: c.country,\n };\n}\n","import type {\n Registrar,\n RegistrarConstructor,\n RegistrarCredentials,\n RegistrarOptions,\n} from '../types';\nimport { CloudflareRegistrar } from './cloudflare';\nimport { DynadotRegistrar } from './dynadot';\nimport { GandiRegistrar } from './gandi';\nimport { GoDaddyRegistrar } from './godaddy';\nimport { NameBrightRegistrar } from './namebright';\nimport { NamecheapRegistrar } from './namecheap';\nimport { NameSiloRegistrar } from './namesilo';\nimport { PorkbunRegistrar } from './porkbun';\nimport { SpaceshipRegistrar } from './spaceship';\n\n// the built-in registrar providers, keyed by id\nexport const registrars = {\n cloudflare: CloudflareRegistrar,\n dynadot: DynadotRegistrar,\n gandi: GandiRegistrar,\n godaddy: GoDaddyRegistrar,\n namebright: NameBrightRegistrar,\n namecheap: NamecheapRegistrar,\n namesilo: NameSiloRegistrar,\n porkbun: PorkbunRegistrar,\n spaceship: SpaceshipRegistrar,\n} satisfies Record<string, RegistrarConstructor>;\n\n// id of a built-in registrar\nexport type RegistrarName = keyof typeof registrars;\n\n// construct a registrar provider by id\nexport function createRegistrar(\n name: RegistrarName,\n credentials: RegistrarCredentials,\n options?: RegistrarOptions\n): Registrar {\n const RegistrarClass = registrars[name];\n return new RegistrarClass(credentials, options);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/errors.ts","../src/utils.ts","../src/client.ts","../src/portfolio.ts","../src/constants.ts","../src/http.ts","../src/features.ts","../src/registrar.ts","../src/registrars/cloudflare.ts","../src/registrars/dynadot.ts","../src/registrars/gandi.ts","../src/registrars/godaddy.ts","../src/registrars/namebright.ts","../src/xml.ts","../src/registrars/namecheap.ts","../src/registrars/namesilo.ts","../src/registrars/porkbun.ts","../src/registrars/spaceship.ts","../src/registrars/index.ts"],"names":["d","text","sleep","body","toContact","toDnsRecord","res","joinPhone","isOk","toPrice","statusResult","isYes"],"mappings":";;;AACO,SAAS,iBA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,EACV,OAAA,EAAS,gBAAA;AAAA,EACT,SAAA,EAAW;AACb;AAMO,SAAS,eAAA,CACd,IAAA,EACA,WAAA,EACA,OAAA,EACW;AACX,EAAA,MAAM,cAAA,GAAiB,WAAW,IAAI,CAAA;AACtC,EAAA,OAAO,IAAI,cAAA,CAAe,WAAA,EAAa,OAAO,CAAA;AAChD","file":"index.js","sourcesContent":["// convert any thrown value to a RegistrarError (preserves existing RegistrarError instances)\nexport function toRegistrarError(error: unknown): RegistrarError {\n // already a RegistrarError, return as-is\n if (error instanceof RegistrarError) {\n return error;\n }\n\n // extract message from Error or convert unknown to string\n const message =\n error instanceof Error ? error.message : String(error) || 'An unknown error occurred';\n\n // wrap in a concrete RegistrarError instance\n const wrapped = new (class extends RegistrarError {})(message);\n\n // preserve the original error's identity where possible\n if (error instanceof Error) {\n wrapped.name = error.name;\n wrapped.stack = error.stack;\n } else {\n wrapped.name = 'RegistrarError';\n }\n\n return wrapped;\n}\n\n// base error class for registrar client errors\n// `status` mirrors an HTTP-style status code where meaningful\nexport class RegistrarError extends Error {\n public status: number;\n // optional machine-readable code from the underlying registrar API\n public providerCode?: string;\n\n constructor(message: string) {\n super(message);\n this.name = 'RegistrarError';\n this.status = -1;\n\n Object.setPrototypeOf(this, new.target.prototype);\n\n // maintain proper stack trace (V8/Node only)\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n }\n }\n\n // determine if this error should trigger a retry\n // overridden by subclasses for custom logic\n shouldRetry(): boolean {\n return false;\n }\n}\n\n// base class for transient errors that are safe to retry\nexport class RetryableRegistrarError extends RegistrarError {\n constructor(message: string) {\n super(message);\n this.name = 'RetryableRegistrarError';\n }\n\n shouldRetry(): boolean {\n return true;\n }\n}\n\n// request timed out\nexport class TimeoutError extends RetryableRegistrarError {\n public status = 408; // Request Timeout\n\n constructor(message: string) {\n super(message);\n this.name = 'TimeoutError';\n }\n}\n\n// network/connection failure reaching the registrar API\nexport class ConnectionError extends RetryableRegistrarError {\n public status = 503; // Service Unavailable\n\n constructor(message: string) {\n super(message);\n this.name = 'ConnectionError';\n }\n}\n\n// registrar API rejected the credentials\nexport class AuthenticationError extends RegistrarError {\n public status = 401; // Unauthorized\n\n constructor(message: string) {\n super(message);\n this.name = 'AuthenticationError';\n }\n}\n\n// caller lacks permission for the requested operation\nexport class AuthorizationError extends RegistrarError {\n public status = 403; // Forbidden\n\n constructor(message: string) {\n super(message);\n this.name = 'AuthorizationError';\n }\n}\n\n// requested resource (domain, contact, etc.) was not found\nexport class NotFoundError extends RegistrarError {\n public status = 404; // Not Found\n\n constructor(message: string) {\n super(message);\n this.name = 'NotFoundError';\n }\n}\n\n// registrar API rate limit exceeded\nexport class RateLimitError extends RetryableRegistrarError {\n public status = 429; // Too Many Requests\n // seconds to wait before retrying, if provided by the API\n public retryAfter?: number;\n\n constructor(message: string, retryAfter?: number) {\n super(message);\n this.name = 'RateLimitError';\n this.retryAfter = retryAfter;\n }\n}\n\n// registrar API returned a response we couldn't understand\nexport class InvalidResponseError extends RetryableRegistrarError {\n public status = 502; // Bad Gateway\n\n constructor(message: string) {\n super(message);\n this.name = 'InvalidResponseError';\n }\n}\n\n// failed to parse a response payload\nexport class ParsingError extends RegistrarError {\n public status = 422; // Unprocessable Entity\n\n constructor(message: string) {\n super(message);\n this.name = 'ParsingError';\n }\n}\n\n// invalid client configuration or arguments\nexport class ConfigurationError extends RegistrarError {\n public status = 500; // Internal Server Error\n\n constructor(message: string) {\n super(message);\n this.name = 'ConfigurationError';\n }\n}\n\n// a registration/transfer was attempted without the consent the registrar\n// requires (accepting its registration agreements). Distinct from\n// NotImplementedError: the capability exists, but the caller must supply consent.\nexport class ConsentRequiredError extends RegistrarError {\n public status = 400; // Bad Request\n\n constructor(message: string) {\n super(message);\n this.name = 'ConsentRequiredError';\n }\n}\n\n// the requested capability is not implemented by this provider\nexport class NotImplementedError extends RegistrarError {\n public status = 501; // Not Implemented\n\n constructor(message: string) {\n super(message);\n this.name = 'NotImplementedError';\n }\n}\n\n// request was cancelled via an AbortSignal\nexport class AbortError extends RegistrarError {\n public status = 499; // Client Closed Request\n\n constructor(message: string) {\n super(message);\n this.name = 'AbortError';\n }\n\n shouldRetry(): boolean {\n return false;\n }\n}\n","import type { DomainForward, Domain, DomainInput, RegistrationConsent } from './types';\nimport { ConsentRequiredError } from './errors';\n\n// sleep helper for retry backoff\nexport function sleep(ms: number): Promise<void> {\n return new Promise(resolve => setTimeout(resolve, ms));\n}\n\n// a DomainForward that is safe to write: masked/framed forwarding is read-only.\nexport type SettableDomainForward = DomainForward & { type: 'temporary' | 'permanent' };\n\nexport const MASKED_FORWARD_UNSUPPORTED =\n 'masked/framed forwarding is not supported by this library; use \"temporary\" or \"permanent\"';\n\n// Guard for `setDomainForwarding`: reject any masked/framed forward up front (so\n// no partial write happens) and narrow the list to the settable types. Providers\n// call this before writing.\nexport function settableForwards(forwards: DomainForward[]): SettableDomainForward[] {\n for (const f of forwards) {\n if (f.type === 'masked') throw new Error(MASKED_FORWARD_UNSUPPORTED);\n }\n return forwards as SettableDomainForward[];\n}\n\n// guard for register/transfer: registration forms a legal contract with the\n// registry, so a provider must be given explicit consent. Throws\n// ConsentRequiredError (distinct from NotImplementedError) when it's absent.\nexport function requireConsent(\n provider: string,\n consent: RegistrationConsent | undefined\n): RegistrationConsent {\n if (!consent) {\n throw new ConsentRequiredError(\n `${provider}: this operation requires consent — supply \\`consent\\` ` +\n '(accepting the registrar’s registration agreements)'\n );\n }\n return consent;\n}\n\n// filter a domain list by a case-insensitive substring of the domain name.\n// Providers that filter server-side still call this — the re-filter is a\n// harmless no-op there — so every provider applies `search` consistently.\nexport function filterDomains(domains: Domain[], search?: string): Domain[] {\n const q = search?.trim().toLowerCase();\n if (!q) return domains;\n return domains.filter(d => d.domainName.toLowerCase().includes(q));\n}\n\n// normalize a domain name: trim, lowercase, strip a single trailing dot\nexport function normalizeDomain(domain: string): string {\n return domain.trim().toLowerCase().replace(/\\.$/, '');\n}\n\n// exponential backoff delay: backoff * 2^attempt\nexport function backoffDelay(backoff: number, attempt: number): number {\n return backoff * Math.pow(2, attempt);\n}\n\n// parse a variety of date representations into a Date (or null)\n// handles ISO strings, epoch millis (as number or numeric string), and Date\nexport function parseDate(value: Date | string | number | null | undefined): Date | null {\n if (value == null || value === '') return null;\n if (value instanceof Date) return isNaN(value.getTime()) ? null : value;\n\n // numeric epoch millis (e.g. Dynadot returns ms timestamps)\n if (typeof value === 'number') {\n const d = new Date(value);\n return isNaN(d.getTime()) ? null : d;\n }\n\n // numeric string that looks like an epoch-millis timestamp\n const asNumber = Number(value);\n if (!isNaN(asNumber) && asNumber > 1_000_000_000_000) {\n const d = new Date(asNumber);\n return isNaN(d.getTime()) ? null : d;\n }\n\n const d = new Date(value);\n return isNaN(d.getTime()) ? null : d;\n}\n\n// normalize nameservers into a flat array of hostname strings.\n// accepts: string[], { hosts: string[] } (Spaceship), or objects with a\n// ServerName property (Dynadot), falling back to String() for anything else.\n// Hostnames are trimmed and lowercased (they're case-insensitive, but providers\n// return mixed case), and blanks are dropped.\nexport function normalizeNameservers(nameservers: unknown): string[] {\n if (!nameservers) return [];\n\n let raw: unknown[];\n\n // object with a `hosts` array (Spaceship shape)\n if (\n typeof nameservers === 'object' &&\n !Array.isArray(nameservers) &&\n Array.isArray((nameservers as { hosts?: unknown }).hosts)\n ) {\n raw = (nameservers as { hosts: unknown[] }).hosts;\n } else if (Array.isArray(nameservers)) {\n raw = nameservers;\n } else {\n return [];\n }\n\n return raw\n .map(ns => {\n if (typeof ns === 'string') return ns;\n if (ns && typeof ns === 'object' && 'ServerName' in ns) {\n return String(ns.ServerName);\n }\n return String(ns);\n })\n .map(host => host.trim().toLowerCase())\n .filter(Boolean);\n}\n\n// build a normalized Domain from loose provider input:\n// lowercases status, normalizes nameservers, and coerces dates.\nexport function createDomain(data: DomainInput = {}): Domain {\n return {\n domainName: data.domainName ?? '',\n registrar: data.registrar ?? '',\n status: (data.status ?? '').toLowerCase(),\n createdDate: parseDate(data.createdDate),\n expirationDate: parseDate(data.expirationDate),\n renewalDate: parseDate(data.renewalDate),\n autoRenew: data.autoRenew ?? false,\n locked: data.locked ?? false,\n privacy: data.privacy ?? false,\n nameservers: normalizeNameservers(data.nameservers),\n syncedAt: data.syncedAt ?? new Date(),\n deleted: data.deleted ?? false,\n };\n}\n","import { normalizeDomain, normalizeNameservers } from './utils';\nimport type {\n ConnectionResult,\n ContactSet,\n DnsRecord,\n Domain,\n DomainAvailability,\n DomainForward,\n EmailForward,\n ListDomainsOptions,\n OperationResult,\n Registrar,\n RegisterDomainInput,\n RequestOptions,\n TldPricing,\n TransferDomainInput,\n} from './types';\n\n// A thin, provider-agnostic facade over a single `Registrar`. Normalizes\n// domain names and delegates to the underlying provider.\n//\n// const client = new RegistrarClient(createRegistrar('cloudflare', creds));\n// await client.listDomains();\nexport class RegistrarClient {\n constructor(public readonly provider: Registrar) {}\n\n testConnection(opts?: RequestOptions): Promise<ConnectionResult> {\n return this.provider.testConnection(opts);\n }\n\n async listDomains(opts?: ListDomainsOptions): Promise<Domain[]> {\n const domains = await this.provider.listDomains(opts);\n if (!opts?.detailed) return domains;\n return this.enrichWithDetail(domains, opts);\n }\n\n // Fills fields that a provider's list endpoint omits (nameservers, privacy,\n // lock) by fetching each domain's detail and merging it over the summary.\n // Runs with bounded concurrency; a per-domain detail failure leaves that\n // domain's summary values untouched rather than failing the whole listing.\n private async enrichWithDetail(domains: Domain[], opts: RequestOptions): Promise<Domain[]> {\n const CONCURRENCY = 5;\n const result = [...domains];\n let next = 0;\n const worker = async (): Promise<void> => {\n while (next < domains.length) {\n const index = next++;\n const name = domains[index].domainName;\n try {\n const detail = await this.provider.getDomain(name, opts);\n let merged = { ...domains[index], ...detail };\n // Some providers expose nameservers only via a dedicated endpoint, not\n // on the domain detail — fetch them separately when still empty.\n if (merged.nameservers.length === 0) {\n try {\n const nameservers = normalizeNameservers(\n await this.provider.getNameservers(name, opts)\n );\n if (nameservers.length > 0) merged = { ...merged, nameservers };\n } catch {\n // leave nameservers empty if this provider can't supply them\n }\n }\n result[index] = merged;\n } catch {\n // keep the summary values for this domain on detail failure\n }\n }\n };\n const workers = Array.from({ length: Math.min(CONCURRENCY, domains.length) }, worker);\n await Promise.all(workers);\n return result;\n }\n\n getDomain(domainName: string, opts?: RequestOptions): Promise<Domain> {\n return this.provider.getDomain(normalizeDomain(domainName), opts);\n }\n\n checkAvailability(domainNames: string[], opts?: RequestOptions): Promise<DomainAvailability[]> {\n return this.provider.checkAvailability(domainNames.map(normalizeDomain), opts);\n }\n\n getPricing(tldOrDomain: string, opts?: RequestOptions): Promise<TldPricing> {\n return this.provider.getPricing(normalizeDomain(tldOrDomain), opts);\n }\n\n registerDomain(\n domainName: string,\n input: RegisterDomainInput,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.provider.registerDomain(normalizeDomain(domainName), input, opts);\n }\n\n renewDomain(domainName: string, years?: number, opts?: RequestOptions): Promise<OperationResult> {\n return this.provider.renewDomain(normalizeDomain(domainName), years, opts);\n }\n\n setAutoRenew(\n domainName: string,\n enabled: boolean,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.provider.setAutoRenew(normalizeDomain(domainName), enabled, opts);\n }\n\n transferIn(\n domainName: string,\n input: TransferDomainInput,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.provider.transferIn(normalizeDomain(domainName), input, opts);\n }\n\n updateNameservers(\n domainName: string,\n nameservers: string[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.provider.updateNameservers(normalizeDomain(domainName), nameservers, opts);\n }\n\n async getNameservers(domainName: string, opts?: RequestOptions): Promise<string[]> {\n return normalizeNameservers(\n await this.provider.getNameservers(normalizeDomain(domainName), opts)\n );\n }\n\n lockDomain(domainName: string, opts?: RequestOptions): Promise<OperationResult> {\n return this.provider.lockDomain(normalizeDomain(domainName), opts);\n }\n\n unlockDomain(domainName: string, opts?: RequestOptions): Promise<OperationResult> {\n return this.provider.unlockDomain(normalizeDomain(domainName), opts);\n }\n\n setPrivacy(\n domainName: string,\n enabled: boolean,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.provider.setPrivacy(normalizeDomain(domainName), enabled, opts);\n }\n\n getContacts(domainName: string, opts?: RequestOptions): Promise<ContactSet> {\n return this.provider.getContacts(normalizeDomain(domainName), opts);\n }\n\n updateContacts(\n domainName: string,\n contacts: ContactSet,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.provider.updateContacts(normalizeDomain(domainName), contacts, opts);\n }\n\n getDnsRecords(domainName: string, opts?: RequestOptions): Promise<DnsRecord[]> {\n return this.provider.getDnsRecords(normalizeDomain(domainName), opts);\n }\n\n setDnsRecords(\n domainName: string,\n records: DnsRecord[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.provider.setDnsRecords(normalizeDomain(domainName), records, opts);\n }\n\n // --- extended: forwarding ---\n //\n // Opt-in per provider (gate on `provider.supports(Feature.…)`); providers that\n // don't declare the feature reject with NotImplementedError. Email forwarding\n // (alias → address) and URL/domain forwarding (host → URL redirect) are\n // unrelated capabilities with separate feature flags. Each `set…` is a full\n // replace: any rule omitted is removed, an empty array clears forwarding.\n\n getEmailForwarding(domainName: string, opts?: RequestOptions): Promise<EmailForward[]> {\n return this.provider.getEmailForwarding(normalizeDomain(domainName), opts);\n }\n\n setEmailForwarding(\n domainName: string,\n forwards: EmailForward[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.provider.setEmailForwarding(normalizeDomain(domainName), forwards, opts);\n }\n\n getDomainForwarding(domainName: string, opts?: RequestOptions): Promise<DomainForward[]> {\n return this.provider.getDomainForwarding(normalizeDomain(domainName), opts);\n }\n\n setDomainForwarding(\n domainName: string,\n forwards: DomainForward[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.provider.setDomainForwarding(normalizeDomain(domainName), forwards, opts);\n }\n}\n","// Aggregate domains across multiple registrars into one combined portfolio.\n//\n// Each source is queried concurrently and failures are isolated per-registrar\n// (one provider being down never sinks the whole view). Every returned Domain\n// already carries its `registrar`, so the flattened list stays attributable.\n\nimport type { RegistrarClient } from './client';\nimport type { Domain, ListDomainsOptions, Registrar } from './types';\nimport { toRegistrarError } from './errors';\n\n// anything that can list domains: a raw Registrar or the RegistrarClient facade\nexport type DomainSource = Registrar | RegistrarClient;\n\n// a per-registrar failure from a portfolio fetch\nexport interface PortfolioError {\n // the registrar id that failed, e.g. \"godaddy\"\n registrar: string;\n error: Error;\n}\n\n// the outcome of a portfolio fetch: all domains that loaded, plus any errors\nexport interface PortfolioResult {\n domains: Domain[];\n errors: PortfolioError[];\n}\n\n// resolve a source's registrar id, whether it's a client facade or a provider\nfunction sourceName(source: DomainSource): string {\n return 'provider' in source ? source.provider.name : source.name;\n}\n\n/**\n * List domains across many registrars at once. Queries every source in parallel\n * and collects results with per-registrar error isolation.\n *\n * `opts` (including `search`) is passed to EACH source. Every source returns its\n * full account; order of the returned `domains` follows the order of `sources`.\n *\n * const { domains, errors } = await listPortfolio(\n * [godaddyClient, namecheapClient, gandiClient],\n * { search: 'acme' }\n * );\n */\nexport async function listPortfolio(\n sources: DomainSource[],\n opts?: ListDomainsOptions\n): Promise<PortfolioResult> {\n const settled = await Promise.allSettled(sources.map(source => source.listDomains(opts)));\n\n const domains: Domain[] = [];\n const errors: PortfolioError[] = [];\n\n settled.forEach((result, i) => {\n if (result.status === 'fulfilled') {\n domains.push(...result.value);\n } else {\n errors.push({\n registrar: sourceName(sources[i]),\n error: toRegistrarError(result.reason),\n });\n }\n });\n\n return { domains, errors };\n}\n","import type { RegistrarClientOptions } from './types';\n\n// default client-level options\nexport const DEFAULT_OPTIONS: RegistrarClientOptions = {\n timeout: 30_000, // 30s — registrar APIs can be slow, especially for registration\n retries: 2,\n backoff: 250,\n};\n\n// package identifier used in the default User-Agent header\nexport const USER_AGENT = '@aoxborrow/registrar-client';\n","import { USER_AGENT } from './constants';\nimport {\n AbortError,\n AuthenticationError,\n AuthorizationError,\n ConnectionError,\n InvalidResponseError,\n NotFoundError,\n ParsingError,\n RateLimitError,\n RegistrarError,\n TimeoutError,\n toRegistrarError,\n} from './errors';\nimport type { RegistrarClientOptions } from './types';\nimport { backoffDelay, sleep } from './utils';\n\n// configuration for an HttpClient instance\nexport interface HttpClientConfig {\n // base URL for all requests, e.g. \"https://api.example.com/v2\"\n baseUrl: string;\n // default headers applied to every request (e.g. Authorization) — never logged\n headers?: Record<string, string>;\n // request/retry behavior\n options: RegistrarClientOptions;\n}\n\n// options for a single request\nexport interface RequestConfig {\n method?: string;\n // path appended to baseUrl, or an absolute URL\n path: string;\n // query parameters (never used for secrets)\n query?: Record<string, string | number | boolean | undefined>;\n // JSON body; serialized with JSON.stringify\n body?: unknown;\n headers?: Record<string, string>;\n // per-request overrides\n timeout?: number;\n retries?: number;\n backoff?: number;\n signal?: AbortSignal;\n}\n\n// a small, browser/edge-safe fetch wrapper with timeout, abort linking,\n// retry-with-backoff, and registrar error mapping. No Node built-ins.\nexport class HttpClient {\n constructor(protected config: HttpClientConfig) {}\n\n // perform a request and parse a JSON response body\n async request<T = unknown>(req: RequestConfig): Promise<T> {\n return this.withRetries(req, async () => {\n const text = await this.send(req);\n if (text.length === 0) return undefined as T;\n try {\n return JSON.parse(text) as T;\n } catch (error) {\n throw new ParsingError(\n `Failed to parse JSON response from '${this.buildUrl(req)}': ${errorMessage(error)}`\n );\n }\n });\n }\n\n // perform a request and return the raw response body text (e.g. XML APIs)\n async requestText(req: RequestConfig): Promise<string> {\n return this.withRetries(req, () => this.send(req));\n }\n\n // shared retry-with-backoff wrapper around a single-attempt operation\n protected async withRetries<T>(req: RequestConfig, attemptFn: () => Promise<T>): Promise<T> {\n const retries = req.retries ?? this.config.options.retries;\n const backoff = req.backoff ?? this.config.options.backoff;\n\n let lastError: RegistrarError | undefined;\n for (let attempt = 0; attempt <= retries; attempt++) {\n try {\n return await attemptFn();\n } catch (error) {\n lastError = toRegistrarError(error);\n\n // out of attempts, or the error is not retryable\n if (attempt >= retries || !lastError.shouldRetry()) {\n throw lastError;\n }\n\n // honor Retry-After for rate limits when present, else exponential backoff\n const delay =\n lastError instanceof RateLimitError && lastError.retryAfter != null\n ? lastError.retryAfter * 1000\n : backoffDelay(backoff, attempt);\n await sleep(delay);\n }\n }\n\n // unreachable: the loop always returns or throws\n throw lastError ?? new RegistrarError('Request failed');\n }\n\n // build the full URL for a request, applying query parameters\n protected buildUrl(req: RequestConfig): string {\n let base: string;\n if (/^https?:\\/\\//.test(req.path)) {\n // absolute URL\n base = req.path;\n } else if (req.path === '') {\n // empty path: the baseUrl is itself the full endpoint (e.g. Namecheap/Dynadot)\n base = this.config.baseUrl;\n } else {\n base = `${this.config.baseUrl.replace(/\\/$/, '')}/${req.path.replace(/^\\//, '')}`;\n }\n const url = new URL(base);\n if (req.query) {\n for (const [key, value] of Object.entries(req.query)) {\n if (value !== undefined) url.searchParams.set(key, String(value));\n }\n }\n return url.toString();\n }\n\n // send a single request (no retries), map errors, and return the raw body text\n protected async send(req: RequestConfig): Promise<string> {\n const timeout = req.timeout ?? this.config.options.timeout;\n const externalSignal = req.signal ?? this.config.options.signal;\n\n // abort controller for this request, linked to any external signal\n const controller = new AbortController();\n if (externalSignal?.aborted) {\n throw new AbortError('Request was aborted');\n }\n const onAbort = () => controller.abort();\n externalSignal?.addEventListener('abort', onAbort);\n const timeoutId = setTimeout(() => controller.abort(), timeout);\n\n const url = this.buildUrl(req);\n const headers: Record<string, string> = {\n 'User-Agent': USER_AGENT,\n 'Accept': 'application/json',\n ...this.config.headers,\n ...req.headers,\n };\n if (req.body !== undefined && headers['Content-Type'] === undefined) {\n headers['Content-Type'] = 'application/json';\n }\n\n try {\n let response: Response;\n try {\n response = await fetch(url, {\n method: req.method ?? 'GET',\n headers,\n body: req.body !== undefined ? JSON.stringify(req.body) : undefined,\n signal: controller.signal,\n });\n } catch (error) {\n // distinguish abort/timeout from a genuine network failure\n if (isAbortError(error)) {\n if (externalSignal?.aborted) throw new AbortError('Request was aborted');\n throw new TimeoutError(`Request to '${url}' timed out after ${timeout}ms`);\n }\n throw new ConnectionError(`Failed to reach '${url}': ${errorMessage(error)}`);\n }\n\n if (!response.ok) {\n throw await this.toStatusError(response, url);\n }\n\n // 204 No Content yields an empty string\n if (response.status === 204) {\n return '';\n }\n return await response.text();\n } finally {\n clearTimeout(timeoutId);\n externalSignal?.removeEventListener('abort', onAbort);\n }\n }\n\n // map a non-2xx response to a typed RegistrarError\n protected async toStatusError(response: Response, url: string): Promise<RegistrarError> {\n // read the body defensively; it may aid debugging but must not be assumed JSON\n let detail = '';\n try {\n detail = (await response.text()).slice(0, 500);\n } catch {\n // ignore body read failures\n }\n const message = `Request to '${url}' failed with ${response.status} ${response.statusText}${\n detail ? `: ${detail}` : ''\n }`;\n\n switch (response.status) {\n case 401:\n return new AuthenticationError(message);\n case 403:\n return new AuthorizationError(message);\n case 404:\n return new NotFoundError(message);\n case 429: {\n const retryAfter = Number(response.headers.get('retry-after'));\n return new RateLimitError(message, Number.isFinite(retryAfter) ? retryAfter : undefined);\n }\n default: {\n if (response.status >= 500) {\n return new InvalidResponseError(message);\n }\n // preserve the real status for 4xx codes without a dedicated class\n // (400, 402, 409, 422, …) so callers can branch on it\n const err = new RegistrarError(message);\n err.status = response.status;\n return err;\n }\n }\n }\n}\n\n// detect an AbortController/fetch abort across environments\nfunction isAbortError(error: unknown): boolean {\n return (\n typeof error === 'object' &&\n error !== null &&\n 'name' in error &&\n (error as { name?: string }).name === 'AbortError'\n );\n}\n\n// safely extract a message from an unknown thrown value\nfunction errorMessage(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n","// Capability model for registrar providers.\n//\n// Features are identified by the string constants on `Feature`. Always reference\n// them through that object (e.g. `Feature.GetPricing`) rather than writing the\n// raw string — you get autocomplete and find-all-references, and typos become\n// compile errors.\n//\n// There are two kinds of feature:\n//\n// - CORE — the contract every provider is expected to fulfil. A provider\n// inherits the core surface by extending `BaseRegistrar`; it does not\n// re-declare it. Core is a deliberate product decision about what this\n// library guarantees, NOT the intersection of what today's registrars\n// happen to expose — so a single registrar's missing/undocumented endpoint\n// never demotes a feature out of core. Where a registrar's API path for a\n// core feature isn't wired up yet (or hasn't been found — e.g. DNS via\n// Cloudflare's separate Zones API), the method throws `NotImplementedError`\n// until implemented. The contract is the promise; `NotImplementedError` is\n// the \"not yet\".\n//\n// - EXTENDED — opt-in capabilities a provider declares via its static\n// `extendedFeatures`. This is where providers genuinely differ.\n//\n// A provider's full capability set is `CORE_FEATURES` ∪ its `extendedFeatures`,\n// exposed as `provider.features` (and statically as `Registrar.features`).\n\n// All feature identifiers. Reference these instead of string literals.\nexport const Feature = {\n // --- core (guaranteed contract; inherited from BaseRegistrar) ---\n TestConnection: 'testConnection', // verify credentials\n ListDomains: 'listDomains', // list domains in the account\n GetDomain: 'getDomain', // fetch a single domain's details\n CheckAvailability: 'checkAvailability', // check whether domains can be registered\n GetPricing: 'getPricing', // TLD/domain pricing lookup\n RegisterDomain: 'registerDomain', // register a new domain\n RenewDomain: 'renewDomain', // renew a domain\n SetAutoRenew: 'setAutoRenew', // toggle auto-renew\n TransferIn: 'transferIn', // transfer a domain into the account\n UpdateNameservers: 'updateNameservers', // replace a domain's nameservers\n GetNameservers: 'getNameservers', // read a domain's nameservers\n LockDomain: 'lockDomain', // enable the transfer lock\n UnlockDomain: 'unlockDomain', // disable the transfer lock\n SetPrivacy: 'setPrivacy', // toggle WHOIS privacy\n GetContacts: 'getContacts', // read registrant/admin/tech contacts\n UpdateContacts: 'updateContacts', // update registrant/admin/tech contacts\n GetDnsRecords: 'getDnsRecords', // read DNS records\n SetDnsRecords: 'setDnsRecords', // write DNS records\n\n // --- extended (opt-in; declared per provider) ---\n GetAuthCode: 'getAuthCode', // retrieve transfer auth/EPP code (transfer out)\n GetDnssec: 'getDnssec', // read whether DNSSEC is enabled (DS / key records)\n DisableDnssec: 'disableDnssec', // turn DNSSEC off (no enable / key management)\n GetEmailForwarding: 'getEmailForwarding', // read alias-style email forwarding rules\n SetEmailForwarding: 'setEmailForwarding', // alias-style email forwarding (redirect only)\n GetDomainForwarding: 'getDomainForwarding', // read URL redirect / domain forwarding\n SetDomainForwarding: 'setDomainForwarding', // URL redirect / domain forwarding\n} as const;\n\n// A registrar capability identifier — the value of one of the `Feature` members.\nexport type RegistrarFeature = (typeof Feature)[keyof typeof Feature];\n\n// The guaranteed core contract: every provider is expected to support these.\nexport const CORE_FEATURES = [\n Feature.TestConnection,\n Feature.ListDomains,\n Feature.GetDomain,\n Feature.CheckAvailability,\n Feature.GetPricing,\n Feature.RegisterDomain,\n Feature.RenewDomain,\n Feature.SetAutoRenew,\n Feature.TransferIn,\n Feature.UpdateNameservers,\n Feature.GetNameservers,\n Feature.LockDomain,\n Feature.UnlockDomain,\n Feature.SetPrivacy,\n Feature.GetContacts,\n Feature.UpdateContacts,\n Feature.GetDnsRecords,\n Feature.SetDnsRecords,\n] as const satisfies readonly RegistrarFeature[];\n\n// Every feature that is not part of the core contract. A provider opts into any\n// of these via its static `extendedFeatures`.\nexport const EXTENDED_FEATURES = [\n Feature.GetAuthCode,\n Feature.GetDnssec,\n Feature.DisableDnssec,\n Feature.GetEmailForwarding,\n Feature.SetEmailForwarding,\n Feature.GetDomainForwarding,\n Feature.SetDomainForwarding,\n] as const satisfies readonly RegistrarFeature[];\n\n// Every feature, core first.\nexport const ALL_FEATURES = [...CORE_FEATURES, ...EXTENDED_FEATURES] as const;\n\nconst CORE_FEATURE_SET: ReadonlySet<RegistrarFeature> = new Set(CORE_FEATURES);\n\n// true if `feature` is part of the guaranteed core contract\nexport function isCoreFeature(feature: RegistrarFeature): boolean {\n return CORE_FEATURE_SET.has(feature);\n}\n","import { DEFAULT_OPTIONS } from './constants';\nimport { ConfigurationError, NotImplementedError } from './errors';\nimport { HttpClient, type HttpClientConfig } from './http';\nimport { CORE_FEATURES, type RegistrarFeature } from './features';\nimport type {\n ConnectionResult,\n ContactSet,\n DnsRecord,\n Domain,\n DomainAvailability,\n DomainForward,\n DnssecStatus,\n EmailForward,\n ListDomainsOptions,\n OperationResult,\n Registrar,\n RegisterDomainInput,\n RegistrarClientOptions,\n RegistrarCredentials,\n RegistrarEnvironment,\n RegistrarOptions,\n RequestOptions,\n TldPricing,\n TransferDomainInput,\n} from './types';\n\n// pick the base URL for the requested environment. Throws if `sandbox` is\n// requested but the provider defines no sandbox URL — so integration tests\n// fail loudly rather than silently hitting production.\nexport function selectBaseUrl(\n registrar: string,\n environment: RegistrarEnvironment | undefined,\n urls: { production: string; sandbox?: string }\n): string {\n if (environment === 'sandbox') {\n if (!urls.sandbox) {\n throw new ConfigurationError(`${registrar} does not provide a sandbox environment`);\n }\n return urls.sandbox;\n }\n return urls.production;\n}\n\n// Abstract base for registrar providers. Owns the shared HTTP/auth/retry\n// plumbing (via `HttpClient`) and provides `NotImplementedError`-rejecting\n// defaults for every operation. Concrete providers extend this, build their\n// base URL + auth from the credentials passed to `super()`, and override the\n// operations their API supports.\nexport abstract class BaseRegistrar implements Registrar {\n abstract readonly name: string;\n\n protected http: HttpClient;\n protected credentials: RegistrarCredentials;\n protected options: RegistrarClientOptions;\n readonly environment: RegistrarEnvironment;\n\n // Extended capabilities this provider opts into, beyond the core contract.\n // Subclasses override this; core features are inherited and not re-declared.\n static readonly extendedFeatures: readonly RegistrarFeature[] = [];\n\n // The provider's full capability set: the core contract plus its extended\n // features. Available statically (no instance/credentials needed) for catalog\n // UIs and MCP tooling.\n static get features(): readonly RegistrarFeature[] {\n return [...CORE_FEATURES, ...this.extendedFeatures];\n }\n\n // instance mirror of the static `features`\n get features(): readonly RegistrarFeature[] {\n return (this.constructor as typeof BaseRegistrar).features;\n }\n\n // whether this provider supports a given capability\n supports(feature: RegistrarFeature): boolean {\n return this.features.includes(feature);\n }\n\n constructor(\n credentials: RegistrarCredentials,\n httpConfig: Omit<HttpClientConfig, 'options'>,\n options?: RegistrarOptions\n ) {\n const { environment = 'production', ...clientOptions } = options ?? {};\n this.credentials = credentials;\n this.environment = environment;\n this.options = { ...DEFAULT_OPTIONS, ...clientOptions };\n this.http = new HttpClient({ ...httpConfig, options: this.options });\n }\n\n testConnection(_opts?: RequestOptions): Promise<ConnectionResult> {\n return Promise.reject(\n new NotImplementedError(`${this.name}: testConnection is not implemented`)\n );\n }\n\n listDomains(_opts?: ListDomainsOptions): Promise<Domain[]> {\n return Promise.reject(new NotImplementedError(`${this.name}: listDomains is not implemented`));\n }\n\n renewDomain(\n _domainName: string,\n _years?: number,\n _opts?: RequestOptions\n ): Promise<OperationResult> {\n return Promise.reject(new NotImplementedError(`${this.name}: renewDomain is not implemented`));\n }\n\n updateNameservers(\n _domainName: string,\n _nameservers: string[],\n _opts?: RequestOptions\n ): Promise<OperationResult> {\n return Promise.reject(\n new NotImplementedError(`${this.name}: updateNameservers is not implemented`)\n );\n }\n\n lockDomain(_domainName: string, _opts?: RequestOptions): Promise<OperationResult> {\n return Promise.reject(new NotImplementedError(`${this.name}: lockDomain is not implemented`));\n }\n\n unlockDomain(_domainName: string, _opts?: RequestOptions): Promise<OperationResult> {\n return Promise.reject(new NotImplementedError(`${this.name}: unlockDomain is not implemented`));\n }\n\n getDomain(_domainName: string, _opts?: RequestOptions): Promise<Domain> {\n return this.notImplemented('getDomain');\n }\n\n checkAvailability(_domainNames: string[], _opts?: RequestOptions): Promise<DomainAvailability[]> {\n return this.notImplemented('checkAvailability');\n }\n\n getPricing(_tldOrDomain: string, _opts?: RequestOptions): Promise<TldPricing> {\n return this.notImplemented('getPricing');\n }\n\n registerDomain(\n _domainName: string,\n _input: RegisterDomainInput,\n _opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.notImplemented('registerDomain');\n }\n\n setAutoRenew(\n _domainName: string,\n _enabled: boolean,\n _opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.notImplemented('setAutoRenew');\n }\n\n transferIn(\n _domainName: string,\n _input: TransferDomainInput,\n _opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.notImplemented('transferIn');\n }\n\n getNameservers(_domainName: string, _opts?: RequestOptions): Promise<string[]> {\n return this.notImplemented('getNameservers');\n }\n\n setPrivacy(\n _domainName: string,\n _enabled: boolean,\n _opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.notImplemented('setPrivacy');\n }\n\n getContacts(_domainName: string, _opts?: RequestOptions): Promise<ContactSet> {\n return this.notImplemented('getContacts');\n }\n\n updateContacts(\n _domainName: string,\n _contacts: ContactSet,\n _opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.notImplemented('updateContacts');\n }\n\n getDnsRecords(_domainName: string, _opts?: RequestOptions): Promise<DnsRecord[]> {\n return this.notImplemented('getDnsRecords');\n }\n\n setDnsRecords(\n _domainName: string,\n _records: DnsRecord[],\n _opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.notImplemented('setDnsRecords');\n }\n\n // --- extended capabilities (opt-in; default to NotImplementedError) ---\n\n getEmailForwarding(_domainName: string, _opts?: RequestOptions): Promise<EmailForward[]> {\n return this.notImplemented('getEmailForwarding');\n }\n\n setEmailForwarding(\n _domainName: string,\n _forwards: EmailForward[],\n _opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.notImplemented('setEmailForwarding');\n }\n\n getDomainForwarding(_domainName: string, _opts?: RequestOptions): Promise<DomainForward[]> {\n return this.notImplemented('getDomainForwarding');\n }\n\n setDomainForwarding(\n _domainName: string,\n _forwards: DomainForward[],\n _opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.notImplemented('setDomainForwarding');\n }\n\n getAuthCode(_domainName: string, _opts?: RequestOptions): Promise<string> {\n return this.notImplemented('getAuthCode');\n }\n\n getDnssec(_domainName: string, _opts?: RequestOptions): Promise<DnssecStatus> {\n return this.notImplemented('getDnssec');\n }\n\n disableDnssec(_domainName: string, _opts?: RequestOptions): Promise<OperationResult> {\n return this.notImplemented('disableDnssec');\n }\n\n // shared rejection for a capability a provider hasn't wired up yet\n protected notImplemented(method: string): Promise<never> {\n return Promise.reject(new NotImplementedError(`${this.name}: ${method} is not implemented`));\n }\n}\n","import type {\n ConfigField,\n ConnectionResult,\n Contact,\n ContactSet,\n DnsRecord,\n Domain,\n DomainAvailability,\n DomainForward,\n EmailForward,\n ListDomainsOptions,\n OperationResult,\n RegisterDomainInput,\n RegistrarOptions,\n RequestOptions,\n TldPricing,\n} from '../types';\nimport { createDomain, filterDomains, normalizeDomain, settableForwards } from '../utils';\nimport { NotImplementedError, toRegistrarError } from '../errors';\nimport { BaseRegistrar, selectBaseUrl } from '../registrar';\nimport { Feature, type RegistrarFeature } from '../features';\nimport type { RegistrarCredentials } from '../types';\n\n// Cloudflare's standard response envelope\ninterface CfEnvelope<T> {\n success: boolean;\n errors?: { code?: number; message?: string }[];\n result?: T;\n}\n\n// a domain object from the Cloudflare Registrar API\ninterface CfDomain {\n name: string;\n // registrar domains report lifecycle under last_known_status (e.g.\n // \"registrationActive\") — there is no plain `status` field\n last_known_status?: string;\n registered_at?: string;\n expires_at?: string;\n auto_renew?: boolean;\n locked?: boolean;\n privacy?: boolean;\n name_servers?: string[];\n // WHOIS contacts, keyed by role, on the registrar domain payload\n contacts?: {\n registrant?: CfContact;\n administrator?: CfContact;\n technical?: CfContact;\n billing?: CfContact;\n };\n}\n\n// a WHOIS contact as the Cloudflare Registrar API returns it\ninterface CfContact {\n first_name?: string;\n last_name?: string;\n organization?: string;\n email?: string;\n phone?: string;\n fax?: string;\n address?: string;\n address2?: string;\n city?: string;\n state?: string;\n zip?: string;\n country?: string;\n}\n\n// a zone object from the Cloudflare Zones API. Nameservers and DNS records live\n// on the Zones API, not the Registrar API, so several read methods resolve the\n// domain to its zone first.\ninterface CfZone {\n id: string;\n name: string;\n name_servers?: string[];\n}\n\n// pricing (major currency units, as strings) on a domain-check / domain-search entry\ninterface CfPricing {\n currency?: string;\n registration_cost?: string;\n renewal_cost?: string;\n}\n\n// one entry from the registrar domain-check / domain-search result. `registrable`\n// is the authoritative availability flag; `reason` explains a false (e.g.\n// \"domain_premium\", \"extension_not_supported_via_api\").\ninterface CfDomainCheck {\n name: string;\n registrable: boolean;\n tier?: string;\n reason?: string;\n pricing?: CfPricing;\n}\n\n// the registration resource returned by POST /registrar/registrations and the\n// registration-status endpoint. `state` is the lifecycle; `completed` is a\n// convenience flag; registry details hang off context.registration.\ninterface CfRegistration {\n domain_name?: string;\n state?: 'in_progress' | 'succeeded' | 'failed' | 'action_required' | 'blocked';\n completed?: boolean;\n reason?: string;\n}\n\n// a rule in the http_request_dynamic_redirect phase ruleset (Single Redirects).\n// A domain forward is a static redirect: action \"redirect\" with a literal\n// target_url.value and a host-matching expression.\ninterface CfRedirectRule {\n id?: string;\n expression?: string;\n description?: string;\n action?: string;\n action_parameters?: {\n from_value?: {\n target_url?: { value?: string; expression?: string };\n status_code?: number;\n preserve_query_string?: boolean;\n };\n };\n}\n\ninterface CfRuleset {\n id?: string;\n rules?: CfRedirectRule[];\n}\n\n// an Email Routing rule: a matcher (literal \"to\" address, or \"all\" for the\n// catch-all) paired with a forward action carrying the destination address(es).\ninterface CfEmailRule {\n id?: string;\n name?: string;\n enabled?: boolean;\n matchers?: { type: string; field?: string; value?: string }[];\n actions?: { type: string; value?: string[] }[];\n}\n\ninterface CfEmailSettings {\n enabled?: boolean;\n status?: string;\n}\n\n// a DNS record from the Cloudflare Zones DNS API. For SRV records, weight/port\n// are carried on a nested `data` object; `content` holds the primary value for\n// every type, and `priority` is populated for MX/SRV.\ninterface CfDnsRecord {\n // record id, present on records read from the API (needed to delete them)\n id?: string;\n type: string;\n name: string;\n content?: string;\n ttl?: number;\n priority?: number;\n data?: {\n weight?: number;\n port?: number;\n priority?: number;\n };\n}\n\n/**\n * Cloudflare Registrar\n * API docs: https://developers.cloudflare.com/api/resources/registrar/\n *\n * Credentials: create an API token under My Profile > API Tokens with\n * \"Account.Registrar\" read/write permission. The Account ID is shown on the\n * Overview page of any zone (and in the dashboard URL).\n *\n * Registration is supported via the Registrar API's registrations endpoint\n * (beta): at-cost, standard-tier, API-supported TLDs only — premium names and\n * unsupported extensions are rejected by the availability check. Renewals and\n * transfers-in are not yet exposed by the Cloudflare API. Registrar is at-cost,\n * so `registerDomain` spends real money.\n */\nexport class CloudflareRegistrar extends BaseRegistrar {\n readonly name = 'cloudflare';\n\n static readonly displayName = 'Cloudflare';\n static readonly website = 'cloudflare.com';\n static readonly helpText =\n 'Create an API token in your Cloudflare dashboard under My Profile > API Tokens. ' +\n 'The token needs \"Account.Registrar\" read/write permissions. Find your Account ID ' +\n 'in the URL or on the Overview page of any zone.';\n static readonly configFields: ConfigField[] = [\n { name: 'apiToken', label: 'API Token', type: 'password', required: true },\n { name: 'accountId', label: 'Account ID', type: 'text', required: true },\n ];\n static readonly supportsSandbox = false; // Cloudflare Registrar has no test environment\n // No extended capabilities. Cloudflare is held to the core contract like any\n // provider. Reads, registration, availability/pricing, privacy, and DNS are\n // implemented (DNS routes through the Zones API); auto-renew, lock, nameserver,\n // renew, and contact updates are not — Cloudflare's API has no post-registration\n // update endpoint and the legacy edit endpoint (EOL 2026-09-27) rejects those\n // fields. Those methods stay `NotImplementedError`. See docs/registrars/cloudflare.md.\n // Domain forwarding (URL redirects via the Rules/Rulesets API + a proxied\n // placeholder DNS record) and email forwarding (Email Routing) are supported\n // through Cloudflare APIs outside the Registrar API. Masked/framed forwarding\n // is not offered by the library. See docs/registrars/cloudflare.md.\n static readonly extendedFeatures: readonly RegistrarFeature[] = [\n Feature.GetDomainForwarding,\n Feature.SetDomainForwarding,\n Feature.GetEmailForwarding,\n Feature.SetEmailForwarding,\n ];\n\n constructor(credentials: RegistrarCredentials, options?: RegistrarOptions) {\n super(\n credentials,\n {\n baseUrl: selectBaseUrl('Cloudflare', options?.environment, {\n production: 'https://api.cloudflare.com/client/v4',\n }),\n headers: {\n 'Authorization': `Bearer ${credentials.apiToken}`,\n 'Content-Type': 'application/json',\n },\n },\n options\n );\n }\n\n private get accountPath(): string {\n return `/accounts/${this.credentials.accountId}/registrar/domains`;\n }\n\n override async testConnection(opts?: RequestOptions): Promise<ConnectionResult> {\n try {\n const res = await this.http.request<CfEnvelope<CfDomain[]>>({\n path: this.accountPath,\n ...opts,\n });\n return res.success\n ? { success: true, message: 'Connection successful' }\n : { success: false, message: res.errors?.[0]?.message ?? 'Request failed' };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n override async listDomains(opts?: ListDomainsOptions): Promise<Domain[]> {\n // The Registrar list endpoint has no name filter, so `search` is applied\n // client-side. It also does not return nameservers (those live on the Zones\n // API); `nameservers` therefore reflects only what the list response carries.\n const { search, ...reqOpts } = opts ?? {};\n const domains: Domain[] = [];\n const perPage = 200; // Cloudflare API maximum page size\n let page = 0; // the Registrar list endpoint is 0-indexed (result_info.page starts at 0)\n let hasMore = true;\n\n while (hasMore) {\n const res = await this.http.request<CfEnvelope<CfDomain[]>>({\n path: this.accountPath,\n query: { per_page: perPage, page },\n ...reqOpts,\n });\n if (!res.success) {\n throw new Error(res.errors?.[0]?.message ?? 'API request failed');\n }\n const list = res.result ?? [];\n for (const d of list) domains.push(this.toDomain(d));\n hasMore = list.length === perPage;\n page++;\n }\n return filterDomains(domains, search);\n }\n\n // map a Cloudflare Registrar domain payload to the normalized Domain shape\n private toDomain(d: CfDomain): Domain {\n return createDomain({\n domainName: d.name,\n registrar: this.name,\n status: d.last_known_status,\n createdDate: d.registered_at,\n expirationDate: d.expires_at,\n renewalDate: d.expires_at,\n autoRenew: d.auto_renew ?? false,\n locked: d.locked ?? false,\n privacy: d.privacy ?? true, // Cloudflare includes WHOIS privacy by default\n nameservers: d.name_servers ?? [],\n });\n }\n\n override async getDomain(domainName: string, opts?: RequestOptions): Promise<Domain> {\n // Registrar API: GET /accounts/{account_id}/registrar/domains/{domain}\n const res = await this.http.request<CfEnvelope<CfDomain>>({\n path: `${this.accountPath}/${encodeURIComponent(domainName)}`,\n ...opts,\n });\n if (!res.success || !res.result) {\n throw new Error(res.errors?.[0]?.message ?? `Domain ${domainName} not found`);\n }\n return this.toDomain(res.result);\n }\n\n /**\n * Nameservers come from the Zones API, not the Registrar API: a domain must be\n * an active zone in the account for its Cloudflare-assigned nameservers to be\n * known. GET /zones?name={domain} → the zone's `name_servers`.\n */\n override async getNameservers(domainName: string, opts?: RequestOptions): Promise<string[]> {\n const zone = await this.findZone(domainName, opts);\n if (!zone) {\n throw new Error(\n `${this.name}: ${domainName} is not a zone in this account; nameservers are only ` +\n 'available via the Zones API for domains added as zones'\n );\n }\n return zone.name_servers ?? [];\n }\n\n /**\n * DNS records live on the Zones API. Two-step: resolve the domain to its\n * zone_id via GET /zones?name={domain}, then GET /zones/{zone_id}/dns_records.\n */\n override async getDnsRecords(domainName: string, opts?: RequestOptions): Promise<DnsRecord[]> {\n const zone = await this.findZone(domainName, opts);\n if (!zone) {\n throw new Error(\n `${this.name}: ${domainName} is not a zone in this account; DNS records are managed ` +\n 'through the Zones API for domains added as zones'\n );\n }\n const res = await this.http.request<CfEnvelope<CfDnsRecord[]>>({\n path: `/zones/${encodeURIComponent(zone.id)}/dns_records`,\n ...opts,\n });\n if (!res.success) {\n throw new Error(res.errors?.[0]?.message ?? 'Failed to list DNS records');\n }\n return (res.result ?? []).map(toDnsRecord);\n }\n\n /**\n * Replace the zone's DNS records with the provided set (Zones API). The\n * Registrar API has no DNS surface, so the domain must be an active zone in the\n * account. Cloudflare has no bulk \"replace\" call, so this deletes the zone's\n * existing records and recreates them from `records`. The implicit SOA and the\n * zone's Cloudflare nameservers are not part of the editable record set and are\n * left untouched; an apex NS record in `records` is skipped (Cloudflare manages\n * it).\n */\n override async setDnsRecords(\n domainName: string,\n records: DnsRecord[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n try {\n const zone = await this.findZone(domainName, opts);\n if (!zone) {\n return {\n success: false,\n message: `${domainName} is not a zone in this account; DNS is managed via the Zones API`,\n };\n }\n const dnsPath = `/zones/${encodeURIComponent(zone.id)}/dns_records`;\n\n const list = await this.http.request<CfEnvelope<CfDnsRecord[]>>({ path: dnsPath, ...opts });\n if (!list.success) {\n return {\n success: false,\n message: list.errors?.[0]?.message ?? 'Failed to list DNS records',\n };\n }\n\n for (const rec of list.result ?? []) {\n if (!rec.id) continue;\n const del = await this.http.request<CfEnvelope<unknown>>({\n method: 'DELETE',\n path: `${dnsPath}/${encodeURIComponent(rec.id)}`,\n ...opts,\n });\n if (!del.success) {\n return {\n success: false,\n message: del.errors?.[0]?.message ?? 'Failed to delete DNS record',\n };\n }\n }\n\n for (const record of records) {\n const type = record.type.toUpperCase();\n const name = toFqdn(record.name, zone.name);\n if (type === 'NS' && name === zone.name) continue; // apex NS is Cloudflare-managed\n const create = await this.http.request<CfEnvelope<unknown>>({\n method: 'POST',\n path: dnsPath,\n body: toCfDnsBody(record, type, name),\n ...opts,\n });\n if (!create.success) {\n return {\n success: false,\n message: create.errors?.[0]?.message ?? `Failed to create ${type} record`,\n };\n }\n }\n return { success: true, message: 'DNS records updated successfully' };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n /**\n * WHOIS contacts come inline on the registrar domain payload, keyed by role\n * (registrant / administrator / technical / billing). GET the domain and map\n * each present role to the normalized ContactSet.\n */\n override async getContacts(domainName: string, opts?: RequestOptions): Promise<ContactSet> {\n const res = await this.http.request<CfEnvelope<CfDomain>>({\n path: `${this.accountPath}/${encodeURIComponent(domainName)}`,\n ...opts,\n });\n if (!res.success || !res.result) {\n throw new Error(res.errors?.[0]?.message ?? `Domain ${domainName} not found`);\n }\n const c = res.result.contacts ?? {};\n const contacts: ContactSet = {};\n if (c.registrant) contacts.registrant = toContact(c.registrant);\n if (c.administrator) contacts.admin = toContact(c.administrator);\n if (c.technical) contacts.tech = toContact(c.technical);\n if (c.billing) contacts.billing = toContact(c.billing);\n return contacts;\n }\n\n private get registrarPath(): string {\n return `/accounts/${this.credentials.accountId}/registrar`;\n }\n\n // authoritative availability + pricing for a batch of names (max 20 per call).\n // POST /registrar/domain-check is the source of truth (unlike domain-search).\n private async domainCheck(\n domainNames: string[],\n opts?: RequestOptions\n ): Promise<CfDomainCheck[]> {\n const out: CfDomainCheck[] = [];\n for (let i = 0; i < domainNames.length; i += 20) {\n const batch = domainNames.slice(i, i + 20).map(normalizeDomain);\n const res = await this.http.request<CfEnvelope<{ domains?: CfDomainCheck[] }>>({\n method: 'POST',\n path: `${this.registrarPath}/domain-check`,\n body: { domains: batch },\n ...opts,\n });\n if (!res.success) {\n throw new Error(res.errors?.[0]?.message ?? 'Domain check failed');\n }\n out.push(...(res.result?.domains ?? []));\n }\n return out;\n }\n\n /**\n * Real-time pricing via the registrar domain-check endpoint. Cloudflare has no\n * per-TLD price list — pricing is per name (a premium name prices differently\n * from a standard one) — so a full domain gives an accurate quote; a bare TLD\n * is probed with a neutral standard label and returns representative pricing.\n * Transfers are not available via the Cloudflare API, so `transfer` is omitted.\n */\n override async getPricing(tldOrDomain: string, opts?: RequestOptions): Promise<TldPricing> {\n const input = tldOrDomain.replace(/^\\.+/, '').toLowerCase();\n const domain = input.includes('.') ? input : `registrar-client-pricing-probe.${input}`;\n const tld = domain.slice(domain.indexOf('.') + 1);\n const [entry] = await this.domainCheck([domain], opts);\n if (!entry?.pricing) {\n throw new Error(\n `${this.name}: no pricing available for ${tldOrDomain}${\n entry?.reason ? ` (${entry.reason})` : ''\n } — pass a specific standard-tier domain for an accurate quote`\n );\n }\n const pricing: TldPricing = { tld, currency: entry.pricing.currency ?? 'USD' };\n const reg = toPrice(entry.pricing.registration_cost);\n const renew = toPrice(entry.pricing.renewal_cost);\n if (reg != null) pricing.registration = reg;\n if (renew != null) pricing.renewal = renew;\n return pricing;\n }\n\n /**\n * Availability + pricing via POST /registrar/domain-check (the authoritative\n * check — domain-search is discovery-only). A name is `available` when the API\n * reports it registrable; premium names and unsupported extensions come back\n * registrable:false with a `reason`. Batches of 20 are sent per the API limit.\n */\n override async checkAvailability(\n domainNames: string[],\n opts?: RequestOptions\n ): Promise<DomainAvailability[]> {\n const checks = await this.domainCheck(domainNames, opts);\n const byName = new Map(checks.map(c => [normalizeDomain(c.name), c]));\n return domainNames.map(name => {\n const c = byName.get(normalizeDomain(name));\n const availability: DomainAvailability = {\n domainName: normalizeDomain(name),\n available: c?.registrable ?? false,\n };\n if (c?.tier) availability.premium = c.tier === 'premium';\n const price = toPrice(c?.pricing?.registration_cost);\n if (price != null) availability.price = price;\n if (c?.pricing?.currency) availability.currency = c.pricing.currency;\n return availability;\n });\n }\n\n // resolve a domain name to its Cloudflare zone via the Zones API (null if the\n // domain is not a zone in this account)\n private async findZone(domainName: string, opts?: RequestOptions): Promise<CfZone | null> {\n const res = await this.http.request<CfEnvelope<CfZone[]>>({\n path: '/zones',\n query: { name: domainName },\n ...opts,\n });\n if (!res.success) {\n throw new Error(res.errors?.[0]?.message ?? 'Failed to look up zone');\n }\n return res.result?.find(z => z.name === domainName) ?? null;\n }\n\n // resolve a domain to its zone or throw a helpful error (forwarding requires\n // the domain to be an active zone in the account).\n private async requireZone(domainName: string, opts?: RequestOptions): Promise<CfZone> {\n const zone = await this.findZone(domainName, opts);\n if (!zone) {\n throw new Error(\n `${this.name}: ${domainName} is not a zone in this account; forwarding is managed ` +\n 'through the Rules and Email Routing APIs, which require the domain to be an active zone'\n );\n }\n return zone;\n }\n\n // --- domain (URL) forwarding: Rules/Rulesets API + a proxied placeholder DNS\n // record so Cloudflare's edge can apply the redirect --------------------------\n\n /**\n * Read URL forwarding from the zone's `http_request_dynamic_redirect` phase\n * ruleset. Each static redirect rule (action `redirect`, a literal target URL,\n * and a single `http.host eq \"...\"` match) maps to one DomainForward. Rules\n * with dynamic (expression) targets or multi-condition matches are skipped —\n * they are richer than the generic forwarding model. Returns [] when no\n * redirect ruleset exists.\n */\n override async getDomainForwarding(\n domainName: string,\n opts?: RequestOptions\n ): Promise<DomainForward[]> {\n const zone = await this.requireZone(domainName, opts);\n const ruleset = await this.getRedirectRuleset(zone.id, opts);\n const forwards: DomainForward[] = [];\n for (const rule of ruleset?.rules ?? []) {\n if (rule.action !== 'redirect') continue;\n const url = rule.action_parameters?.from_value?.target_url?.value;\n const host = hostFromExpression(rule.expression, zone.name);\n if (!url || host == null) continue;\n const status = rule.action_parameters?.from_value?.status_code;\n forwards.push({ host, url, type: status === 301 ? 'permanent' : 'temporary' });\n }\n return forwards;\n }\n\n /**\n * Set URL forwarding (replace-all). For each rule this (1) ensures a proxied\n * placeholder DNS record exists on the source host so Cloudflare's edge handles\n * the request, and (2) writes a static redirect rule to the zone's\n * `http_request_dynamic_redirect` ruleset (301 for `permanent`, 302 for\n * `redirect`). HTTPS works automatically via Cloudflare's Universal SSL. An\n * empty list clears forwarding: the redirect rules and the placeholder records\n * are removed.\n */\n override async setDomainForwarding(\n domainName: string,\n forwards: DomainForward[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n try {\n const settable = settableForwards(forwards); // reject masked before any write\n const zone = await this.requireZone(domainName, opts);\n const existing = await this.getRedirectRuleset(zone.id, opts);\n\n if (settable.length === 0) {\n if (existing?.id) {\n await this.http.request<CfEnvelope<unknown>>({\n method: 'DELETE',\n path: `/zones/${encodeURIComponent(zone.id)}/rulesets/${encodeURIComponent(existing.id)}`,\n ...opts,\n });\n }\n await this.removePlaceholderRecords(zone.id, opts);\n return { success: true, message: 'Domain forwarding cleared successfully' };\n }\n\n const rules = settable.map(f => {\n const fqdn = toFqdn(f.host || '@', zone.name);\n return {\n expression: `http.host eq \"${fqdn}\"`,\n description: `forward ${fqdn}`,\n action: 'redirect',\n action_parameters: {\n from_value: {\n target_url: { value: f.url },\n status_code: f.type === 'permanent' ? 301 : 302,\n preserve_query_string: false,\n },\n },\n };\n });\n\n // ensure the edge sees traffic for each source host\n for (const f of settable) {\n await this.ensurePlaceholderRecord(zone.id, toFqdn(f.host || '@', zone.name), opts);\n }\n\n const body = { name: 'default', kind: 'zone', phase: PHASE_DYNAMIC_REDIRECT, rules };\n const res = existing?.id\n ? await this.http.request<CfEnvelope<CfRuleset>>({\n method: 'PUT',\n path: `/zones/${encodeURIComponent(zone.id)}/rulesets/${encodeURIComponent(existing.id)}`,\n body,\n ...opts,\n })\n : await this.http.request<CfEnvelope<CfRuleset>>({\n method: 'POST',\n path: `/zones/${encodeURIComponent(zone.id)}/rulesets`,\n body,\n ...opts,\n });\n return res.success\n ? { success: true, message: 'Domain forwarding updated successfully' }\n : {\n success: false,\n message: res.errors?.[0]?.message ?? 'Failed to update domain forwarding',\n };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n // GET the dynamic-redirect phase entry-point ruleset, or null when none exists\n // (the API returns 404 with code 10003 in that case).\n private async getRedirectRuleset(\n zoneId: string,\n opts?: RequestOptions\n ): Promise<CfRuleset | null> {\n try {\n const res = await this.http.request<CfEnvelope<CfRuleset>>({\n path: `/zones/${encodeURIComponent(zoneId)}/rulesets/phases/${PHASE_DYNAMIC_REDIRECT}/entrypoint`,\n ...opts,\n });\n return res.result ?? null;\n } catch (error) {\n if (toRegistrarError(error).status === 404) return null;\n throw error;\n }\n }\n\n // ensure a proxied placeholder A/AAAA/CNAME exists for `fqdn` so Cloudflare's\n // edge receives the request. Creates a proxied AAAA -> 100:: (a reserved\n // originless address) only when the host has no A/AAAA/CNAME record yet; an\n // existing record is left untouched (it must be proxied for the redirect to\n // fire).\n private async ensurePlaceholderRecord(\n zoneId: string,\n fqdn: string,\n opts?: RequestOptions\n ): Promise<void> {\n const list = await this.http.request<CfEnvelope<CfDnsRecord[]>>({\n path: `/zones/${encodeURIComponent(zoneId)}/dns_records`,\n query: { name: fqdn },\n ...opts,\n });\n const hasAddress = (list.result ?? []).some(r =>\n ['A', 'AAAA', 'CNAME'].includes((r.type ?? '').toUpperCase())\n );\n if (hasAddress) return;\n await this.http.request<CfEnvelope<unknown>>({\n method: 'POST',\n path: `/zones/${encodeURIComponent(zoneId)}/dns_records`,\n body: { type: 'AAAA', name: fqdn, content: PLACEHOLDER_AAAA, proxied: true, ttl: 1 },\n ...opts,\n });\n }\n\n // delete the proxied placeholder records this provider creates for forwarding\n // (identified by their reserved sentinel content), leaving real records alone.\n private async removePlaceholderRecords(zoneId: string, opts?: RequestOptions): Promise<void> {\n const list = await this.http.request<CfEnvelope<CfDnsRecord[]>>({\n path: `/zones/${encodeURIComponent(zoneId)}/dns_records`,\n query: { per_page: 200 },\n ...opts,\n });\n for (const r of list.result ?? []) {\n if (r.id && PLACEHOLDER_CONTENT.has((r.content ?? '').toLowerCase())) {\n await this.http.request<CfEnvelope<unknown>>({\n method: 'DELETE',\n path: `/zones/${encodeURIComponent(zoneId)}/dns_records/${encodeURIComponent(r.id)}`,\n ...opts,\n });\n }\n }\n }\n\n // --- email forwarding: Email Routing (zone rules + catch-all) ----------------\n\n /**\n * Read Email Routing forwarding rules. Each rule/catch-all with a `forward`\n * action maps to one EmailForward: the local part of the matched address is the\n * `alias` (\"*\" for the catch-all), and the first forward destination is\n * `forwardTo`. Non-forward actions (drop / Worker) are skipped.\n */\n override async getEmailForwarding(\n domainName: string,\n opts?: RequestOptions\n ): Promise<EmailForward[]> {\n const zone = await this.requireZone(domainName, opts);\n const zid = encodeURIComponent(zone.id);\n const forwards: EmailForward[] = [];\n\n const rules = await this.http.request<CfEnvelope<CfEmailRule[]>>({\n path: `/zones/${zid}/email/routing/rules`,\n ...opts,\n });\n for (const rule of rules.result ?? []) {\n const dest = forwardAction(rule);\n if (!dest) continue;\n const matcher = rule.matchers?.[0];\n if (matcher?.type === 'all') continue; // catch-all handled below\n const value = matcher?.value ?? '';\n const alias = value.includes('@') ? value.slice(0, value.indexOf('@')) : value;\n forwards.push({ alias, forwardTo: dest });\n }\n\n const catchAll = await this.http.request<CfEnvelope<CfEmailRule>>({\n path: `/zones/${zid}/email/routing/rules/catch_all`,\n ...opts,\n });\n if (catchAll.result?.enabled) {\n const dest = forwardAction(catchAll.result);\n if (dest) forwards.push({ alias: '*', forwardTo: dest });\n }\n return forwards;\n }\n\n /**\n * Set Email Routing forwarding (replace-all). Enables Email Routing if needed\n * (which adds the required MX/SPF records), then rewrites the rules: each\n * `alias@domain -> forwardTo` becomes a routing rule, and an `alias` of \"*\"/\"@\"\n * becomes the catch-all. Destination addresses must be verified on the account\n * before Cloudflare will activate a rule; where the token can manage addresses,\n * any unknown destination is added (which sends its verification email) and the\n * result message names the addresses still awaiting verification. If the token\n * lacks the address-management scope, that pre-check is skipped.\n */\n override async setEmailForwarding(\n domainName: string,\n forwards: EmailForward[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n try {\n const zone = await this.requireZone(domainName, opts);\n const zid = encodeURIComponent(zone.id);\n\n const settings = await this.http.request<CfEnvelope<CfEmailSettings>>({\n path: `/zones/${zid}/email/routing`,\n ...opts,\n });\n if (!settings.result?.enabled) {\n const enabled = await this.http.request<CfEnvelope<CfEmailSettings>>({\n method: 'POST',\n path: `/zones/${zid}/email/routing/enable`,\n body: {},\n ...opts,\n });\n if (!enabled.success) {\n return {\n success: false,\n message: enabled.errors?.[0]?.message ?? 'Failed to enable Email Routing',\n };\n }\n }\n\n // ensure each destination is a verified account address (best-effort — the\n // token may lack the address-management scope, in which case this is skipped)\n const destinations = [...new Set(forwards.map(f => f.forwardTo))];\n const unverified = await this.ensureDestinations(destinations, opts);\n\n // remove existing non-catch-all rules\n const existing = await this.http.request<CfEnvelope<CfEmailRule[]>>({\n path: `/zones/${zid}/email/routing/rules`,\n ...opts,\n });\n for (const rule of existing.result ?? []) {\n if (rule.matchers?.[0]?.type === 'all' || !rule.id) continue;\n await this.http.request<CfEnvelope<unknown>>({\n method: 'DELETE',\n path: `/zones/${zid}/email/routing/rules/${encodeURIComponent(rule.id)}`,\n ...opts,\n });\n }\n\n let catchAllDest: string | undefined;\n for (const f of forwards) {\n const alias = f.alias.trim();\n if (alias === '*' || alias === '@' || alias === '') {\n catchAllDest = f.forwardTo;\n continue;\n }\n const create = await this.http.request<CfEnvelope<CfEmailRule>>({\n method: 'POST',\n path: `/zones/${zid}/email/routing/rules`,\n body: {\n enabled: true,\n name: `forward ${alias}@${zone.name}`,\n matchers: [{ type: 'literal', field: 'to', value: `${alias}@${zone.name}` }],\n actions: [{ type: 'forward', value: [f.forwardTo] }],\n },\n ...opts,\n });\n if (!create.success) {\n return {\n success: false,\n message: create.errors?.[0]?.message ?? `Failed to create rule for ${alias}`,\n };\n }\n }\n\n // catch-all: forward when a wildcard was given, otherwise reset to drop\n const catchAllBody = catchAllDest\n ? {\n enabled: true,\n matchers: [{ type: 'all' }],\n actions: [{ type: 'forward', value: [catchAllDest] }],\n }\n : { enabled: false, matchers: [{ type: 'all' }], actions: [{ type: 'drop' }] };\n const ca = await this.http.request<CfEnvelope<CfEmailRule>>({\n method: 'PUT',\n path: `/zones/${zid}/email/routing/rules/catch_all`,\n body: catchAllBody,\n ...opts,\n });\n if (!ca.success) {\n return {\n success: false,\n message: ca.errors?.[0]?.message ?? 'Failed to set catch-all rule',\n };\n }\n const note = unverified.length\n ? ` — awaiting verification of ${unverified.join(', ')} (rules stay inactive until verified)`\n : '';\n return { success: true, message: `Email forwarding updated successfully${note}` };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n // ensure each destination is a verified Email Routing address on the account.\n // Unknown addresses are added (which triggers Cloudflare's verification email).\n // Best-effort: if the token can't manage addresses (403) the check is skipped\n // and an empty list is returned. Returns the destinations not yet verified.\n private async ensureDestinations(dests: string[], opts?: RequestOptions): Promise<string[]> {\n if (dests.length === 0) return [];\n const acct = encodeURIComponent(this.credentials.accountId);\n try {\n const res = await this.http.request<\n CfEnvelope<{ email?: string; verified?: string | null }[]>\n >({ path: `/accounts/${acct}/email/routing/addresses`, query: { per_page: 50 }, ...opts });\n const byEmail = new Map(\n (res.result ?? []).map(a => [(a.email ?? '').toLowerCase(), a.verified])\n );\n const unverified: string[] = [];\n for (const dest of dests) {\n const verified = byEmail.get(dest.toLowerCase());\n if (verified) continue;\n if (!byEmail.has(dest.toLowerCase())) {\n await this.http.request<CfEnvelope<unknown>>({\n method: 'POST',\n path: `/accounts/${acct}/email/routing/addresses`,\n body: { email: dest },\n ...opts,\n });\n }\n unverified.push(dest);\n }\n return unverified;\n } catch (error) {\n if (toRegistrarError(error).status === 403) return []; // no address scope; skip\n throw error;\n }\n }\n\n /**\n * Register a domain via POST /registrar/registrations (Registrar API, beta).\n * Cloudflare registers onto the account's default WHOIS contact unless a\n * registrant is supplied; nameservers cannot be set at registration (the domain\n * joins the account on Cloudflare's nameservers). Registration is at-cost —\n * this spends real money — and only standard-tier, API-supported TLDs qualify\n * (premium names return registrable:false from checkAvailability). When the\n * request does not finish synchronously the registration continues server-side\n * and is polled to a terminal state.\n */\n override async registerDomain(\n domainName: string,\n input: RegisterDomainInput,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n try {\n const name = normalizeDomain(domainName);\n const body: Record<string, unknown> = { domain_name: name };\n if (input.autoRenew != null) body.auto_renew = input.autoRenew;\n if (input.privacy != null) body.privacy_mode = input.privacy ? 'redaction' : 'off';\n const registrant = input.contacts?.registrant;\n if (registrant) body.contacts = { registrant: toCfRegistrant(registrant) };\n\n const res = await this.http.request<CfEnvelope<CfRegistration>>({\n method: 'POST',\n path: `${this.registrarPath}/registrations`,\n body,\n ...opts,\n });\n if (!res.success) {\n return { success: false, message: res.errors?.[0]?.message ?? 'Registration failed' };\n }\n\n let reg = res.result;\n for (let i = 0; reg && !reg.completed && reg.state === 'in_progress' && i < 15; i++) {\n await sleep(2000, opts?.signal);\n const poll = await this.http.request<CfEnvelope<CfRegistration>>({\n path: `${this.registrarPath}/registrations/${encodeURIComponent(name)}/registration-status`,\n ...opts,\n });\n if (!poll.success) break;\n reg = poll.result;\n }\n\n if (reg?.completed || reg?.state === 'succeeded') {\n return { success: true, message: `Domain ${domainName} registered successfully` };\n }\n return {\n success: false,\n message: `Registration did not complete (state: ${reg?.state ?? 'unknown'}${\n reg?.reason ? `, ${reg.reason}` : ''\n })`,\n };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n // Cloudflare exposes no post-registration update endpoint for auto-renew, lock,\n // or nameservers. `auto_renew`, `privacy_mode`, and `locked` can be set only at\n // registration (see `registerDomain`); the legacy PUT edit endpoint refuses\n // these fields (422 \"not allowed to perform this action\" for auto_renew/locked,\n // 403 for nameservers) while still accepting `privacy` (see `setPrivacy`).\n // Verified live against the account 2026-08-29 on both a gTLD (.dev) and .uk, so\n // this is API-wide, not TLD-specific. Renewals are likewise not in the API yet.\n // These stay NotImplementedError until Cloudflare ships update endpoints; the\n // wiring (patchDomain + a `name_servers`/`auto_renew`/`locked` body) is ready.\n private static readonly UPDATE_UNAVAILABLE =\n \"Cloudflare's API has no post-registration update endpoint for it; set it during \" +\n 'registration or in the Cloudflare dashboard';\n\n override renewDomain(\n _domainName: string,\n _years = 1,\n _opts?: RequestOptions\n ): Promise<OperationResult> {\n return Promise.reject(\n new NotImplementedError(\n `${this.name}: renewDomain is not available — renewals are not yet in the Cloudflare ` +\n 'Registrar API. Enable auto-renew at registration so the domain renews at expiry'\n )\n );\n }\n\n override updateNameservers(\n _domainName: string,\n _nameservers: string[],\n _opts?: RequestOptions\n ): Promise<OperationResult> {\n return Promise.reject(\n new NotImplementedError(\n `${this.name}: updateNameservers is not available — Cloudflare Registrar nameserver ` +\n 'changes require contacting Cloudflare Support (the API rejects them with 403)'\n )\n );\n }\n\n override lockDomain(_domainName: string, _opts?: RequestOptions): Promise<OperationResult> {\n return Promise.reject(\n new NotImplementedError(\n `${this.name}: lockDomain — ${CloudflareRegistrar.UPDATE_UNAVAILABLE}`\n )\n );\n }\n\n override unlockDomain(_domainName: string, _opts?: RequestOptions): Promise<OperationResult> {\n return Promise.reject(\n new NotImplementedError(\n `${this.name}: unlockDomain — ${CloudflareRegistrar.UPDATE_UNAVAILABLE}`\n )\n );\n }\n\n override setAutoRenew(\n _domainName: string,\n _enabled: boolean,\n _opts?: RequestOptions\n ): Promise<OperationResult> {\n return Promise.reject(\n new NotImplementedError(\n `${this.name}: setAutoRenew — ${CloudflareRegistrar.UPDATE_UNAVAILABLE}`\n )\n );\n }\n\n /**\n * Toggle WHOIS privacy (Cloudflare includes it free). PUT `privacy` on the\n * registrar domain. Whether the registry actually honors the change is\n * TLD-dependent, but Cloudflare accepts the update for supported TLDs.\n */\n override async setPrivacy(\n domainName: string,\n enabled: boolean,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.patchDomain(domainName, { privacy: enabled }, opts);\n }\n\n // confirm a domain exists in the account (registrar domains are keyed by name)\n private async findDomain(domainName: string, opts?: RequestOptions): Promise<CfDomain | null> {\n const res = await this.http.request<CfEnvelope<CfDomain[]>>({\n path: this.accountPath,\n query: { name: domainName },\n ...opts,\n });\n return res.result?.find(d => d.name === domainName) ?? null;\n }\n\n // confirm the domain exists then PUT the given fields (registrar API is name-keyed)\n private async patchDomain(\n domainName: string,\n body: Record<string, unknown>,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n try {\n const domain = await this.findDomain(domainName, opts);\n if (!domain) return { success: false, message: 'Domain not found' };\n\n const res = await this.http.request<CfEnvelope<CfDomain>>({\n method: 'PUT',\n path: `${this.accountPath}/${encodeURIComponent(domainName)}`,\n body,\n ...opts,\n });\n return {\n success: res.success,\n message: res.success ? 'Domain updated successfully' : 'Failed to update domain',\n };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n}\n\n// the Rules phase that holds Single Redirects (URL forwarding) rules.\nconst PHASE_DYNAMIC_REDIRECT = 'http_request_dynamic_redirect';\n// reserved originless AAAA target for proxied placeholder records (see\n// https://developers.cloudflare.com/dns/manage-dns-records/how-to/create-dns-records/#originless-setups)\nconst PLACEHOLDER_AAAA = '100::';\n// sentinel contents this provider writes for forwarding placeholder records, so\n// they can be recognized and cleaned up without touching real records.\nconst PLACEHOLDER_CONTENT = new Set(['100::', '192.0.2.0', '192.0.2.1']);\n\n// extract the single host from a `http.host eq \"FQDN\"` expression, returned\n// relative to the zone apex (\"@\"). Returns null when the expression is not a\n// simple single-host match (e.g. a dynamic or multi-condition rule).\nfunction hostFromExpression(expression: string | undefined, zoneName: string): string | null {\n if (!expression) return null;\n const m = /^\\(?\\s*http\\.host eq \"([^\"]+)\"\\s*\\)?$/.exec(expression.trim());\n if (!m) return null;\n const fqdn = m[1].replace(/\\.$/, '');\n const zone = zoneName.replace(/\\.$/, '');\n if (fqdn === zone) return '@';\n if (fqdn.endsWith(`.${zone}`)) return fqdn.slice(0, -(zone.length + 1));\n return fqdn;\n}\n\n// the first forward destination on an Email Routing rule, or undefined when the\n// rule has no forward action (e.g. drop or Worker).\nfunction forwardAction(rule: CfEmailRule): string | undefined {\n return rule.actions?.find(a => a.type === 'forward')?.value?.[0];\n}\n\n// map a Cloudflare DNS record to the generic DnsRecord shape. `content` holds\n// the value for every type; MX/SRV carry a `priority`, and SRV's weight/port\n// live on the nested `data` object.\nfunction toDnsRecord(r: CfDnsRecord): DnsRecord {\n const type = r.type.toUpperCase();\n const record: DnsRecord = { type, name: r.name, value: r.content ?? '' };\n if (r.ttl != null) record.ttl = r.ttl;\n const priority = r.priority ?? r.data?.priority;\n if ((type === 'MX' || type === 'SRV') && priority != null) record.priority = priority;\n if (type === 'SRV') {\n if (r.data?.weight != null) record.weight = r.data.weight;\n if (r.data?.port != null) record.port = r.data.port;\n }\n return record;\n}\n\n// resolve a DnsRecord name (relative, \"@\" apex, or already a FQDN) to the\n// fully-qualified name Cloudflare's DNS API expects.\nfunction toFqdn(name: string, zoneName: string): string {\n const n = (name ?? '').replace(/\\.$/, '');\n const zone = zoneName.replace(/\\.$/, '');\n if (n === '' || n === '@' || n === zone) return zone;\n if (n.endsWith(`.${zone}`)) return n;\n return `${n}.${zone}`;\n}\n\n// map a normalized DnsRecord to a Cloudflare dns_records create body. `content`\n// holds the value for every type except SRV, whose priority/weight/port/target\n// go on the nested `data` object (Cloudflare derives service/proto from `name`).\nfunction toCfDnsBody(record: DnsRecord, type: string, name: string): Record<string, unknown> {\n if (type === 'SRV') {\n const body: Record<string, unknown> = {\n type,\n name,\n data: {\n priority: record.priority ?? 0,\n weight: record.weight ?? 0,\n port: record.port ?? 0,\n target: record.value,\n },\n };\n if (record.ttl != null) body.ttl = record.ttl;\n return body;\n }\n const body: Record<string, unknown> = { type, name, content: record.value };\n if (record.ttl != null) body.ttl = record.ttl;\n if (type === 'MX') body.priority = record.priority ?? 0;\n return body;\n}\n\n// parse a Cloudflare price string (major currency units, e.g. \"11.20\") to a\n// number, or undefined when absent/unparseable.\nfunction toPrice(value: string | undefined): number | undefined {\n if (value == null || value === '') return undefined;\n const n = Number(value);\n return Number.isFinite(n) ? n : undefined;\n}\n\n// map the library's Contact to Cloudflare's registrant shape (email/phone plus a\n// nested postal_info.address). Cloudflare joins first + last into a single name.\nfunction toCfRegistrant(c: Contact): Record<string, unknown> {\n const name = [c.firstName, c.lastName].filter(Boolean).join(' ');\n const street = [c.address1, c.address2].filter(Boolean).join(', ');\n const postal: Record<string, unknown> = {\n name,\n address: {\n street,\n city: c.city,\n state: c.state,\n postal_code: c.postalCode,\n country_code: c.country,\n },\n };\n if (c.organization) postal.organization = c.organization;\n return { email: c.email, phone: c.phone, postal_info: postal };\n}\n\n// resolve after `ms` milliseconds, rejecting early if `signal` aborts. Used to\n// space out registration status polls. Browser/edge-safe (setTimeout only).\nfunction sleep(ms: number, signal?: AbortSignal): Promise<void> {\n return new Promise((resolve, reject) => {\n const fail = () =>\n reject(signal?.reason instanceof Error ? signal.reason : new Error('aborted'));\n if (signal?.aborted) return fail();\n const timer = setTimeout(resolve, ms);\n signal?.addEventListener(\n 'abort',\n () => {\n clearTimeout(timer);\n fail();\n },\n { once: true }\n );\n });\n}\n\n// map a Cloudflare WHOIS contact to the normalized Contact shape. Optional\n// fields are set only when non-empty (Cloudflare returns \"\" for absent values).\nfunction toContact(c: CfContact): Contact {\n const contact: Contact = {\n firstName: c.first_name ?? '',\n lastName: c.last_name ?? '',\n email: c.email ?? '',\n phone: c.phone ?? '',\n address1: c.address ?? '',\n city: c.city ?? '',\n postalCode: c.zip ?? '',\n country: c.country ?? '',\n };\n if (c.organization) contact.organization = c.organization;\n if (c.fax) contact.fax = c.fax;\n if (c.address2) contact.address2 = c.address2;\n if (c.state) contact.state = c.state;\n return contact;\n}\n","import type {\n ConfigField,\n ConnectionResult,\n Contact,\n ContactSet,\n DnsRecord,\n DnssecStatus,\n Domain,\n DomainAvailability,\n DomainForward,\n EmailForward,\n ListDomainsOptions,\n OperationResult,\n RegisterDomainInput,\n RegistrarOptions,\n RequestOptions,\n TldPricing,\n TransferDomainInput,\n} from '../types';\nimport { createDomain, filterDomains, requireConsent, settableForwards } from '../utils';\nimport { NotFoundError, NotImplementedError, toRegistrarError } from '../errors';\nimport { BaseRegistrar, selectBaseUrl } from '../registrar';\nimport { Feature, type RegistrarFeature } from '../features';\nimport type { RegistrarCredentials } from '../types';\n\n// --- RESTful v2 response shapes (snake_case; captured from the live API) ---\n\n// the standard envelope: HTTP 200 with a `code` of 200 on success, otherwise an\n// `error.description`. Signature/auth failures come back as real HTTP 4xx.\ninterface V2Envelope<T> {\n code?: number;\n message?: string;\n data?: T;\n error?: { code?: string; description?: string };\n}\n\ninterface V2Nameserver {\n server_name?: string;\n ip_list?: string[];\n}\n\n// a DNS record under glue_info (record_value2 carries the MX priority)\ninterface V2DnsRecord {\n sub_host?: string;\n record_type?: string;\n record_value1?: string;\n record_value2?: string;\n}\n\n// the glue/DNS block: `glue_type` is NAME_SERVERS (external NS), DNS (Dynadot-\n// hosted records), REGISTRAR_FORWARDING (URL redirect), or\n// REGISTRAR_STEALTH_FORWARDING (framed/cloaked redirect). It also carries the\n// per-domain email-forwarding settings inline.\ninterface V2GlueInfo {\n glue_type?: string;\n nameserver_list?: V2Nameserver[];\n dns_main_list?: V2DnsRecord[];\n dns_sub_list?: V2DnsRecord[];\n ttl?: string | number;\n // domain (URL) forwarding, present when glue_type is REGISTRAR_FORWARDING /\n // REGISTRAR_STEALTH_FORWARDING. `forward_type` reads back as\n // \"permanently\"/\"temporarily\"; stealth carries a `stealth_title` instead.\n forward_url?: string;\n forward_type?: string;\n stealth_title?: string;\n // email forwarding: `email_forward_type` reads back uppercase\n // (MTYPE_NONE/MTYPE_FORWARD/MTYPE_MX); aliases carry username -> destination.\n email_forward_type?: string;\n email_alias_list?: { username?: string; email?: string }[];\n}\n\n// one DNS-security record from GET .../dnssec. `algorithm` / `digest_type` read\n// back as human labels with the numeric code in parentheses, e.g. \"SHA-256 (2)\".\ninterface V2DnssecInfo {\n key_tag?: string | number;\n algorithm?: string | number;\n digest_type?: string | number;\n digest?: string;\n}\n\n// Dynadot's default nameservers, used to switch a domain off URL forwarding\n// (there is no dedicated \"clear forwarding\" endpoint).\nconst DYNADOT_DEFAULT_NS = ['ns1.dynadot.com', 'ns2.dynadot.com'];\n\ninterface V2DomainInfo {\n domain_name?: string;\n expiration_date?: number;\n registration_date?: number;\n glue_info?: V2GlueInfo;\n registrant_contact_id?: number;\n admin_contact_id?: number;\n technical_contact_id?: number;\n billing_contact_id?: number;\n locked?: string;\n privacy?: string;\n renew_option?: string;\n status?: string;\n}\n\n// a full contact record. Name is one combined field; phone/fax split into a\n// country code + number.\ninterface V2Contact {\n contact_id?: number;\n organization?: string;\n name?: string;\n email?: string;\n phone_number?: string;\n phone_cc?: string | number;\n fax_number?: string;\n fax_cc?: string | number;\n address1?: string;\n address2?: string;\n city?: string;\n state?: string;\n zip?: string;\n country?: string;\n}\n\ninterface V2Price {\n currency?: string;\n unit?: string; // e.g. \"(price/1 year)\"\n registration_price?: string;\n renewal_price?: string;\n transfer_price?: string;\n restore_price?: string;\n}\n\ninterface V2SearchResult {\n domain_name?: string;\n available?: string; // \"Yes\" | \"No\"\n premium?: string; // \"yes\" | \"no\"\n price_list?: V2Price[];\n}\n\n// bulk_search is capped conservatively; the endpoint takes a comma-joined list\nconst SEARCH_BATCH_SIZE = 100;\n\n// Dynadot DNS record types that map cleanly to our generic DnsRecord types.\n// (Dynadot also has forward/stealth/email pseudo-records — those are forwarding\n// features, not generic DNS, so they're excluded here.)\nconst SUPPORTED_DNS_TYPES = new Set(['A', 'AAAA', 'CNAME', 'MX', 'TXT', 'NS', 'SRV', 'CAA']);\n\n/**\n * Dynadot Registrar\n * API docs: https://www.dynadot.com/domain/api-document\n *\n * Targets Dynadot's **RESTful v2 API** (`https://api.dynadot.com/restful/v2/…`).\n *\n * ## Authentication\n * Two credentials: an **API key** (the public identifier, sent as\n * `Authorization: Bearer <key>`) and an **API secret** (used only to sign\n * requests). Every request carries an `X-Signature` header — the Base64 HMAC-\n * SHA256, keyed by the secret, of:\n *\n * `apiKey + \"\\n\" + pathAndQuery + \"\\n\" + \"\" + \"\\n\" + body`\n *\n * The third component is the (optional) `X-Request-Id`; this client signs it as\n * an empty string and does not send the header. Signing uses Web Crypto\n * (`crypto.subtle`), so it stays browser/edge-safe.\n *\n * Enable both keys under Tools > API in a Dynadot account (the account must be\n * unlocked with API access enabled).\n *\n * ## Envelope\n * Responses are `{ code, message, data }`, with `code: 200` on success and an\n * `error.description` otherwise. Note Dynadot returns HTTP 200 even for logical\n * errors (a bad command, a missing domain) — only auth/signature failures are\n * real HTTP 4xx — so success is read from the envelope `code`, not the status.\n *\n * ## Verification\n * Every method's path and payload is verified against a live account. Reads\n * (`testConnection`, `listDomains`, `getDomain`, `getNameservers`,\n * `getContacts`, `getDnsRecords`, `checkAvailability`, `getPricing`) were run\n * against the production account; all writes (`registerDomain`, `transferIn`,\n * `renewDomain`, `setAutoRenew`, `updateNameservers`, `lockDomain`/\n * `unlockDomain`, `setPrivacy`, `setDnsRecords`) were exercised end-to-end in the\n * Dynadot sandbox (`api-sandbox.dynadot.com`), which mirrors the API.\n */\nexport class DynadotRegistrar extends BaseRegistrar {\n readonly name = 'dynadot';\n\n static readonly displayName = 'Dynadot';\n static readonly website = 'dynadot.com';\n static readonly helpText =\n 'Under Tools > API in your Dynadot account, generate an API Key and API Secret. ' +\n 'The account must be unlocked with API access enabled. The key identifies you; ' +\n 'the secret signs requests (X-Signature) and is never sent directly.';\n static readonly configFields: ConfigField[] = [\n { name: 'apiKey', label: 'API Key', type: 'password', required: true },\n { name: 'apiSecret', label: 'API Secret', type: 'password', required: true },\n ];\n static readonly supportsSandbox = true; // api-sandbox.dynadot.com mirrors the API\n // On top of core: transfer-out auth code, DNSSEC read/disable, and email +\n // domain (URL) forwarding. All implemented on the v2 transport and verified in\n // the Dynadot sandbox.\n static readonly extendedFeatures: readonly RegistrarFeature[] = [\n Feature.GetAuthCode,\n Feature.GetDnssec,\n Feature.DisableDnssec,\n Feature.GetEmailForwarding,\n Feature.SetEmailForwarding,\n Feature.GetDomainForwarding,\n Feature.SetDomainForwarding,\n ];\n\n constructor(credentials: RegistrarCredentials, options?: RegistrarOptions) {\n super(\n credentials,\n {\n // baseUrl is the host; each request builds the full /restful/v2/… path\n baseUrl: selectBaseUrl('Dynadot', options?.environment, {\n production: 'https://api.dynadot.com',\n sandbox: 'https://api-sandbox.dynadot.com',\n }),\n headers: { Authorization: `Bearer ${credentials.apiKey}` },\n },\n options\n );\n }\n\n // sign and issue a request. `pathAndQuery` is the exact request target\n // (path + any query), used verbatim both to sign and to send so the two match.\n private async signedRequest<T>(\n method: string,\n pathAndQuery: string,\n body?: unknown,\n opts?: RequestOptions\n ): Promise<V2Envelope<T>> {\n const bodyStr = body !== undefined ? JSON.stringify(body) : '';\n const stringToSign = `${this.credentials.apiKey}\\n${pathAndQuery}\\n\\n${bodyStr}`;\n const signature = await hmacSha256Base64(this.credentials.apiSecret, stringToSign);\n return this.http.request<V2Envelope<T>>({\n method,\n path: pathAndQuery,\n body,\n // Dynadot requires application/json even on bodyless mutations (e.g. the\n // DELETE for disableDnssec), so set it explicitly rather than relying on\n // the client's body-present default.\n headers: { 'X-Signature': signature, 'Content-Type': 'application/json' },\n ...opts,\n });\n }\n\n // issue a request and return its `data`, throwing on a non-2xx envelope code\n private async read<T>(\n method: string,\n pathAndQuery: string,\n body?: unknown,\n opts?: RequestOptions\n ): Promise<T> {\n const env = await this.signedRequest<T>(method, pathAndQuery, body, opts);\n if (!isOk(env.code)) {\n throw new Error(env.error?.description ?? env.message ?? 'Dynadot request failed');\n }\n return env.data as T;\n }\n\n // issue a mutating request and map its envelope to an OperationResult. The\n // envelope `code` mirrors the HTTP status, so success spans 2xx (register is\n // 200, transfer_in is 202 Accepted).\n private async mutate(\n method: string,\n pathAndQuery: string,\n body: unknown,\n successMessage: string,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n try {\n const env = await this.signedRequest<unknown>(method, pathAndQuery, body, opts);\n const ok = isOk(env.code);\n return {\n success: ok,\n message: ok ? successMessage : (env.error?.description ?? env.message ?? 'Request failed'),\n };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n override async testConnection(opts?: RequestOptions): Promise<ConnectionResult> {\n try {\n await this.read<{ account_info?: unknown }>(\n 'GET',\n '/restful/v2/accounts/info',\n undefined,\n opts\n );\n return { success: true, message: 'Connection successful' };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n override async listDomains(opts?: ListDomainsOptions): Promise<Domain[]> {\n // GET /domains returns the whole account in one response, nameservers inline.\n const { search, ...reqOpts } = opts ?? {};\n const data = await this.read<{ domain_info_list?: V2DomainInfo[] }>(\n 'GET',\n '/restful/v2/domains',\n undefined,\n reqOpts\n );\n const domains = (data.domain_info_list ?? []).map(info => this.toDomain(info));\n return filterDomains(domains, search);\n }\n\n override async getDomain(domainName: string, opts?: RequestOptions): Promise<Domain> {\n return this.toDomain(await this.domainInfo(domainName, opts));\n }\n\n // fetch and unwrap GET /domains/{name} -> data.domain_info (shared by getDomain,\n // getContacts, and the forwarding reads, which all read from domain_info)\n private async domainInfo(domainName: string, opts?: RequestOptions): Promise<V2DomainInfo> {\n const data = await this.read<{ domain_info?: V2DomainInfo }>(\n 'GET',\n `/restful/v2/domains/${encodeURIComponent(domainName)}`,\n undefined,\n opts\n );\n if (!data.domain_info) throw new NotFoundError(`Dynadot: domain '${domainName}' not found`);\n return data.domain_info;\n }\n\n override async getNameservers(domainName: string, opts?: RequestOptions): Promise<string[]> {\n // domain_info carries the nameservers inline (empty for Dynadot-DNS-hosted\n // domains, which have no external NS)\n const domain = await this.getDomain(domainName, opts);\n return domain.nameservers;\n }\n\n /**\n * Reads registrant/admin/tech/billing contacts. domain_info carries a numeric\n * contact id per role; this resolves each distinct id via GET /contacts/{id}\n * (roles usually share one contact, so ids are de-duplicated).\n */\n override async getContacts(domainName: string, opts?: RequestOptions): Promise<ContactSet> {\n const info = await this.domainInfo(domainName, opts);\n\n const roleIds: [keyof ContactSet, string][] = [\n ['registrant', str(info.registrant_contact_id)],\n ['admin', str(info.admin_contact_id)],\n ['tech', str(info.technical_contact_id)],\n ['billing', str(info.billing_contact_id)],\n ];\n\n const byId = new Map<string, Contact>();\n for (const [, id] of roleIds) {\n if (!id || id === '0' || byId.has(id)) continue;\n const cdata = await this.read<{ contact?: V2Contact }>(\n 'GET',\n `/restful/v2/contacts/${encodeURIComponent(id)}`,\n undefined,\n opts\n );\n if (cdata.contact) byId.set(id, toContact(cdata.contact));\n }\n\n const contacts: ContactSet = {};\n for (const [role, id] of roleIds) {\n const contact = byId.get(id);\n if (contact) contacts[role] = contact;\n }\n return contacts;\n }\n\n override async getDnsRecords(domainName: string, opts?: RequestOptions): Promise<DnsRecord[]> {\n const data = await this.read<{ glue_info?: V2GlueInfo }>(\n 'GET',\n `/restful/v2/domains/${encodeURIComponent(domainName)}/records`,\n undefined,\n opts\n );\n const glue = data.glue_info ?? {};\n // only Dynadot-hosted DNS has records; NAME_SERVERS / forwarding domains have none\n if (glue.glue_type !== 'DNS') return [];\n const ttl = glue.ttl != null ? Number(glue.ttl) : undefined;\n return [\n ...(glue.dns_main_list ?? []).map(r => toDnsRecord(r, '@', ttl)),\n ...(glue.dns_sub_list ?? []).map(r => toDnsRecord(r, r.sub_host ?? '', ttl)),\n ];\n }\n\n /**\n * Availability via `bulk_search` (comma-joined `domain_name_list`), batched.\n * `show_price=true` returns a `price_list` per name; the first (1-year) entry's\n * registration price is surfaced.\n */\n override async checkAvailability(\n domainNames: string[],\n opts?: RequestOptions\n ): Promise<DomainAvailability[]> {\n const results: DomainAvailability[] = [];\n for (let i = 0; i < domainNames.length; i += SEARCH_BATCH_SIZE) {\n const batch = domainNames.slice(i, i + SEARCH_BATCH_SIZE);\n const list = encodeURIComponent(batch.join(','));\n const data = await this.read<{ domain_result_list?: V2SearchResult[] }>(\n 'GET',\n `/restful/v2/domains/bulk_search?domain_name_list=${list}&show_price=true`,\n undefined,\n opts\n );\n for (const r of data.domain_result_list ?? []) {\n const price = oneYearPrice(r.price_list);\n results.push({\n domainName: r.domain_name ?? '',\n available: r.available === 'Yes',\n premium: r.premium != null ? r.premium.toLowerCase() === 'yes' : undefined,\n price: price?.registration,\n currency: price?.currency,\n period: price ? 1 : undefined,\n });\n }\n }\n return results;\n }\n\n /**\n * Pricing for a specific domain (may be premium). Needs a full domain (e.g.\n * \"example.com\"); a bare TLD throws, since v2 has no standalone TLD-price\n * endpoint.\n *\n * For a domain **already in the account**, the classic `renew` command with\n * `price_check=1` returns the exact renewal fee — premium names included —\n * without renewing. `bulk_search` (the v2 pricing path) only quotes names\n * *available to register*, so it can't price an owned domain's renewal. We try\n * the price check first and fall back to `bulk_search` for names not in the\n * account (e.g. pricing a domain before registering it).\n */\n override async getPricing(tldOrDomain: string, opts?: RequestOptions): Promise<TldPricing> {\n if (!tldOrDomain.includes('.')) {\n throw new NotImplementedError(\n `${this.name}: getPricing needs a full domain (e.g. \"example.com\"); ` +\n 'Dynadot v2 has no standalone per-TLD price endpoint'\n );\n }\n const tld = tldOrDomain.slice(tldOrDomain.indexOf('.') + 1);\n\n // Owned domain: the price-check renew quote is the exact renewal (premium\n // included). Skips bulk_search, which returns nothing for a registered name.\n const checked = await this.renewPriceCheck(tldOrDomain, opts);\n if (checked) {\n return { tld, currency: checked.currency, renewal: checked.renewal };\n }\n\n // Not in the account — fall back to bulk_search for available-name pricing.\n const list = encodeURIComponent(tldOrDomain);\n const data = await this.read<{ domain_result_list?: V2SearchResult[] }>(\n 'GET',\n `/restful/v2/domains/bulk_search?domain_name_list=${list}&show_price=true`,\n undefined,\n opts\n );\n const result = (data.domain_result_list ?? [])[0];\n const price = oneYearPrice(result?.price_list);\n return {\n tld,\n currency: price?.currency ?? 'USD',\n registration: price?.registration,\n renewal: price?.renewal,\n transfer: price?.transfer,\n };\n }\n\n /**\n * Renewal price for a domain already in the account, via the classic\n * `/api3.json?command=renew&price_check=1` quote (the RESTful v2 renew endpoint\n * executes immediately and has no price-only mode). Authenticates with the same\n * API key as a query parameter — the classic command is unsigned. `PriceInfo`\n * reads e.g. \"Renew Fee: 108.90 in USD, Total: 108.90 in USD, The domain is\n * premium\". Returns null when the domain isn't in the account or the fee can't\n * be parsed, so the caller can fall back.\n */\n private async renewPriceCheck(\n domain: string,\n opts?: RequestOptions\n ): Promise<{ renewal: number; currency: string } | null> {\n const params = new URLSearchParams({\n key: this.credentials.apiKey,\n command: 'renew',\n domain,\n duration: '1',\n price_check: '1',\n });\n try {\n const res = await this.http.request<{\n RenewResponse?: { Status?: string; PriceInfo?: string };\n }>({ method: 'GET', path: `/api3.json?${params.toString()}`, ...opts });\n const info = res.RenewResponse;\n if (info?.Status !== 'price_check_success' || !info.PriceInfo) return null;\n const match = info.PriceInfo.match(/Renew Fee:\\s*([\\d.]+)\\s+in\\s+([A-Za-z]{3})/);\n if (!match) return null;\n const renewal = Number(match[1]);\n return Number.isNaN(renewal) ? null : { renewal, currency: match[2].toUpperCase() };\n } catch {\n return null;\n }\n }\n\n // --- writes (paths + bodies verified against the Dynadot sandbox) ---\n\n /**\n * Registers a domain via POST /domains/{name}/register. The body nests the\n * order under a `domain` object; v2 uses the account's default WHOIS contacts,\n * so `input.contacts` is not sent. `privacy` maps to Dynadot's privacy level\n * (\"full\"/\"off\"). Spends real money in production.\n */\n override async registerDomain(\n domainName: string,\n input: RegisterDomainInput,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n requireConsent(this.name, input.consent);\n return this.mutate(\n 'POST',\n `/restful/v2/domains/${encodeURIComponent(domainName)}/register`,\n { domain: { duration: input.years ?? 1, privacy: input.privacy ? 'full' : 'off' } },\n `Domain ${domainName} registered successfully`,\n opts\n );\n }\n\n /**\n * Transfers a domain in with its auth/EPP code (nested under `domain`, like\n * register). Returns 202 Accepted on success. Contacts come from the account\n * default. Spends real money in production.\n */\n override async transferIn(\n domainName: string,\n input: TransferDomainInput,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n requireConsent(this.name, input.consent);\n return this.mutate(\n 'POST',\n `/restful/v2/domains/${encodeURIComponent(domainName)}/transfer_in`,\n {\n domain: {\n auth_code: input.authCode,\n duration: input.years ?? 1,\n privacy: input.privacy ? 'full' : 'off',\n },\n },\n `Domain ${domainName} transfer requested successfully`,\n opts\n );\n }\n\n /**\n * Renews a domain. Dynadot's renew takes both the number of years (`duration`)\n * and the domain's current expiration `year` as a guard against double-renews,\n * so this reads the current expiration first.\n */\n override async renewDomain(\n domainName: string,\n years = 1,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const domain = await this.getDomain(domainName, opts);\n const year = domain.expirationDate?.getUTCFullYear();\n if (year == null) {\n return { success: false, message: `Dynadot: could not read ${domainName}'s expiration year` };\n }\n return this.mutate(\n 'POST',\n `/restful/v2/domains/${encodeURIComponent(domainName)}/renew`,\n { duration: years, year },\n 'Domain renewed successfully',\n opts\n );\n }\n\n // Auto-renew via the renew_option endpoint. The accepted write values are\n // \"auto\" (auto-renew), \"donot\" (do not renew), and \"reset\" (manual renewal) —\n // note these differ from the read values (\"auto-renew\" etc.).\n override async setAutoRenew(\n domainName: string,\n enabled: boolean,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.mutate(\n 'PUT',\n `/restful/v2/domains/${encodeURIComponent(domainName)}/renew_option`,\n { renew_option: enabled ? 'auto' : 'donot' },\n `Auto-renew ${enabled ? 'enabled' : 'disabled'} successfully`,\n opts\n );\n }\n\n // Replace nameservers via PUT .../nameservers with a `nameserver_list` of\n // hostname strings.\n override async updateNameservers(\n domainName: string,\n nameservers: string[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n if (nameservers.length < 2 || nameservers.length > 13) {\n throw new Error('Dynadot requires 2-13 nameservers');\n }\n return this.mutate(\n 'PUT',\n `/restful/v2/domains/${encodeURIComponent(domainName)}/nameservers`,\n { nameserver_list: nameservers },\n 'Nameservers updated successfully',\n opts\n );\n }\n\n // Transfer lock via PUT .../domain_lock with a boolean `lock`.\n override async lockDomain(domainName: string, opts?: RequestOptions): Promise<OperationResult> {\n return this.setLock(domainName, true, opts);\n }\n\n override async unlockDomain(domainName: string, opts?: RequestOptions): Promise<OperationResult> {\n return this.setLock(domainName, false, opts);\n }\n\n private setLock(\n domainName: string,\n locked: boolean,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.mutate(\n 'PUT',\n `/restful/v2/domains/${encodeURIComponent(domainName)}/domain_lock`,\n { lock: locked },\n `Domain ${locked ? 'locked' : 'unlocked'} successfully`,\n opts\n );\n }\n\n // WHOIS privacy via PUT .../privacy with a `privacy_level` of \"full\"/\"off\".\n override async setPrivacy(\n domainName: string,\n enabled: boolean,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.mutate(\n 'PUT',\n `/restful/v2/domains/${encodeURIComponent(domainName)}/privacy`,\n { privacy_level: enabled ? 'full' : 'off' },\n `Privacy ${enabled ? 'enabled' : 'disabled'} successfully`,\n opts\n );\n }\n\n /**\n * Updates contact roles. Dynadot contacts are account-level records referenced\n * by id, so this creates a contact per supplied role (`POST /contacts`) and\n * points the domain's roles at the new ids (`PUT /domains/{d}/contacts`). Roles\n * not supplied keep their current contact id (read first and passed through, as\n * the PUT sets all four). Identical contacts across roles are created once.\n * Verified end-to-end in the sandbox.\n */\n override async updateContacts(\n domainName: string,\n contacts: ContactSet,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n if (!contacts.registrant && !contacts.admin && !contacts.tech && !contacts.billing) {\n throw new Error(`${this.name}: updateContacts requires at least one contact role`);\n }\n // read current ids so unspecified roles are preserved (the PUT sets all four)\n const info = (\n await this.read<{ domain_info?: V2DomainInfo }>(\n 'GET',\n `/restful/v2/domains/${encodeURIComponent(domainName)}`,\n undefined,\n opts\n )\n ).domain_info;\n if (!info) throw new NotFoundError(`Dynadot: domain '${domainName}' not found`);\n\n const created = new Map<Contact, number>();\n const idFor = async (c: Contact): Promise<number> => {\n let id = created.get(c);\n if (id == null) {\n const data = await this.read<{ contact_id: number }>(\n 'POST',\n '/restful/v2/contacts',\n { contact: toDynadotContact(c) },\n opts\n );\n id = data.contact_id;\n created.set(c, id);\n }\n return id;\n };\n\n const body = {\n registrant_contact_id: contacts.registrant\n ? await idFor(contacts.registrant)\n : info.registrant_contact_id,\n admin_contact_id: contacts.admin ? await idFor(contacts.admin) : info.admin_contact_id,\n technical_contact_id: contacts.tech ? await idFor(contacts.tech) : info.technical_contact_id,\n billing_contact_id: contacts.billing\n ? await idFor(contacts.billing)\n : info.billing_contact_id,\n };\n return this.mutate(\n 'PUT',\n `/restful/v2/domains/${encodeURIComponent(domainName)}/contacts`,\n body,\n 'Contacts updated successfully',\n opts\n );\n }\n\n /**\n * Replaces the DNS record set via POST /domains/{name}/records. Records split\n * into apex (\"main\") and subdomain lists, mirroring the read shape; MX priority\n * rides in record_value2. Only generic DNS types are supported. Verified live\n * (add/restore round-trip): the body is accepted and non-forwarding records are\n * fully replaced.\n */\n override async setDnsRecords(\n domainName: string,\n records: DnsRecord[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const mainList: V2DnsRecord[] = [];\n const subList: V2DnsRecord[] = [];\n let ttl: number | undefined;\n\n for (const r of records) {\n const type = r.type.toUpperCase();\n if (!SUPPORTED_DNS_TYPES.has(type)) {\n throw new Error(`Dynadot: DNS record type '${type}' is not supported`);\n }\n if (ttl == null && r.ttl != null) ttl = r.ttl;\n const entry: V2DnsRecord = { record_type: type.toLowerCase(), record_value1: r.value };\n if (type === 'MX' && r.priority != null) entry.record_value2 = String(r.priority);\n\n const isApex = r.name === '@' || r.name === '' || r.name === domainName;\n if (isApex) {\n mainList.push(entry);\n } else {\n subList.push({ ...entry, sub_host: r.name });\n }\n }\n\n const glue: V2GlueInfo = { glue_type: 'DNS', dns_main_list: mainList, dns_sub_list: subList };\n if (ttl != null) glue.ttl = String(ttl);\n\n return this.mutate(\n 'POST',\n `/restful/v2/domains/${encodeURIComponent(domainName)}/records`,\n glue,\n 'DNS records updated successfully',\n opts\n );\n }\n\n // --- extended capabilities ---------------------------------------------\n\n /**\n * The transfer authorization (EPP) code via GET .../transfer_auth_code. Reads\n * the current code (Dynadot can also mint a fresh one with `new_code=true`, not\n * used here to avoid a side effect on a read).\n */\n override async getAuthCode(domainName: string, opts?: RequestOptions): Promise<string> {\n const data = await this.read<{ auth_code?: string }>(\n 'GET',\n `/restful/v2/domains/${encodeURIComponent(domainName)}/transfer_auth_code`,\n undefined,\n opts\n );\n return data.auth_code ?? '';\n }\n\n /**\n * DNSSEC status via GET .../dnssec, which returns a list of DS records\n * (`dnssec_info_list`); a non-empty list means DNSSEC is enabled. `algorithm`\n * and `digest_type` come back as labels with the numeric code in parentheses\n * (e.g. \"SHA-256 (2)\"), so parse the code out.\n */\n override async getDnssec(domainName: string, opts?: RequestOptions): Promise<DnssecStatus> {\n const data = await this.read<{ dnssec_info_list?: V2DnssecInfo[] }>(\n 'GET',\n `/restful/v2/domains/${encodeURIComponent(domainName)}/dnssec`,\n undefined,\n opts\n );\n const list = data.dnssec_info_list ?? [];\n return {\n enabled: list.length > 0,\n dsRecords: list.map(d => ({\n keyTag: parseCode(d.key_tag),\n algorithm: parseCode(d.algorithm),\n digestType: parseCode(d.digest_type),\n digest: d.digest ?? '',\n })),\n };\n }\n\n // Disable DNSSEC via DELETE .../dnssec (removes the registrar's DS records).\n override disableDnssec(domainName: string, opts?: RequestOptions): Promise<OperationResult> {\n return this.mutate(\n 'DELETE',\n `/restful/v2/domains/${encodeURIComponent(domainName)}/dnssec`,\n undefined,\n 'DNSSEC disabled successfully',\n opts\n );\n }\n\n /**\n * Read alias-style email forwarding from domain_info's inline `glue_info`\n * (Dynadot has no standalone endpoint). Only `MTYPE_FORWARD` carries redirect\n * aliases; MX-mode (`MTYPE_MX`) and none return no rules.\n */\n override async getEmailForwarding(\n domainName: string,\n opts?: RequestOptions\n ): Promise<EmailForward[]> {\n const glue = (await this.domainInfo(domainName, opts)).glue_info;\n if ((glue?.email_forward_type ?? '').toUpperCase() !== 'MTYPE_FORWARD') return [];\n return (glue?.email_alias_list ?? [])\n .map(a => ({ alias: a.username ?? '', forwardTo: a.email ?? '' }))\n .filter(f => f.alias && f.forwardTo);\n }\n\n /**\n * Replace email forwarding via PUT .../email_forwarding (full replace; an empty\n * list clears it with `mtype_none`). Requires the domain to use Dynadot DNS —\n * the API rejects it when the record is a CNAME.\n */\n override async setEmailForwarding(\n domainName: string,\n forwards: EmailForward[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const body =\n forwards.length === 0\n ? { email_forward_type: 'mtype_none', email_alias_list: [], email_exchange_list: [] }\n : {\n email_forward_type: 'mtype_forward',\n email_alias_list: forwards.map(f => ({ username: f.alias, email: f.forwardTo })),\n email_exchange_list: [],\n };\n return this.mutate(\n 'PUT',\n `/restful/v2/domains/${encodeURIComponent(domainName)}/email_forwarding`,\n body,\n 'Email forwarding updated successfully',\n opts\n );\n }\n\n /**\n * Read domain (URL) forwarding from domain_info's inline `glue_info`. Dynadot\n * forwards the whole domain, so this returns at most one rule at host \"@\":\n * REGISTRAR_FORWARDING is a 301/302 redirect (`forward_type`\n * permanently/temporarily). REGISTRAR_STEALTH_FORWARDING (a masked/framed\n * redirect) is reported as read-only `masked` — `setDomainForwarding` rejects it.\n */\n override async getDomainForwarding(\n domainName: string,\n opts?: RequestOptions\n ): Promise<DomainForward[]> {\n const glue = (await this.domainInfo(domainName, opts)).glue_info;\n const type = (glue?.glue_type ?? '').toUpperCase();\n if (!glue?.forward_url) return [];\n if (type === 'REGISTRAR_STEALTH_FORWARDING') {\n return [{ host: '@', url: glue.forward_url, type: 'masked' }];\n }\n if (type === 'REGISTRAR_FORWARDING') {\n const temporary = (glue.forward_type ?? '').toLowerCase().startsWith('temp');\n return [{ host: '@', url: glue.forward_url, type: temporary ? 'temporary' : 'permanent' }];\n }\n return [];\n }\n\n /**\n * Set domain (URL) forwarding. Dynadot forwards the entire domain, so at most\n * one rule (host \"@\") is accepted: `temporary`/`permanent` use standard\n * forwarding (302 vs 301). An empty list clears forwarding — Dynadot has no\n * \"off\" for it, so we restore its default nameservers, which is the neutral\n * non-forwarding state.\n */\n override async setDomainForwarding(\n domainName: string,\n forwards: DomainForward[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const enc = encodeURIComponent(domainName);\n if (forwards.length === 0) {\n return this.mutate(\n 'PUT',\n `/restful/v2/domains/${enc}/nameservers`,\n { nameserver_list: DYNADOT_DEFAULT_NS },\n 'Domain forwarding cleared successfully',\n opts\n );\n }\n if (forwards.length > 1) {\n throw new Error('Dynadot forwards the whole domain; only a single \"@\" rule is supported');\n }\n const [f] = settableForwards(forwards); // reject masked before any write\n if (f.host && f.host !== '@') {\n throw new Error(\n 'Dynadot forwards the whole domain; per-host forwarding is not supported (use host \"@\")'\n );\n }\n return this.mutate(\n 'PUT',\n `/restful/v2/domains/${enc}/domain_forwarding`,\n { forward_url: f.url, is_temporary: f.type === 'temporary' },\n 'Domain forwarding updated successfully',\n opts\n );\n }\n\n // map a v2 domain_info payload to the normalized Domain shape\n private toDomain(d: V2DomainInfo): Domain {\n return createDomain({\n domainName: d.domain_name,\n registrar: this.name,\n status: d.status ?? '',\n createdDate: d.registration_date ?? null,\n expirationDate: d.expiration_date ?? null,\n renewalDate: d.expiration_date ?? null,\n autoRenew: d.renew_option === 'auto-renew' || d.renew_option === 'auto',\n locked: d.locked === 'Yes',\n privacy: isPrivacyOn(d.privacy),\n nameservers: extractNameservers(d.glue_info),\n });\n }\n}\n\n// --- signing ---\n\n// Base64-encoded HMAC-SHA256 of `message`, keyed by `secret` (UTF-8). Uses Web\n// Crypto so it runs unchanged in browsers, edge runtimes, and Node.\nasync function hmacSha256Base64(secret: string, message: string): Promise<string> {\n const enc = new TextEncoder();\n const key = await crypto.subtle.importKey(\n 'raw',\n enc.encode(secret),\n { name: 'HMAC', hash: 'SHA-256' },\n false,\n ['sign']\n );\n const signature = await crypto.subtle.sign('HMAC', key, enc.encode(message));\n let binary = '';\n for (const byte of new Uint8Array(signature)) binary += String.fromCharCode(byte);\n return btoa(binary);\n}\n\n// --- mapping helpers ---\n\n// whether a v2 envelope `code` (which mirrors the HTTP status) is a success —\n// 2xx, so it covers 200 and transfer_in's 202 Accepted\nfunction isOk(code: number | undefined): boolean {\n return code != null && code >= 200 && code < 300;\n}\n\n// map a v2 DNS record to the normalized DnsRecord shape\nfunction toDnsRecord(r: V2DnsRecord, name: string, ttl: number | undefined): DnsRecord {\n const type = (r.record_type ?? '').toUpperCase();\n const record: DnsRecord = { type, name, value: r.record_value1 ?? '' };\n if (ttl != null) record.ttl = ttl;\n // MX priority (distance) rides in record_value2\n if (type === 'MX' && r.record_value2 != null && r.record_value2 !== '') {\n record.priority = Number(r.record_value2);\n }\n return record;\n}\n\n// map a v2 contact record to the normalized Contact shape\nfunction toContact(c: V2Contact): Contact {\n const { firstName, lastName } = splitName(str(c.name));\n const contact: Contact = {\n firstName,\n lastName,\n email: str(c.email),\n phone: joinPhone(c.phone_cc, c.phone_number),\n address1: str(c.address1),\n city: str(c.city),\n postalCode: str(c.zip),\n country: str(c.country),\n };\n const organization = str(c.organization);\n if (organization) contact.organization = organization;\n const fax = joinPhone(c.fax_cc, c.fax_number);\n if (fax) contact.fax = fax;\n const address2 = str(c.address2);\n if (address2) contact.address2 = address2;\n const state = str(c.state);\n if (state) contact.state = state;\n return contact;\n}\n\n// whether a v2 privacy string denotes privacy being on. The API reports several\n// values: \"Full Privacy\"/\"Partial Privacy\" (on) vs \"Privacy Off\"/\"No Privacy\"\n// (off), so key off the level word rather than a simple prefix.\nfunction isPrivacyOn(privacy: string | undefined): boolean {\n const p = (privacy ?? '').toLowerCase();\n if (!p || p.includes('off') || p.startsWith('no')) return false;\n return p.includes('full') || p.includes('partial') || p.includes('privacy');\n}\n\n// pick the 1-year price entry (falling back to the first), mapping to numbers\nfunction oneYearPrice(\n prices: V2Price[] | undefined\n): { currency?: string; registration?: number; renewal?: number; transfer?: number } | undefined {\n if (!prices?.length) return undefined;\n const oneYear = prices.find(p => /\\b1\\s*year\\b/i.test(p.unit ?? '')) ?? prices[0];\n return {\n currency: oneYear.currency,\n registration: toNumber(oneYear.registration_price),\n renewal: toNumber(oneYear.renewal_price),\n transfer: toNumber(oneYear.transfer_price),\n };\n}\n\n// pull the external nameserver hostnames from a glue_info block\nfunction extractNameservers(glue: V2GlueInfo | undefined): string[] {\n return (glue?.nameserver_list ?? []).map(ns => str(ns.server_name)).filter(Boolean);\n}\n\n// Dynadot stores a single combined name; split on the first space\nfunction splitName(name: string): { firstName: string; lastName: string } {\n const trimmed = name.trim();\n const space = trimmed.indexOf(' ');\n if (space === -1) return { firstName: trimmed, lastName: '' };\n return { firstName: trimmed.slice(0, space), lastName: trimmed.slice(space + 1).trim() };\n}\n\n// rejoin a split country code + number as \"+cc.number\" (e.g. \"+1.4805551234\")\n// map the normalized Contact to Dynadot's contact shape (name + split phone).\n// The inverse of toContact: joins first/last into `name` and splits the\n// \"+cc.number\" phone into phone_cc / phone_number.\nfunction toDynadotContact(c: Contact): Record<string, unknown> {\n const phone = splitDynadotPhone(c.phone);\n const contact: Record<string, unknown> = {\n name: `${c.firstName} ${c.lastName}`.trim(),\n email: c.email,\n phone_cc: phone.cc,\n phone_number: phone.number,\n address1: c.address1,\n city: c.city,\n zip: c.postalCode,\n country: c.country,\n };\n if (c.organization) contact.organization = c.organization;\n if (c.address2) contact.address2 = c.address2;\n if (c.state) contact.state = c.state;\n if (c.fax) {\n const fax = splitDynadotPhone(c.fax);\n contact.fax_cc = fax.cc;\n contact.fax_number = fax.number;\n }\n return contact;\n}\n\n// split an international phone (\"+1.4805551234\") into country code + number,\n// the inverse of joinPhone. Falls back to all digits as the number.\nfunction splitDynadotPhone(phone: string): { cc: string; number: string } {\n const trimmed = (phone ?? '').trim();\n const dot = trimmed.indexOf('.');\n if (trimmed.startsWith('+') && dot > 1) {\n return {\n cc: trimmed.slice(1, dot).replace(/\\D/g, ''),\n number: trimmed.slice(dot + 1).replace(/\\D/g, ''),\n };\n }\n return { cc: '', number: trimmed.replace(/\\D/g, '') };\n}\n\nfunction joinPhone(cc: string | number | undefined, num: string | number | undefined): string {\n const number = str(num);\n if (!number) return '';\n const code = str(cc);\n return code ? `+${code}.${number}` : number;\n}\n\n// stringify a loosely-typed scalar, guarding against objects/arrays\nfunction str(value: unknown): string {\n return typeof value === 'string' ? value : typeof value === 'number' ? String(value) : '';\n}\n\n// parse a price string like \"10.88\" into a number, or undefined\nfunction toNumber(value: string | undefined): number | undefined {\n if (value == null || value === '') return undefined;\n const n = Number(value);\n return Number.isFinite(n) ? n : undefined;\n}\n\n// Dynadot reports DNSSEC algorithm / digest-type as a label with the numeric\n// code in parentheses, e.g. \"SHA-256 (2)\" or \"RSA/SHA-256 (8)\". Pull out the\n// code; tolerate a bare number (key_tag) or numeric string too.\nfunction parseCode(value: string | number | undefined): number {\n if (typeof value === 'number') return value;\n const paren = /\\((\\d+)\\)/.exec(value ?? '');\n if (paren) return Number(paren[1]);\n const n = Number(value);\n return Number.isFinite(n) ? n : 0;\n}\n","import type {\n ConfigField,\n ConnectionResult,\n Contact,\n ContactSet,\n DnsRecord,\n DnssecStatus,\n Domain,\n DomainAvailability,\n DomainForward,\n DomainForwardType,\n DsRecord,\n EmailForward,\n ListDomainsOptions,\n OperationResult,\n RegisterDomainInput,\n RegistrarOptions,\n RequestOptions,\n TldPricing,\n TransferDomainInput,\n} from '../types';\nimport { createDomain, filterDomains, settableForwards } from '../utils';\nimport { toRegistrarError } from '../errors';\nimport { BaseRegistrar, selectBaseUrl } from '../registrar';\nimport { Feature, type RegistrarFeature } from '../features';\nimport type { RegistrarCredentials } from '../types';\n\n// A contact as returned under `GET /v5/domain/domains/{fqdn}/contacts` (and\n// nested in the domain-detail `contacts` object). Gandi names fields `given`/\n// `family`/`streetaddr`/`zip`; privacy is `data_obfuscated` on the detail\n// endpoint (older responses carried `extra_parameters.whois_privacy`).\ninterface GandiContact {\n given?: string;\n family?: string;\n orgname?: string;\n email?: string;\n phone?: string;\n fax?: string;\n streetaddr?: string;\n city?: string;\n state?: string;\n zip?: string;\n country?: string;\n data_obfuscated?: boolean;\n extra_parameters?: { whois_privacy?: string };\n}\n\n// the four contact roles Gandi exposes; `bill` maps to our `billing`\ninterface GandiContacts {\n owner?: GandiContact;\n admin?: GandiContact;\n tech?: GandiContact;\n bill?: GandiContact;\n}\n\n// Shape of a domain in `GET /v5/domain/domains` (list) and\n// `GET /v5/domain/domains/{fqdn}` (detail). `status` is an array of EPP\n// statuses; `autorenew` may be a bare boolean or an object; nameservers arrive\n// as `nameserver.hosts` on the list endpoint and as a top-level `nameservers`\n// array on the detail endpoint.\ninterface GandiDomain {\n fqdn: string;\n status?: string | string[];\n dates?: {\n created_at?: string;\n registry_created_at?: string;\n registry_ends_at?: string;\n updated_at?: string;\n };\n autorenew?: boolean | { enabled?: boolean };\n contacts?: GandiContacts;\n nameserver?: { current?: string; hosts?: string[] };\n nameservers?: string[];\n}\n\n// one record set from `GET /v5/livedns/domains/{fqdn}/records`; a set can hold\n// multiple values (e.g. several A records for one name), flattened on read.\ninterface GandiRecord {\n rrset_type?: string;\n rrset_name?: string;\n rrset_ttl?: number;\n rrset_values?: string[];\n}\n\n// a single price entry within a pricing/check product\ninterface GandiPrice {\n min_duration?: number;\n max_duration?: number;\n duration_unit?: string;\n price_before_taxes?: number;\n price_after_taxes?: number;\n type?: string;\n discount?: boolean;\n}\n\n// a product in `GET /v5/billing/price/domain` and `GET /v5/domain/check`. Each product\n// carries the `process` (create/renew/transfer) its `prices` apply to; `check`\n// products also carry availability `status`.\ninterface GandiProduct {\n name?: string;\n status?: string;\n process?: string;\n prices?: GandiPrice[];\n}\n\n// envelope shared by the pricing and check endpoints\ninterface GandiPricingResponse {\n currency?: string;\n grid?: string;\n products?: GandiProduct[];\n}\n\n// a DNSSEC key from GET /v5/livedns/domains/{fqdn}/keys. `ds` is the full DS\n// RR line (\"<owner> <ttl> IN DS <keyTag> <algorithm> <digestType> <digest>\").\ninterface GandiKey {\n id?: string;\n deleted?: boolean;\n flags?: number;\n algorithm?: number;\n ds?: string;\n}\n\n// an email forward from GET /v5/email/forwards/{domain}: `source` is the local\n// part (mailbox), `destinations` the full addresses it forwards to.\ninterface GandiForward {\n source?: string;\n destinations?: string[];\n}\n\n// a web-forwarding (URL redirect) entry from GET\n// /v5/domain/domains/{fqdn}/webredirs. `host` is the full FQDN of the source\n// subdomain; `type` is Gandi's redirect kind (http301/http302/cloak).\ninterface GandiWebredir {\n host?: string;\n type?: string;\n url?: string;\n protocol?: string;\n}\n\n// map our DomainForwardType to Gandi's webredir `type`, and back.\nconst GANDI_FORWARD_TYPE: Record<'temporary' | 'permanent', string> = {\n permanent: 'http301',\n temporary: 'http302',\n};\nconst GANDI_TYPE_TO_FORWARD: Record<string, DomainForwardType> = {\n http301: 'permanent',\n http302: 'temporary',\n cloak: 'masked', // read-only; setDomainForwarding rejects it\n};\n\n/**\n * Gandi.net Registrar\n * API docs: https://api.gandi.net/docs/\n *\n * Credentials: generate a Personal Access Token (PAT) under Account Settings >\n * Security. The token must have domain management permissions. It is sent as a\n * `Bearer` Authorization header. (Gandi's legacy `Apikey` scheme is deprecated\n * and now returns 403.)\n */\nexport class GandiRegistrar extends BaseRegistrar {\n readonly name = 'gandi';\n\n static readonly displayName = 'Gandi.net';\n static readonly website = 'gandi.net';\n static readonly helpText =\n 'Generate a Personal Access Token (PAT) in your Gandi account under Account ' +\n 'Settings > Security. The token needs permission to manage domains. (Gandi has ' +\n 'deprecated the legacy API Key; use a PAT.)';\n static readonly configFields: ConfigField[] = [\n { name: 'apiKey', label: 'Personal Access Token', type: 'password', required: true },\n ];\n // Gandi's v5 API offers a sandbox at api.sandbox.gandi.net (separate account)\n static readonly supportsSandbox = true;\n // On top of core: transfer-out auth code (`authinfo`), DNSSEC read/disable\n // (LiveDNS keys), email forwarding, and web/URL forwarding (webredirs;\n // per-subdomain, no apex). Note core `setPrivacy` disabling is a no-op for\n // individual (natural-person) registrants — Gandi keeps WHOIS obfuscation on\n // for GDPR regardless of the request.\n static readonly extendedFeatures: readonly RegistrarFeature[] = [\n Feature.GetAuthCode,\n Feature.GetDnssec,\n Feature.DisableDnssec,\n Feature.GetEmailForwarding,\n Feature.SetEmailForwarding,\n Feature.GetDomainForwarding,\n Feature.SetDomainForwarding,\n ];\n\n constructor(credentials: RegistrarCredentials, options?: RegistrarOptions) {\n super(\n credentials,\n {\n baseUrl: selectBaseUrl('Gandi', options?.environment, {\n production: 'https://api.gandi.net/v5',\n sandbox: 'https://api.sandbox.gandi.net/v5',\n }),\n headers: {\n 'Authorization': `Bearer ${credentials.apiKey}`,\n 'Content-Type': 'application/json',\n },\n },\n options\n );\n }\n\n override async testConnection(opts?: RequestOptions): Promise<ConnectionResult> {\n try {\n await this.http.request<GandiDomain[]>({ path: '/domain/domains', ...opts });\n return { success: true, message: 'Connection successful' };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n override async listDomains(opts?: ListDomainsOptions): Promise<Domain[]> {\n const { search, ...reqOpts } = opts ?? {};\n const domains: Domain[] = [];\n const perPage = 1000; // Gandi API maximum page size\n // Gandi's `fqdn` filter is server-side and supports wildcards, so a plain\n // substring search is wrapped in `*...*`.\n const term = search?.trim();\n const fqdn = term ? `*${term}*` : undefined;\n let page = 1;\n\n for (;;) {\n const list = await this.http.request<GandiDomain[]>({\n path: '/domain/domains',\n query: { per_page: perPage, page, ...(fqdn ? { fqdn } : {}) },\n ...reqOpts,\n });\n if (!list || list.length === 0) break;\n\n for (const d of list) domains.push(this.toDomain(d));\n\n if (list.length < perPage) break;\n page++;\n }\n return filterDomains(domains, search);\n }\n\n // map Gandi's list/detail domain shape into a normalized Domain, tolerating\n // the field variations documented on GandiDomain.\n private toDomain(d: GandiDomain): Domain {\n const statuses = Array.isArray(d.status) ? d.status : d.status ? [d.status] : [];\n const autoRenew =\n typeof d.autorenew === 'boolean' ? d.autorenew : (d.autorenew?.enabled ?? false);\n return createDomain({\n domainName: d.fqdn,\n registrar: this.name,\n status: statuses.join(','),\n createdDate: d.dates?.created_at ?? d.dates?.registry_created_at,\n expirationDate: d.dates?.registry_ends_at,\n renewalDate: d.dates?.updated_at,\n autoRenew,\n locked: statuses.some(s => /transferprohibited|locked/i.test(s)),\n privacy:\n d.contacts?.owner?.extra_parameters?.whois_privacy === 'enabled' ||\n d.contacts?.owner?.data_obfuscated === true,\n nameservers: d.nameserver?.hosts ?? d.nameservers ?? [],\n });\n }\n\n // fetch a single domain's details (dates, status, nameservers, privacy) via\n // `GET /v5/domain/domains/{fqdn}` and normalize through the shared toDomain.\n override async getDomain(domainName: string, opts?: RequestOptions): Promise<Domain> {\n const d = await this.http.request<GandiDomain>({\n path: `/domain/domains/${domainName}`,\n ...opts,\n });\n return this.toDomain({ ...d, fqdn: d.fqdn ?? domainName });\n }\n\n // read the nameservers set on a domain. The dedicated endpoint returns a bare\n // JSON array of hostname strings.\n override async getNameservers(domainName: string, opts?: RequestOptions): Promise<string[]> {\n const res = await this.http.request<string[]>({\n path: `/domain/domains/${domainName}/nameservers`,\n ...opts,\n });\n return Array.isArray(res) ? res.map(String) : [];\n }\n\n // read the registrant/admin/tech/billing contacts. Gandi keys these\n // owner/admin/tech/bill; `owner` is the registrant and `bill` the billing role.\n override async getContacts(domainName: string, opts?: RequestOptions): Promise<ContactSet> {\n const res = await this.http.request<GandiContacts>({\n path: `/domain/domains/${domainName}/contacts`,\n ...opts,\n });\n return {\n registrant: fromGandiContact(res.owner),\n admin: fromGandiContact(res.admin),\n tech: fromGandiContact(res.tech),\n billing: fromGandiContact(res.bill),\n };\n }\n\n /**\n * Read DNS records from LiveDNS (`GET /v5/livedns/domains/{fqdn}/records`).\n * A LiveDNS record set carries an array of values, so each value is emitted as\n * its own normalized DnsRecord. MX values are \"priority target\" and SRV values\n * \"priority weight port target\"; those numeric prefixes are split into the\n * dedicated DnsRecord fields, leaving `value` as the target.\n */\n override async getDnsRecords(domainName: string, opts?: RequestOptions): Promise<DnsRecord[]> {\n const rrsets = await this.http.request<GandiRecord[]>({\n path: `/livedns/domains/${domainName}/records`,\n ...opts,\n });\n const records: DnsRecord[] = [];\n for (const rr of rrsets ?? []) {\n const type = (rr.rrset_type ?? '').toUpperCase();\n const name = rr.rrset_name ?? '';\n for (const value of rr.rrset_values ?? []) {\n const record: DnsRecord = { type, name, value };\n if (rr.rrset_ttl != null) record.ttl = rr.rrset_ttl;\n if (type === 'MX') {\n const [priority, ...rest] = value.split(/\\s+/);\n const p = Number(priority);\n if (Number.isFinite(p) && rest.length > 0) {\n record.priority = p;\n record.value = rest.join(' ');\n }\n } else if (type === 'SRV') {\n const parts = value.split(/\\s+/);\n if (parts.length === 4) {\n record.priority = Number(parts[0]);\n record.weight = Number(parts[1]);\n record.port = Number(parts[2]);\n record.value = parts[3];\n }\n }\n records.push(record);\n }\n }\n return records;\n }\n\n /**\n * Per-TLD pricing via `GET /v5/billing/price/domain`. `processes` is a repeatable\n * query param and each returned product is tagged with the `process` its prices\n * cover, so a single call fetches register/renew/transfer. A bare TLD is turned\n * into a sample fqdn (`example.<tld>`) since the endpoint keys off a domain\n * name. Gandi returns prices in major currency units already.\n */\n override async getPricing(tldOrDomain: string, opts?: RequestOptions): Promise<TldPricing> {\n const tld = (\n tldOrDomain.includes('.') ? tldOrDomain.slice(tldOrDomain.indexOf('.') + 1) : tldOrDomain\n ).toLowerCase();\n const name = tldOrDomain.includes('.') ? tldOrDomain : `example.${tld}`;\n\n // `processes` must be repeated (create/renew/transfer); the query map can't\n // hold a repeated key, so the params are encoded directly into the path.\n const params = new URLSearchParams({ name });\n for (const process of ['create', 'renew', 'transfer']) {\n params.append('processes', process);\n }\n\n const resp = await this.http.request<GandiPricingResponse>({\n path: `/billing/price/domain?${params.toString()}`,\n ...opts,\n });\n const products = resp.products ?? [];\n const priceFor = (process: string): number | undefined =>\n pickPrice(products.find(p => p.process === process)?.prices?.[0]);\n\n return {\n tld,\n currency: resp.currency ?? 'USD',\n registration: priceFor('create'),\n renewal: priceFor('renew'),\n transfer: priceFor('transfer'),\n };\n }\n\n /**\n * Availability via `GET /v5/domain/check`, which checks a single name per call,\n * so multiple names are looped. The default `create` product carries the\n * availability `status` and registration price; a status of `available*` means\n * registrable, and a `premium` price type (or `*premium` status) flags premium\n * names.\n */\n override async checkAvailability(\n domainNames: string[],\n opts?: RequestOptions\n ): Promise<DomainAvailability[]> {\n const results: DomainAvailability[] = [];\n for (const domainName of domainNames) {\n const resp = await this.http.request<GandiPricingResponse>({\n path: '/domain/check',\n query: { name: domainName },\n ...opts,\n });\n const products = resp.products ?? [];\n const product = products.find(p => p.process === 'create') ?? products[0];\n const status = product?.status ?? '';\n const price = product?.prices?.[0];\n const result: DomainAvailability = {\n domainName: product?.name ?? domainName,\n available: status.startsWith('available'),\n premium: status.includes('premium') || price?.type === 'premium',\n };\n const amount = pickPrice(price);\n if (amount != null) result.price = amount;\n if (resp.currency) result.currency = resp.currency;\n if (price?.duration_unit === 'y' && price.min_duration != null) {\n result.period = price.min_duration;\n }\n results.push(result);\n }\n return results;\n }\n\n override async renewDomain(\n domainName: string,\n years = 1,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.mutate(\n { method: 'POST', path: `/domain/domains/${domainName}/renew`, body: { duration: years } },\n 'Domain renewed successfully',\n opts\n );\n }\n\n override async updateNameservers(\n domainName: string,\n nameservers: string[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n if (nameservers.length < 1) {\n throw new Error('At least 1 nameserver is required');\n }\n return this.mutate(\n { method: 'PUT', path: `/domain/domains/${domainName}/nameservers`, body: { nameservers } },\n 'Nameservers updated successfully',\n opts\n );\n }\n\n // The transfer lock lives on the domain's `/status` subresource and is toggled\n // with the `clientTransferProhibited` EPP flag (a boolean) — not by PATCHing a\n // `status` string on the domain object, which 404s. The change is asynchronous\n // (Gandi returns 202 \"status change in progress\"), so a read-back right after\n // may still show the old state briefly.\n override async lockDomain(domainName: string, opts?: RequestOptions): Promise<OperationResult> {\n return this.mutate(\n {\n method: 'PATCH',\n path: `/domain/domains/${domainName}/status`,\n body: { clientTransferProhibited: true },\n },\n 'Domain locked successfully',\n opts\n );\n }\n\n override async unlockDomain(domainName: string, opts?: RequestOptions): Promise<OperationResult> {\n return this.mutate(\n {\n method: 'PATCH',\n path: `/domain/domains/${domainName}/status`,\n body: { clientTransferProhibited: false },\n },\n 'Domain unlocked successfully',\n opts\n );\n }\n\n // --- extended capabilities ---------------------------------------------\n\n // The transfer authorization (EPP) code is the `authinfo` field on the\n // domain-details endpoint (present for domains the account manages).\n override async getAuthCode(domainName: string, opts?: RequestOptions): Promise<string> {\n const d = await this.http.request<{ authinfo?: string }>({\n path: `/domain/domains/${domainName}`,\n ...opts,\n });\n return d.authinfo ?? '';\n }\n\n /**\n * DNSSEC status via Gandi LiveDNS keys (GET /livedns/domains/{fqdn}/keys). A\n * non-deleted key means DNSSEC is enabled; each key's `ds` field is the full DS\n * RR line, which we parse into keyTag/algorithm/digestType/digest.\n */\n override async getDnssec(domainName: string, opts?: RequestOptions): Promise<DnssecStatus> {\n const keys = await this.http.request<GandiKey[]>({\n path: `/livedns/domains/${domainName}/keys`,\n ...opts,\n });\n const active = (keys ?? []).filter(k => !k.deleted);\n const dsRecords = active.map(k => parseDsRecord(k.ds)).filter((d): d is DsRecord => d !== null);\n return { enabled: active.length > 0, dsRecords };\n }\n\n /**\n * Disable DNSSEC by deleting each LiveDNS key (Gandi has no single toggle —\n * removing the keys removes the DS records at the registry).\n */\n override async disableDnssec(\n domainName: string,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n try {\n const keys = await this.http.request<GandiKey[]>({\n path: `/livedns/domains/${domainName}/keys`,\n ...opts,\n });\n for (const k of keys ?? []) {\n if (k.deleted || !k.id) continue;\n await this.http.request({\n method: 'DELETE',\n path: `/livedns/domains/${domainName}/keys/${encodeURIComponent(k.id)}`,\n ...opts,\n });\n }\n return { success: true, message: 'DNSSEC disabled successfully' };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n /**\n * Read email forwarding via GET /email/forwards/{domain}. A Gandi forward has a\n * `source` (local part) and multiple `destinations`; we expand each destination\n * into its own {alias, forwardTo} row.\n */\n override async getEmailForwarding(\n domainName: string,\n opts?: RequestOptions\n ): Promise<EmailForward[]> {\n const forwards = await this.http.request<GandiForward[]>({\n path: `/email/forwards/${domainName}`,\n ...opts,\n });\n const out: EmailForward[] = [];\n for (const f of forwards ?? []) {\n for (const dest of f.destinations ?? []) {\n if (f.source && dest) out.push({ alias: f.source, forwardTo: dest });\n }\n }\n return out;\n }\n\n /**\n * Replace email forwarding (full replace; empty clears). Gandi has no bulk\n * endpoint, so diff against the current forwards: group desired rows by source,\n * DELETE sources no longer wanted, PUT changed sources, POST new ones.\n */\n override async setEmailForwarding(\n domainName: string,\n forwards: EmailForward[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n try {\n const desired = new Map<string, string[]>();\n for (const f of forwards) {\n const list = desired.get(f.alias) ?? [];\n list.push(f.forwardTo);\n desired.set(f.alias, list);\n }\n const current = await this.http.request<GandiForward[]>({\n path: `/email/forwards/${domainName}`,\n ...opts,\n });\n const currentSources = new Set(\n (current ?? []).map(f => f.source).filter((s): s is string => !!s)\n );\n\n for (const source of currentSources) {\n if (!desired.has(source)) {\n await this.http.request({\n method: 'DELETE',\n path: `/email/forwards/${domainName}/${encodeURIComponent(source)}`,\n ...opts,\n });\n }\n }\n for (const [source, destinations] of desired) {\n if (currentSources.has(source)) {\n await this.http.request({\n method: 'PUT',\n path: `/email/forwards/${domainName}/${encodeURIComponent(source)}`,\n body: { destinations },\n ...opts,\n });\n } else {\n await this.http.request({\n method: 'POST',\n path: `/email/forwards/${domainName}`,\n body: { source, destinations },\n ...opts,\n });\n }\n }\n return { success: true, message: 'Email forwarding updated successfully' };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n /**\n * Read web/URL forwarding via GET /domain/domains/{fqdn}/webredirs. Gandi keys\n * each redirect by the full FQDN of the source subdomain; we normalize that back\n * to a host relative to the apex (e.g. `shop.example.com` -> `shop`).\n */\n override async getDomainForwarding(\n domainName: string,\n opts?: RequestOptions\n ): Promise<DomainForward[]> {\n const redirs = await this.http.request<GandiWebredir[]>({\n path: `/domain/domains/${domainName}/webredirs`,\n ...opts,\n });\n return (redirs ?? []).map(r => ({\n host: gandiFqdnToHost(r.host ?? domainName, domainName),\n url: r.url ?? '',\n type: GANDI_TYPE_TO_FORWARD[(r.type ?? '').toLowerCase()] ?? 'permanent',\n }));\n }\n\n /**\n * Replace web/URL forwarding (full replace; empty clears). Gandi's webredirs\n * endpoint has no update — only create (POST) and delete (DELETE by FQDN) — so\n * this diffs against the current set: delete entries that are gone or changed,\n * then create the desired ones that aren't already present identically.\n *\n * Gandi only supports forwarding a subdomain, not the apex; an apex host (\"@\")\n * throws rather than silently failing with a 500 from the API.\n */\n override async setDomainForwarding(\n domainName: string,\n forwards: DomainForward[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n try {\n const settable = settableForwards(forwards); // reject masked before any write\n for (const f of settable) {\n if (!f.host || f.host === '@') {\n throw new Error(\n `${this.name}: web forwarding requires a subdomain host; Gandi cannot forward the apex (\"@\")`\n );\n }\n }\n const current = await this.getDomainForwarding(domainName, opts);\n const same = (a: DomainForward, b: DomainForward): boolean =>\n a.host === b.host && a.url === b.url && a.type === b.type;\n\n // delete current entries that are no longer wanted, or whose url/type changed\n for (const existing of current) {\n if (!settable.some(f => same(f, existing))) {\n await this.http.request({\n method: 'DELETE',\n path: `/domain/domains/${domainName}/webredirs/${gandiHostToFqdn(existing.host, domainName)}`,\n ...opts,\n });\n }\n }\n // create desired entries that aren't already present identically\n for (const f of settable) {\n if (!current.some(c => same(c, f))) {\n await this.http.request({\n method: 'POST',\n path: `/domain/domains/${domainName}/webredirs`,\n // `protocol` is intentionally omitted so Gandi applies its default\n // (http). Requesting `https` makes Gandi provision a Let's Encrypt\n // certificate for the source host, which our normalized model doesn't\n // express (and which the sandbox can't do — it 500s).\n body: {\n host: gandiHostToFqdn(f.host, domainName),\n type: GANDI_FORWARD_TYPE[f.type],\n url: f.url,\n },\n ...opts,\n });\n }\n }\n return { success: true, message: 'Domain forwarding updated successfully' };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n override async setAutoRenew(\n domainName: string,\n enabled: boolean,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n try {\n await this.http.request({\n method: 'PATCH',\n path: `/domain/domains/${domainName}/autorenew`,\n body: { enabled },\n ...opts,\n });\n return {\n success: true,\n message: `Auto-renew ${enabled ? 'enabled' : 'disabled'} successfully`,\n };\n } catch (error) {\n // Disabling auto-renew on a domain that never had an autorenew record\n // returns 400 \"This product has no autorenew record\". That state already\n // means auto-renew is off, so treat it as idempotent success.\n const message = toRegistrarError(error).message;\n if (!enabled && /no autorenew record/i.test(message)) {\n return { success: true, message: 'Auto-renew disabled successfully' };\n }\n return { success: false, message };\n }\n }\n\n /**\n * WHOIS privacy on Gandi is the per-contact `data_obfuscated` flag, toggled by\n * PATCHing the domain's owner contact. Enabling works; disabling is accepted\n * (HTTP 202) but is a **no-op for individual (natural-person) registrants** —\n * Gandi keeps their contact obfuscated in WHOIS for GDPR regardless. The\n * request is well-formed, so this reports the registrar's acceptance; whether\n * the state actually changes is governed by Gandi's policy for the contact\n * type. (Verified live against the sandbox.)\n */\n override async setPrivacy(\n domainName: string,\n enabled: boolean,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.mutate(\n {\n method: 'PATCH',\n path: `/domain/domains/${domainName}/contacts`,\n body: { owner: { data_obfuscated: enabled } },\n },\n `WHOIS privacy ${enabled ? 'enabled' : 'disabled'} successfully`,\n opts\n );\n }\n\n /**\n * Replaces the entire zone via LiveDNS (`PUT /livedns/domains/{d}/records`),\n * which takes `items` as grouped rrsets. Flat records are regrouped by\n * (name, type); MX/SRV values are re-encoded with their numeric prefixes — the\n * exact inverse of `getDnsRecords`, so a get→set round-trip is lossless.\n */\n override async setDnsRecords(\n domainName: string,\n records: DnsRecord[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.mutate(\n {\n method: 'PUT',\n path: `/livedns/domains/${domainName}/records`,\n body: { items: toGandiRrsets(records) },\n },\n 'DNS records updated successfully',\n opts\n );\n }\n\n /**\n * Updates contact roles by PATCHing the domain's contacts. Only supplied roles\n * are sent; `registrant` maps to Gandi's `owner`, `billing` to `bill`. A\n * registrant change can trigger registry verification — not exercised live.\n */\n override async updateContacts(\n domainName: string,\n contacts: ContactSet,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const body: GandiContacts = {};\n if (contacts.registrant) body.owner = toGandiContact(contacts.registrant);\n if (contacts.admin) body.admin = toGandiContact(contacts.admin);\n if (contacts.tech) body.tech = toGandiContact(contacts.tech);\n if (contacts.billing) body.bill = toGandiContact(contacts.billing);\n if (Object.keys(body).length === 0) {\n throw new Error(`${this.name}: updateContacts requires at least one contact role`);\n }\n return this.mutate(\n { method: 'PATCH', path: `/domain/domains/${domainName}/contacts`, body },\n 'Contacts updated successfully',\n opts\n );\n }\n\n /**\n * Registers a domain via `POST /domain/domains`. Requires a registrant (Gandi's\n * `owner`); other roles fall back to it. `data_obfuscated` carries the privacy\n * choice. Spends real money; not exercised against a live account.\n */\n override async registerDomain(\n domainName: string,\n input: RegisterDomainInput,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const registrant = input.contacts.registrant;\n if (!registrant) {\n throw new Error(`${this.name}: registration requires at least a registrant contact`);\n }\n const owner = toGandiContact(registrant);\n if (input.privacy != null) owner.data_obfuscated = input.privacy;\n const body: Record<string, unknown> = {\n fqdn: domainName,\n duration: input.years ?? 1,\n owner,\n };\n if (input.contacts.admin) body.admin = toGandiContact(input.contacts.admin);\n if (input.contacts.tech) body.tech = toGandiContact(input.contacts.tech);\n if (input.contacts.billing) body.bill = toGandiContact(input.contacts.billing);\n if (input.nameservers && input.nameservers.length > 0) body.nameservers = input.nameservers;\n return this.mutate(\n { method: 'POST', path: '/domain/domains', body },\n `Domain ${domainName} registered successfully`,\n opts\n );\n }\n\n /**\n * Transfers a domain in via `POST /domain/transferin/{d}` with the EPP auth code\n * (`authinfo`) and the new owner. Spends real money; not exercised against a\n * live account.\n */\n override async transferIn(\n domainName: string,\n input: TransferDomainInput,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const registrant = input.contacts?.registrant;\n if (!registrant) {\n throw new Error(`${this.name}: transfer requires a registrant contact (Gandi's owner)`);\n }\n const owner = toGandiContact(registrant);\n if (input.privacy != null) owner.data_obfuscated = input.privacy;\n const body: Record<string, unknown> = {\n fqdn: domainName,\n authinfo: input.authCode,\n owner,\n };\n if (input.years != null) body.duration = input.years;\n return this.mutate(\n { method: 'POST', path: `/domain/transferin/${domainName}`, body },\n `Domain ${domainName} transfer requested successfully`,\n opts\n );\n }\n\n private async mutate(\n req: { method: string; path: string; body?: unknown },\n successMessage: string,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n try {\n await this.http.request({ ...req, ...opts });\n return { success: true, message: successMessage };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n}\n\n// map a Gandi contact into the normalized Contact shape. Gandi has no distinct\n// second address line, so `address2` is left undefined.\n// map the normalized Contact to Gandi's contact shape (given/family/streetaddr/…).\n// `type` is Gandi's contact type: 1 (company) when an organization is set, else\n// 0 (individual).\nfunction toGandiContact(c: Contact): GandiContact & { type: number } {\n const contact: GandiContact & { type: number } = {\n given: c.firstName,\n family: c.lastName,\n email: c.email,\n phone: c.phone,\n streetaddr: c.address1,\n city: c.city,\n zip: c.postalCode,\n country: c.country,\n type: c.organization ? 1 : 0,\n };\n if (c.organization) contact.orgname = c.organization;\n if (c.fax) contact.fax = c.fax;\n if (c.state) contact.state = toGandiState(c.state, c.country);\n return contact;\n}\n\n// Gandi wants the ISO 3166-2 subdivision code for `state` (e.g. `US-CA`), and\n// rejects a bare 2-letter code as \"shorter than minimum length 4\". The rest of\n// the library stores just the subdivision (`CA`, `ENG`), so prefix it with the\n// country to form the ISO 3166-2 code. A value that already contains a `-`\n// (already `US-CA`) is left as-is.\nfunction toGandiState(state: string, country: string): string {\n return country && !state.includes('-') ? `${country}-${state}` : state;\n}\n\n// regroup flat DnsRecords into Gandi LiveDNS rrsets (one per name+type, values\n// collected). MX/SRV values are re-encoded with their numeric prefixes — the\n// exact inverse of getDnsRecords — so a get→set round-trip reproduces the zone.\nfunction toGandiRrsets(records: DnsRecord[]): GandiRecord[] {\n const groups = new Map<string, GandiRecord>();\n for (const r of records) {\n const type = r.type.toUpperCase();\n const name = r.name || '@';\n let value = r.value;\n if (type === 'MX' && r.priority != null) {\n value = `${r.priority} ${r.value}`;\n } else if (type === 'SRV') {\n value = `${r.priority ?? 0} ${r.weight ?? 0} ${r.port ?? 0} ${r.value}`;\n }\n const key = `${name} ${type}`;\n let rrset = groups.get(key);\n if (!rrset) {\n rrset = { rrset_name: name, rrset_type: type, rrset_values: [] };\n groups.set(key, rrset);\n }\n if (rrset.rrset_ttl == null && r.ttl != null) rrset.rrset_ttl = r.ttl;\n rrset.rrset_values!.push(value);\n }\n return [...groups.values()];\n}\n\n// Gandi webredirs are keyed by the full FQDN of the source subdomain, while our\n// DomainForward.host is relative to the apex. These convert between the two.\nfunction gandiHostToFqdn(host: string, domain: string): string {\n return !host || host === '@' ? domain : `${host}.${domain}`;\n}\nfunction gandiFqdnToHost(fqdn: string, domain: string): string {\n if (fqdn === domain) return '@';\n const suffix = `.${domain}`;\n return fqdn.endsWith(suffix) ? fqdn.slice(0, -suffix.length) : fqdn;\n}\n\nfunction fromGandiContact(c: GandiContact | undefined): Contact | undefined {\n if (!c) return undefined;\n return {\n firstName: c.given ?? '',\n lastName: c.family ?? '',\n organization: c.orgname ? String(c.orgname) : undefined,\n email: c.email ?? '',\n phone: c.phone ?? '',\n fax: c.fax ? String(c.fax) : undefined,\n address1: c.streetaddr ?? '',\n city: c.city ?? '',\n state: c.state ? String(c.state) : undefined,\n postalCode: c.zip ?? '',\n country: c.country ?? '',\n };\n}\n\n// pick a numeric price from a Gandi price entry, preferring the tax-inclusive\n// amount. Gandi reports prices in major currency units (e.g. 15.5), so no\n// cents-to-dollars conversion is needed.\nfunction pickPrice(price: GandiPrice | undefined): number | undefined {\n if (!price) return undefined;\n const value = price.price_after_taxes ?? price.price_before_taxes;\n return typeof value === 'number' && Number.isFinite(value) ? value : undefined;\n}\n\n// parse a DS resource-record line into its components. Gandi's `ds` field looks\n// like \"example.com. 3600 IN DS 50651 13 2 01CC01EE...\". Returns null if it\n// doesn't contain a DS record (e.g. a key with no published DS).\nfunction parseDsRecord(ds: string | undefined): DsRecord | null {\n if (!ds) return null;\n const tokens = ds.trim().split(/\\s+/);\n const i = tokens.findIndex(t => t.toUpperCase() === 'DS');\n const parts = i >= 0 ? tokens.slice(i + 1) : tokens;\n if (parts.length < 4) return null;\n const [keyTag, algorithm, digestType, ...digest] = parts;\n return {\n keyTag: Number(keyTag) || 0,\n algorithm: Number(algorithm) || 0,\n digestType: Number(digestType) || 0,\n digest: digest.join(''),\n };\n}\n","import type {\n ConfigField,\n ConnectionResult,\n Contact,\n ContactSet,\n DnsRecord,\n Domain,\n DomainAvailability,\n DomainForward,\n DomainForwardType,\n ListDomainsOptions,\n OperationResult,\n RegisterDomainInput,\n RegistrationConsent,\n RegistrarOptions,\n RequestOptions,\n TldPricing,\n TransferDomainInput,\n} from '../types';\nimport { createDomain, filterDomains, settableForwards } from '../utils';\nimport {\n ConfigurationError,\n ConsentRequiredError,\n NotFoundError,\n NotImplementedError,\n toRegistrarError,\n} from '../errors';\nimport { BaseRegistrar, selectBaseUrl } from '../registrar';\nimport { Feature, type RegistrarFeature } from '../features';\nimport type { RegistrarCredentials } from '../types';\n\n// a mailing address as GoDaddy models it\ninterface GoDaddyAddress {\n address1?: string;\n address2?: string;\n city?: string;\n state?: string;\n postalCode?: string;\n country?: string;\n}\n\n// a contact as GoDaddy models it (registrant / admin / tech / billing)\ninterface GoDaddyContact {\n nameFirst?: string;\n nameLast?: string;\n organization?: string;\n email?: string;\n phone?: string;\n fax?: string;\n addressMailing?: GoDaddyAddress;\n}\n\ninterface GoDaddyDomain {\n domain: string;\n status?: string;\n createdAt?: string;\n expires?: string;\n renewDeadline?: string;\n renewAuto?: boolean;\n locked?: boolean;\n privacy?: boolean;\n nameServers?: string[];\n contactRegistrant?: GoDaddyContact;\n contactAdmin?: GoDaddyContact;\n contactTech?: GoDaddyContact;\n contactBilling?: GoDaddyContact;\n authCode?: string;\n}\n\n// one entry from POST /v1/domains/available; `price` is in micro-units of `currency`\ninterface GoDaddyAvailability {\n domain: string;\n available?: boolean;\n price?: number;\n currency?: string;\n period?: number;\n}\n\ninterface GoDaddyAvailabilityResponse {\n domains?: GoDaddyAvailability[];\n}\n\n// a DNS record as GoDaddy models it\ninterface GoDaddyRecord {\n type: string;\n name: string;\n data: string;\n ttl?: number;\n priority?: number;\n weight?: number;\n port?: number;\n}\n\n// a legal agreement GoDaddy requires consent to before registering a TLD\ninterface GoDaddyAgreement {\n agreementKey: string;\n title?: string;\n url?: string;\n}\n\n// GoDaddy models forwarding as a per-fqdn resource under the v2 customer-scoped\n// route /v2/customers/{customerId}/domains/forwards/{fqdn}. Note the asymmetry\n// between the write and read enums: a write takes REDIRECT_PERMANENT (301) /\n// REDIRECT_TEMPORARY (302) / MASKED (frame), but a read returns the *_REDIRECT\n// spelling (PERMANENT_REDIRECT / TEMPORARY_REDIRECT). `mask` is only meaningful\n// for MASKED. Verified live 2026-08-29.\ninterface GoDaddyForward {\n fqdn?: string;\n type?: string;\n url?: string;\n mask?: { title?: string; description?: string; keywords?: string };\n}\n\n// normalized DomainForwardType → the token the v2 write endpoint expects\nconst GD_FORWARD_TYPE: Record<'temporary' | 'permanent', string> = {\n permanent: 'REDIRECT_PERMANENT',\n temporary: 'REDIRECT_TEMPORARY',\n};\n// every token a v2 read might return → normalized DomainForwardType. Both the\n// write spelling (REDIRECT_*) and the read spelling (*_REDIRECT) are accepted so\n// the map is robust to either surface.\nconst GD_TYPE_TO_FORWARD: Record<string, DomainForwardType> = {\n REDIRECT_PERMANENT: 'permanent',\n REDIRECT_TEMPORARY: 'temporary',\n PERMANENT_REDIRECT: 'permanent',\n TEMPORARY_REDIRECT: 'temporary',\n MASKED: 'masked', // read-only; setDomainForwarding rejects it\n};\n\n// GoDaddy customerId is a UUID; a raw shopper/account number is not.\nconst UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\n// GoDaddy reports availability prices in micro-units (1,000,000 = 1 unit of currency)\nconst PRICE_MICRO_UNITS = 1_000_000;\n\n// --- v3 API shapes ---------------------------------------------------------\n// The v3 \"Domain Lifecycle Management\" API models money, domains, DNS, and\n// registration differently from v1. These interfaces cover only the fields we\n// read/write.\n\n// v3 \"Simple Money\": `value` is an integer in the currency's minor units\n// (cents for USD/EUR, whole units for zero-decimal currencies like JPY).\ninterface GdV3Money {\n currencyCode?: string;\n value?: number;\n}\n\ninterface GdV3TermPrice {\n period?: number;\n price?: GdV3Money;\n renewalPrice?: GdV3Money;\n}\n\ninterface GdV3Availability {\n domain: string;\n available?: boolean;\n prices?: GdV3TermPrice[];\n inventory?: string; // e.g. \"STANDARD\" | \"PREMIUM\"\n}\n\ninterface GdV3Domain {\n domain: string;\n status?: string;\n createdAt?: string;\n updatedAt?: string;\n expiresAt?: string;\n renewBy?: string;\n autoRenew?: boolean;\n privacy?: boolean;\n transferLock?: boolean;\n nameServers?: string[];\n}\n\ninterface GdV3Link {\n href: string;\n rel?: string;\n}\n\ninterface GdV3DomainCollection {\n items?: GdV3Domain[];\n links?: GdV3Link[];\n}\n\n// one DNS record in a v3 zone; `recordId` is server-assigned and required to\n// update/delete an individual record (v3 has no bulk replace).\ninterface GdV3DnsRecord {\n recordId?: string;\n name: string;\n type: string;\n data: string;\n ttl?: number;\n priority?: number;\n weight?: number;\n port?: number;\n service?: string;\n protocol?: string;\n flag?: number;\n tag?: string;\n}\n\ninterface GdV3DnsRecordPage {\n items?: GdV3DnsRecord[];\n totalPages?: number;\n links?: GdV3Link[];\n}\n\ninterface GdV3Fee {\n type: string;\n fee?: GdV3Money;\n}\n\ninterface GdV3Agreement {\n agreementType: string;\n title?: string;\n}\n\ninterface GdV3Quote {\n quoteToken?: string;\n requiredAgreements?: GdV3Agreement[];\n fees?: GdV3Fee[];\n}\n\ninterface GdV3Registration {\n registrationId?: string;\n operationId?: string;\n status?: string;\n}\n\ninterface GdV3Operation {\n operationId?: string;\n status?: string;\n error?: { code?: string; message?: string };\n}\n\n/**\n * GoDaddy Registrar\n * API docs: https://developer.godaddy.com/en/docs/api-users/domains\n *\n * GoDaddy runs two concurrent API surfaces and this provider is a hybrid:\n *\n * - **v3** (Domain Lifecycle Management) — the modern surface, PAT/Bearer only.\n * Covers discovery (availability/suggestions), registration (quote → execute),\n * DNS records, nameservers, and list/get. It has **no** endpoints for the\n * post-registration management operations.\n * - **v1** — the legacy surface, accepts either a PAT or the deprecated\n * `sso-key` credential. It's the only place renew, transfer, auto-renew,\n * lock/unlock, privacy, and contact updates live, and the only surface OTE\n * (the test environment) exposes — OTE has no v3.\n *\n * Routing (`useV3`): v3 is used only in production **with a PAT**. With an\n * sso-key, or against OTE/sandbox (which has no v3), every call falls back to\n * v1. The management operations above are always v1 regardless. This keeps the\n * full contract working in OTE (all-v1) while preferring v3 in production.\n *\n * Credentials: supply `apiToken` (a Personal Access Token) for production/v3, or\n * `apiKey` + `apiSecret` (an OTE Key/Secret) for sandbox testing. The auth\n * header is chosen automatically — `Bearer` when a token is present, else\n * `sso-key`.\n *\n * `registerDomain` / `transferIn` spend real money. In v3, register uses the\n * quote-then-execute flow (price-locked via `quoteToken`, agreements\n * acknowledged in the consent block); v3 takes the contact profile from the\n * account identity and derives `agreedBy` server-side, so only `consent` (the\n * agreement acknowledgement) is required. In v1 (OTE), register uses the legacy\n * purchase flow and requires `consent.agreedBy` = the consenting party's IP.\n * Callers omitting `consent` entirely get a `ConsentRequiredError`.\n */\nexport class GoDaddyRegistrar extends BaseRegistrar {\n readonly name = 'godaddy';\n\n static readonly displayName = 'GoDaddy';\n static readonly website = 'godaddy.com';\n static readonly helpText =\n 'Authenticate one of two ways. For production, create a Personal Access ' +\n 'Token (PAT) at https://developer.godaddy.com and pass it as `apiToken` — ' +\n 'this enables the modern v3 API. For sandbox testing, create OTE ' +\n '(test environment) keys and pass `apiKey` + `apiSecret` with ' +\n '{ environment: \"sandbox\" }; OTE only exposes the legacy v1 API. The ' +\n 'sso-key (API Key/Secret) scheme is deprecated by GoDaddy in 2026. ' +\n 'Domain forwarding uses the v2 customer-scoped API — set `customerId` to ' +\n 'your GoDaddy customer UUID, or to your numeric shopper/account ID (which ' +\n 'the client resolves to the UUID via an sso-key-authenticated lookup).';\n static readonly configFields: ConfigField[] = [\n { name: 'apiToken', label: 'API Token (PAT)', type: 'password', required: false },\n { name: 'apiKey', label: 'API Key', type: 'password', required: false },\n { name: 'apiSecret', label: 'API Secret', type: 'password', required: false },\n { name: 'customerId', label: 'Customer ID or Shopper ID', type: 'text', required: false },\n ];\n // GoDaddy's OTE (\"Operational Test Environment\") is its sandbox\n static readonly supportsSandbox = true;\n // Beyond core: domain forwarding and transfer-out auth code (the `authCode`\n // field on the v1 domain-detail response). Forwarding uses the v2\n // customer-scoped route /v2/customers/{customerId}/domains/forwards/{fqdn}\n // (the old v1 /v1/domains/forwards routes now 404); it requires `customerId`\n // to be configured — verified live 2026-08-29. DNSSEC has no dedicated\n // endpoint (DS records go through the generic DNS API), and there's no\n // glue-record, email, or push-webhook API.\n static readonly extendedFeatures: readonly RegistrarFeature[] = [\n Feature.GetAuthCode,\n Feature.GetDomainForwarding,\n Feature.SetDomainForwarding,\n ];\n\n // true → prefer the v3 API (production + PAT). false → all calls use v1\n // (sso-key auth, or OTE/sandbox where v3 does not exist).\n private readonly useV3: boolean;\n\n // memoized v2 customerId (UUID) resolution; see resolveCustomerId()\n private customerIdPromise?: Promise<string>;\n\n constructor(credentials: RegistrarCredentials, options?: RegistrarOptions) {\n const authHeader = GoDaddyRegistrar.authHeader(credentials);\n super(\n credentials,\n {\n baseUrl: selectBaseUrl('GoDaddy', options?.environment, {\n production: 'https://api.godaddy.com',\n sandbox: 'https://api.ote-godaddy.com',\n }),\n headers: {\n 'Authorization': authHeader,\n 'Accept': 'application/json',\n 'Content-Type': 'application/json',\n },\n },\n options\n );\n // v3 requires a PAT and is not deployed to OTE, so only use it in production\n // when a token was supplied.\n this.useV3 = options?.environment !== 'sandbox' && !!credentials.apiToken;\n }\n\n // Choose the Authorization header: Bearer PAT if a token is supplied,\n // otherwise the legacy sso-key. Missing credentials produce a header that the\n // API rejects at request time (matching the other providers), rather than\n // throwing at construction.\n private static authHeader(credentials: RegistrarCredentials): string {\n if (credentials.apiToken) return `Bearer ${credentials.apiToken}`;\n return `sso-key ${credentials.apiKey ?? ''}:${credentials.apiSecret ?? ''}`;\n }\n\n override async testConnection(opts?: RequestOptions): Promise<ConnectionResult> {\n try {\n if (this.useV3) {\n await this.http.request<GdV3DomainCollection>({\n path: '/v3/domains/domain-names',\n query: { pageSize: 1 },\n ...opts,\n });\n } else {\n await this.http.request<GoDaddyDomain[]>({ path: '/v1/domains', ...opts });\n }\n return { success: true, message: 'Connection successful' };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n override async listDomains(opts?: ListDomainsOptions): Promise<Domain[]> {\n const { search, ...reqOpts } = opts ?? {};\n const domains = this.useV3\n ? await this.listDomainsV3(reqOpts)\n : await this.listDomainsV1(reqOpts);\n return filterDomains(domains, search);\n }\n\n // v3: cursor-paginated collection; follow the rel=\"next\" HATEOAS link.\n private async listDomainsV3(reqOpts: RequestOptions): Promise<Domain[]> {\n const domains: Domain[] = [];\n let path = '/v3/domains/domain-names';\n let query: Record<string, string | number> | undefined = { pageSize: 200 }; // v3 max\n for (;;) {\n const res = await this.http.request<GdV3DomainCollection>({ path, query, ...reqOpts });\n for (const d of res.items ?? []) domains.push(this.toDomainV3(d));\n const next = (res.links ?? []).find(l => l.rel === 'next')?.href;\n if (!next || !res.items?.length) break;\n path = next; // absolute URL; HttpClient passes it through as-is\n query = undefined; // the next link already carries its cursor\n }\n return domains;\n }\n\n // v1: `marker`-paginated array (marker = last domain name seen).\n private async listDomainsV1(reqOpts: RequestOptions): Promise<Domain[]> {\n // status filters exclude expired domains: visible (active), renewable\n // (expiring soon), redemption (grace period). statusGroups repeats in the\n // query string, so it is embedded in the path directly. `includes=nameServers`\n // folds nameservers into this list call (they are otherwise omitted). Its\n // page-size param is literally named `limit`, whose max is 1000.\n const statusGroups = 'statusGroups=VISIBLE&statusGroups=RENEWABLE&statusGroups=REDEMPTION';\n const perPage = 1000; // GoDaddy's maximum page size\n const domains: Domain[] = [];\n let marker: string | undefined;\n for (;;) {\n const markerParam = marker ? `&marker=${encodeURIComponent(marker)}` : '';\n const res = await this.http.request<GoDaddyDomain[]>({\n path: `/v1/domains?limit=${perPage}&includes=nameServers&${statusGroups}${markerParam}`,\n ...reqOpts,\n });\n const list = res ?? [];\n for (const d of list) domains.push(this.toDomain(d));\n if (list.length < perPage) break;\n marker = list[list.length - 1]?.domain;\n if (!marker) break;\n }\n return domains;\n }\n\n override async getDomain(domainName: string, opts?: RequestOptions): Promise<Domain> {\n if (this.useV3) {\n const d = await this.http.request<GdV3Domain>({\n path: `/v3/domains/domain-names/${encodeURIComponent(domainName)}`,\n ...opts,\n });\n return this.toDomainV3(d);\n }\n const d = await this.http.request<GoDaddyDomain>({\n path: `/v1/domains/${encodeURIComponent(domainName)}`,\n ...opts,\n });\n return this.toDomain(d);\n }\n\n override async getNameservers(domainName: string, opts?: RequestOptions): Promise<string[]> {\n const domain = await this.getDomain(domainName, opts);\n return domain.nameservers;\n }\n\n override async checkAvailability(\n domainNames: string[],\n opts?: RequestOptions\n ): Promise<DomainAvailability[]> {\n if (this.useV3) {\n // v3 bulk check: POST { domains: [...] }; the response wraps results in\n // `items` and prices are multi-term.\n const res = await this.http.request<{ items?: GdV3Availability[] }>({\n method: 'POST',\n path: '/v3/domains/check-availability',\n body: { domains: domainNames },\n ...opts,\n });\n return (res.items ?? []).map(d => {\n const term = pickTerm(d.prices);\n return {\n domainName: d.domain,\n available: d.available ?? false,\n premium: isPremiumInventory(d.inventory),\n price: moneyToMajor(term?.price),\n currency: term?.price?.currencyCode,\n period: term?.period,\n };\n });\n }\n // v1 bulk check: POST an array of domains. checkType=FULL consults the\n // registry (slower but authoritative) rather than GoDaddy's cache.\n const res = await this.http.request<GoDaddyAvailabilityResponse>({\n method: 'POST',\n path: '/v1/domains/available?checkType=FULL',\n body: domainNames,\n ...opts,\n });\n return (res.domains ?? []).map(d => ({\n domainName: d.domain,\n available: d.available ?? false,\n price: d.price != null ? d.price / PRICE_MICRO_UNITS : undefined,\n currency: d.currency,\n period: d.period,\n }));\n }\n\n /**\n * GoDaddy has no standalone TLD-pricing endpoint — registration price is\n * returned inline with an availability check. So `getPricing` requires a full\n * domain (e.g. \"example.com\"), checks its availability, and reports the\n * registration price. A bare TLD throws, since GoDaddy can't price a TLD\n * without a specific name. Only `registration` is known here (GoDaddy's\n * availability response carries no separate renewal/transfer price).\n */\n override async getPricing(tldOrDomain: string, opts?: RequestOptions): Promise<TldPricing> {\n if (!tldOrDomain.includes('.')) {\n throw new NotImplementedError(\n `${this.name}: getPricing needs a full domain (e.g. \"example.com\"); ` +\n 'GoDaddy exposes pricing only per-domain via availability, not per-TLD'\n );\n }\n const tld = tldOrDomain.slice(tldOrDomain.indexOf('.') + 1);\n if (this.useV3) {\n // v3 availability carries both registration and renewal price per term.\n const res = await this.http.request<{ items?: GdV3Availability[] }>({\n method: 'POST',\n path: '/v3/domains/check-availability',\n body: { domains: [tldOrDomain] },\n ...opts,\n });\n const term = pickTerm(res.items?.[0]?.prices);\n return {\n tld,\n currency: term?.price?.currencyCode ?? 'USD',\n registration: moneyToMajor(term?.price),\n renewal: moneyToMajor(term?.renewalPrice),\n };\n }\n const [result] = await this.checkAvailability([tldOrDomain], opts);\n return {\n tld,\n currency: result?.currency ?? 'USD',\n registration: result?.price,\n };\n }\n\n /**\n * Registers a domain via GoDaddy's purchase flow. Requires per-call `consent`\n * (with `agreedBy` = the consenting party's IP): this fetches the TLD's\n * agreement keys, then POSTs the purchase with a `consent` block referencing\n * them. GoDaddy requires all four contact roles, so any role the caller omits\n * falls back to the registrant.\n */\n override async registerDomain(\n domainName: string,\n input: RegisterDomainInput,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const registrant = input.contacts.registrant;\n if (!registrant) {\n throw new Error(`${this.name}: registration requires at least a registrant contact`);\n }\n if (this.useV3) return this.registerDomainV3(domainName, input, opts);\n const tld = domainName.slice(domainName.indexOf('.') + 1);\n const privacy = input.privacy ?? false;\n const consent = await this.buildConsent(input.consent, tld, privacy, false, opts);\n\n const body = {\n domain: domainName,\n consent,\n contactRegistrant: toGoDaddyContact(registrant),\n contactAdmin: toGoDaddyContact(input.contacts.admin ?? registrant),\n contactTech: toGoDaddyContact(input.contacts.tech ?? registrant),\n contactBilling: toGoDaddyContact(input.contacts.billing ?? registrant),\n period: input.years ?? 1,\n privacy,\n renewAuto: input.autoRenew ?? false,\n ...(input.nameservers ? { nameServers: input.nameservers } : {}),\n };\n return this.mutate(\n { method: 'POST', path: '/v1/domains/purchase', body },\n `Domain ${domainName} registered successfully`,\n opts\n );\n }\n\n /**\n * v3 registration: quote-then-execute. First POST a quote for the domain/term\n * (price-locked via `quoteToken`, returns the agreements + fees to\n * acknowledge), then POST the registration with the token, a consent block\n * (acknowledging every required agreement + quoted fee), and the contact\n * profile. Registration is async (202), so poll the returned operation to\n * completion. Spends real money; there is no v3 sandbox, so this is\n * documented-but-unverified against a live purchase.\n */\n private async registerDomainV3(\n domainName: string,\n input: RegisterDomainInput,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n if (!input.consent) {\n throw new ConsentRequiredError(\n `${this.name}: registration requires \\`consent\\` (accepting the registration agreements)`\n );\n }\n const period = input.years ?? 1;\n const quote = await this.http.request<GdV3Quote>({\n method: 'POST',\n path: '/v3/domains/registration-quotes',\n body: { domain: domainName, period },\n ...opts,\n });\n if (!quote.quoteToken) {\n throw new Error(`${this.name}: registration quote did not return a quoteToken`);\n }\n // v3 wants a MINIMAL body for a standard REGISTRY registration:\n // `{ domain, period, quoteToken, consent }`. Two hard-won gotchas:\n // - No `profile` block. Sending one (even just autoRenew/privacy) is\n // rejected `INVALID_BODY`. Contacts come from the account identity\n // (the quote's `resolved.contactSource: \"ACCOUNT\"`), and autoRenew /\n // nameservers are applied as post-registration steps below.\n // - `acknowledgedFees` must be OMITTED unless the quote carried fees\n // (the array is `minItems: 1`, so `[]` is rejected). `agreedBy` is\n // resolved server-side from the token + caller IP, so it's not sent.\n const consent = {\n agreementTypes: (quote.requiredAgreements ?? []).map(a => a.agreementType),\n agreedAt: input.consent.agreedAt ?? new Date().toISOString(),\n ...(quote.fees && quote.fees.length ? { acknowledgedFees: quote.fees } : {}),\n };\n const body = { domain: domainName, period, quoteToken: quote.quoteToken, consent };\n try {\n const reg = await this.http.request<GdV3Registration>({\n method: 'POST',\n path: '/v3/domains/registrations',\n body,\n // v3 requires an Idempotency-Key on every execute endpoint; a retry\n // with the same key returns the original result instead of double-buying\n headers: { 'Idempotency-Key': crypto.randomUUID() },\n ...opts,\n });\n if (reg.operationId) await this.pollOperation(reg.operationId, opts);\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n // Post-registration: the minimal body can't carry these, so apply the\n // caller's intent now. GoDaddy registers with the account's default\n // auto-renew (typically ON), so always assert the requested value.\n const warnings: string[] = [];\n try {\n await this.setAutoRenew(domainName, input.autoRenew ?? false, opts);\n } catch (error) {\n warnings.push(`auto-renew not applied (${toRegistrarError(error).message})`);\n }\n if (input.nameservers) {\n try {\n await this.updateNameservers(domainName, input.nameservers, opts);\n } catch (error) {\n warnings.push(`nameservers not applied (${toRegistrarError(error).message})`);\n }\n }\n const suffix = warnings.length ? ` (registered, but ${warnings.join('; ')})` : '';\n return { success: true, message: `Domain ${domainName} registered successfully${suffix}` };\n }\n\n /**\n * Poll a v3 async operation until it leaves the pending states. GoDaddy\n * reports COMPLETED / SUCCESS on success and FAILED / ERROR (with an `error`\n * body) on failure; a failed operation throws.\n */\n private async pollOperation(\n operationId: string,\n opts?: RequestOptions,\n attempts = 10,\n delayMs = 1500\n ): Promise<void> {\n for (let i = 0; i < attempts; i++) {\n const op = await this.http.request<GdV3Operation>({\n path: `/v3/domains/operations/${encodeURIComponent(operationId)}`,\n ...opts,\n });\n const status = (op.status ?? '').toUpperCase();\n if (status === 'COMPLETED' || status === 'SUCCESS' || status === 'SUCCEEDED') return;\n if (status === 'FAILED' || status === 'ERROR') {\n throw new Error(op.error?.message ?? `operation ${operationId} failed`);\n }\n await new Promise(resolve => setTimeout(resolve, delayMs));\n }\n // still pending after the budget — treat as accepted; the caller can re-check\n }\n\n /**\n * Transfers a domain in with its auth code. GoDaddy's transfer body is much\n * smaller than a purchase — just the auth code + a `consent` block (fetched\n * with `forTransfer=true`, since transfer agreements can differ) + optional\n * period/renewAuto/privacy. No contacts: the existing registration's carry\n * over. v3 has no transfer endpoint, so this is always the v1 flow (which is\n * also what OTE exposes for testing).\n */\n override async transferIn(\n domainName: string,\n input: TransferDomainInput,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const tld = domainName.slice(domainName.indexOf('.') + 1);\n const privacy = input.privacy ?? false;\n const consent = await this.buildConsent(input.consent, tld, privacy, true, opts);\n\n const body: Record<string, unknown> = {\n authCode: input.authCode,\n consent,\n privacy,\n renewAuto: input.autoRenew ?? false,\n };\n if (input.years != null) body.period = input.years;\n return this.mutate(\n { method: 'POST', path: `/v1/domains/${encodeURIComponent(domainName)}/transfer`, body },\n `Domain ${domainName} transfer requested successfully`,\n opts\n );\n }\n\n /**\n * Builds the GoDaddy `consent` block shared by register and transfer: validates\n * consent is present (with `agreedBy`), fetches the agreement keys for the TLD\n * (register vs. transfer agreements differ, hence `forTransfer`), and stamps\n * `agreedAt`.\n */\n private async buildConsent(\n consent: RegistrationConsent | undefined,\n tld: string,\n privacy: boolean,\n forTransfer: boolean,\n opts?: RequestOptions\n ): Promise<{ agreementKeys: string[]; agreedAt: string; agreedBy: string }> {\n if (!consent) {\n throw new ConsentRequiredError(\n `${this.name}: this operation requires consent — supply \\`consent\\` ` +\n '(accepting the registration agreements)'\n );\n }\n if (!consent.agreedBy) {\n throw new ConsentRequiredError(\n `${this.name}: consent.agreedBy is required and must be the consenting party's IP address`\n );\n }\n const query: Record<string, string | number | boolean> = { tlds: tld, privacy };\n if (forTransfer) query.forTransfer = true;\n const agreements = await this.http.request<GoDaddyAgreement[]>({\n path: '/v1/domains/agreements',\n query,\n ...opts,\n });\n const agreementKeys = (agreements ?? []).map(a => a.agreementKey);\n if (agreementKeys.length === 0) {\n throw new ConsentRequiredError(`${this.name}: no agreements were returned for .${tld}`);\n }\n return {\n agreementKeys,\n agreedAt: consent.agreedAt ?? new Date().toISOString(),\n agreedBy: consent.agreedBy,\n };\n }\n\n override async renewDomain(\n domainName: string,\n years = 1,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.mutate(\n {\n method: 'POST',\n path: `/v1/domains/${encodeURIComponent(domainName)}/renew`,\n body: { period: years },\n },\n 'Domain renewed successfully',\n opts\n );\n }\n\n override async setAutoRenew(\n domainName: string,\n enabled: boolean,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.mutate(\n {\n method: 'PATCH',\n path: `/v1/domains/${encodeURIComponent(domainName)}`,\n body: { renewAuto: enabled },\n },\n `Auto-renew ${enabled ? 'enabled' : 'disabled'} successfully`,\n opts\n );\n }\n\n override async updateNameservers(\n domainName: string,\n nameservers: string[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n if (nameservers.length < 1 || nameservers.length > 13) {\n throw new Error('GoDaddy requires 1-13 nameservers');\n }\n if (this.useV3) {\n // v3 replaces nameservers with a dedicated PUT; the body is a bare array.\n // Like /registrations, this execute endpoint requires an Idempotency-Key.\n return this.mutate(\n {\n method: 'PUT',\n path: `/v3/domains/domain-names/${encodeURIComponent(domainName)}/nameservers`,\n body: nameservers,\n headers: { 'Idempotency-Key': crypto.randomUUID() },\n },\n 'Nameservers updated successfully',\n opts\n );\n }\n return this.mutate(\n {\n method: 'PATCH',\n path: `/v1/domains/${encodeURIComponent(domainName)}`,\n body: { nameServers: nameservers },\n },\n 'Nameservers updated successfully',\n opts\n );\n }\n\n override async lockDomain(domainName: string, opts?: RequestOptions): Promise<OperationResult> {\n return this.mutate(\n {\n method: 'PATCH',\n path: `/v1/domains/${encodeURIComponent(domainName)}`,\n body: { locked: true },\n },\n 'Domain locked successfully',\n opts\n );\n }\n\n override async unlockDomain(domainName: string, opts?: RequestOptions): Promise<OperationResult> {\n return this.mutate(\n {\n method: 'PATCH',\n path: `/v1/domains/${encodeURIComponent(domainName)}`,\n body: { locked: false },\n },\n 'Domain unlocked successfully',\n opts\n );\n }\n\n /**\n * Disabling privacy is a simple DELETE. Enabling it is a paid purchase\n * (`POST /v1/domains/{domain}/privacy/purchase`) requiring a consent block and\n * payment, so it's left unimplemented rather than silently spending money.\n */\n override async setPrivacy(\n domainName: string,\n enabled: boolean,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n if (enabled) {\n throw new NotImplementedError(\n `${this.name}: enabling privacy is a paid purchase and is not implemented; ` +\n 'only disabling privacy is supported via the API'\n );\n }\n const encoded = encodeURIComponent(domainName);\n try {\n await this.http.request({\n method: 'DELETE',\n path: `/v1/domains/${encoded}/privacy`,\n ...opts,\n });\n return { success: true, message: 'Privacy disabled successfully' };\n } catch (error) {\n const err = toRegistrarError(error);\n // GoDaddy's free privacy (\"Free DBP\") can't be canceled via DELETE — it\n // returns 409 CONFLICTING_STATUS. The only way to turn it off is to expose\n // the WHOIS via a domain PATCH (`exposeWhois: true`), but GoDaddy requires a\n // full legal consent block on that PATCH (`agreedAt` + `agreedBy` = the\n // consenting party's IP + `agreementKeys`) — the same consent as a\n // registration. setPrivacy can't carry that (and this client is edge-safe\n // with no reliable IP source), so surface a clear, actionable error instead\n // of silently failing. Paid DBP still cancels through the DELETE above.\n if (err.status === 409) {\n return {\n success: false,\n message:\n `${this.name}: this domain uses free WHOIS privacy (Free DBP), which the API ` +\n 'only disables by exposing the WHOIS via a consent block (agreedAt + agreedBy IP ' +\n '+ agreementKeys) that setPrivacy cannot supply; disable it in the GoDaddy dashboard.',\n };\n }\n return { success: false, message: err.message };\n }\n }\n\n override async getContacts(domainName: string, opts?: RequestOptions): Promise<ContactSet> {\n // v3's domain record omits contacts, so read them from v1 in both modes.\n const d = await this.http.request<GoDaddyDomain>({\n path: `/v1/domains/${encodeURIComponent(domainName)}`,\n ...opts,\n });\n return {\n registrant: fromGoDaddyContact(d.contactRegistrant),\n admin: fromGoDaddyContact(d.contactAdmin),\n tech: fromGoDaddyContact(d.contactTech),\n billing: fromGoDaddyContact(d.contactBilling),\n };\n }\n\n override async updateContacts(\n domainName: string,\n contacts: ContactSet,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n // include only the roles the caller supplied\n const body: Record<string, GoDaddyContact> = {};\n if (contacts.registrant) body.contactRegistrant = toGoDaddyContact(contacts.registrant);\n if (contacts.admin) body.contactAdmin = toGoDaddyContact(contacts.admin);\n if (contacts.tech) body.contactTech = toGoDaddyContact(contacts.tech);\n if (contacts.billing) body.contactBilling = toGoDaddyContact(contacts.billing);\n if (Object.keys(body).length === 0) {\n throw new Error('GoDaddy updateContacts requires at least one contact');\n }\n return this.mutate(\n { method: 'PATCH', path: `/v1/domains/${encodeURIComponent(domainName)}/contacts`, body },\n 'Contacts updated successfully',\n opts\n );\n }\n\n override async getDnsRecords(domainName: string, opts?: RequestOptions): Promise<DnsRecord[]> {\n if (this.useV3) {\n return (await this.getV3Records(domainName, opts)).map(fromV3Record);\n }\n const records = await this.http.request<GoDaddyRecord[]>({\n path: `/v1/domains/${encodeURIComponent(domainName)}/records`,\n ...opts,\n });\n return (records ?? []).map(r => ({\n type: r.type,\n name: r.name,\n value: r.data,\n ttl: r.ttl,\n priority: r.priority,\n weight: r.weight,\n port: r.port,\n }));\n }\n\n /**\n * Replaces the entire record set (full-replace semantics): any record not\n * present in `records` is removed. GoDaddy requires a minimum TTL of 600\n * seconds, so records without an explicit TTL default to 3600.\n *\n * v1 does this in one bulk PUT. v3 has no bulk endpoint — only per-record\n * POST/PUT/DELETE — so the v3 path diffs the desired set against the current\n * one (keyed by type+name+value): delete records no longer wanted, add new\n * ones, and PUT matched records whose TTL/priority/etc. changed.\n */\n override async setDnsRecords(\n domainName: string,\n records: DnsRecord[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n if (this.useV3) return this.setDnsRecordsV3(domainName, records, opts);\n const body: GoDaddyRecord[] = records.map(r => {\n const record: GoDaddyRecord = {\n type: r.type.toUpperCase(),\n name: r.name,\n data: r.value,\n ttl: r.ttl ?? 3600,\n };\n if (r.priority != null) record.priority = r.priority;\n if (r.weight != null) record.weight = r.weight;\n if (r.port != null) record.port = r.port;\n return record;\n });\n return this.mutate(\n { method: 'PUT', path: `/v1/domains/${encodeURIComponent(domainName)}/records`, body },\n 'DNS records updated successfully',\n opts\n );\n }\n\n // Read every DNS record in a v3 zone, following pagination.\n private async getV3Records(domainName: string, opts?: RequestOptions): Promise<GdV3DnsRecord[]> {\n const zone = encodeURIComponent(domainName);\n const records: GdV3DnsRecord[] = [];\n let path: string | undefined = `/v3/domains/zones/${zone}/dns-records`;\n let query: Record<string, string | number> | undefined = { pageSize: 100 }; // v3 max\n while (path) {\n const page: GdV3DnsRecordPage = await this.http.request<GdV3DnsRecordPage>({\n path,\n query,\n ...opts,\n });\n for (const r of page.items ?? []) records.push(r);\n const next = (page.links ?? []).find(l => l.rel === 'next')?.href;\n path = next && page.items?.length ? next : undefined;\n query = undefined;\n }\n return records;\n }\n\n private async setDnsRecordsV3(\n domainName: string,\n records: DnsRecord[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const zone = encodeURIComponent(domainName);\n const base = `/v3/domains/zones/${zone}/dns-records`;\n try {\n const current = await this.getV3Records(domainName, opts);\n const currentByKey = new Map(current.map(r => [dnsKeyV3(r), r]));\n const desired = records.map(toV3Record);\n const desiredKeys = new Set(desired.map(dnsKeyV3));\n\n // delete records that are no longer desired\n for (const r of current) {\n if (!desiredKeys.has(dnsKeyV3(r)) && r.recordId) {\n await this.http.request({\n method: 'DELETE',\n path: `${base}/${encodeURIComponent(r.recordId)}`,\n ...opts,\n });\n }\n }\n // add new records; update matched records whose fields changed\n for (const d of desired) {\n const existing = currentByKey.get(dnsKeyV3(d));\n if (!existing) {\n await this.http.request({ method: 'POST', path: base, body: d, ...opts });\n } else if (existing.recordId && dnsFieldsDiffer(existing, d)) {\n await this.http.request({\n method: 'PUT',\n path: `${base}/${encodeURIComponent(existing.recordId)}`,\n body: d,\n ...opts,\n });\n }\n }\n return { success: true, message: 'DNS records updated successfully' };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n // --- extended capabilities ---------------------------------------------\n\n /**\n * Resolve the configured `customerId` to the UUID the v2 API expects, memoized\n * for the instance's lifetime. GoDaddy's v2 customer-scoped routes key on a\n * customer **UUID**, which differs from the numeric shopper/account ID shown in\n * most dashboards. Callers may configure either:\n * - a UUID → used directly, and\n * - a numeric shopper ID → resolved via `GET /v1/shoppers/{id}?includes=customerId`.\n * The shopper lookup is **sso-key-only** (it rejects a PAT with 401), so\n * resolving a numeric ID requires `apiKey` + `apiSecret`; supplying the UUID\n * directly avoids that dependency. Throws a ConfigurationError when\n * `customerId` is absent, or a clear error when a numeric ID can't be resolved.\n */\n private async resolveCustomerId(opts?: RequestOptions): Promise<string> {\n const configured = this.credentials.customerId?.trim();\n if (!configured) {\n throw new ConfigurationError(\n `${this.name}: domain forwarding uses the v2 customer-scoped API, which ` +\n 'requires a customer ID. Set `customerId` to your GoDaddy customer UUID ' +\n '(or your numeric shopper/account ID, which will be resolved to the UUID).'\n );\n }\n if (UUID_RE.test(configured)) return configured;\n // numeric shopper ID → resolve to the customer UUID (sso-key only)\n return (this.customerIdPromise ??= (async () => {\n if (!this.credentials.apiKey || !this.credentials.apiSecret) {\n throw new ConfigurationError(\n `${this.name}: resolving a numeric shopper ID (\"${configured}\") to a customer ` +\n 'UUID requires an sso-key (apiKey + apiSecret); the shopper lookup rejects a ' +\n 'PAT. Either supply the customer UUID directly as `customerId`, or add sso-key ' +\n 'credentials.'\n );\n }\n try {\n const shopper = await this.http.request<{ customerId?: string }>({\n // resolution is sso-key-only, so send the sso-key header explicitly\n // rather than the instance default (which may be a Bearer PAT).\n path: `/v1/shoppers/${encodeURIComponent(configured)}`,\n query: { includes: 'customerId' },\n headers: {\n Authorization: `sso-key ${this.credentials.apiKey}:${this.credentials.apiSecret}`,\n },\n ...opts,\n });\n if (!shopper.customerId) {\n throw new Error('response did not include a customerId');\n }\n return shopper.customerId;\n } catch (error) {\n this.customerIdPromise = undefined; // allow a later retry\n throw new ConfigurationError(\n `${this.name}: could not resolve shopper ID \"${configured}\" to a customer UUID ` +\n `(${toRegistrarError(error).message}). Supply the customer UUID directly as ` +\n '`customerId`.'\n );\n }\n })());\n }\n\n /**\n * Read URL forwarding via the v2 customer-scoped route\n * GET /v2/customers/{customerId}/domains/forwards/{fqdn}?includeSubs=true.\n * GoDaddy keys forwarding by fqdn (the domain or a subdomain), so each entry\n * maps to a DomainForward whose `host` is relative to the apex (\"@\" = domain).\n * A domain with no forwarding returns 404, which we treat as an empty list.\n */\n override async getDomainForwarding(\n domainName: string,\n opts?: RequestOptions\n ): Promise<DomainForward[]> {\n const customerId = await this.resolveCustomerId(opts);\n let forwards: GoDaddyForward[];\n try {\n forwards = await this.http.request<GoDaddyForward[]>({\n path: this.forwardPath(customerId, domainName),\n query: { includeSubs: true },\n ...opts,\n });\n } catch (error) {\n if (error instanceof NotFoundError) return [];\n throw error;\n }\n return (forwards ?? []).map(f => ({\n host: fqdnToHost(f.fqdn ?? domainName, domainName),\n url: f.url ?? '',\n type: GD_TYPE_TO_FORWARD[(f.type ?? '').toUpperCase()] ?? 'permanent',\n }));\n }\n\n /**\n * Replace URL forwarding (full replace; an empty list clears it). GoDaddy has\n * no bulk endpoint — forwarding is a per-fqdn PUT/DELETE — so we read the\n * current forwards, DELETE any fqdn no longer wanted, then PUT each desired\n * rule to /v2/customers/{customerId}/domains/forwards/{fqdn}.\n */\n override async setDomainForwarding(\n domainName: string,\n forwards: DomainForward[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n try {\n const settable = settableForwards(forwards); // reject masked before any write\n const customerId = await this.resolveCustomerId(opts);\n const current = await this.getDomainForwarding(domainName, opts);\n const desiredHosts = new Set(settable.map(f => f.host || '@'));\n\n for (const existing of current) {\n if (!desiredHosts.has(existing.host)) {\n const fqdn = hostToFqdn(existing.host, domainName);\n await this.http.request({\n method: 'DELETE',\n path: this.forwardPath(customerId, fqdn),\n ...opts,\n });\n }\n }\n\n for (const f of settable) {\n const fqdn = hostToFqdn(f.host || '@', domainName);\n const body: GoDaddyForward = { type: GD_FORWARD_TYPE[f.type], url: f.url };\n await this.http.request({\n method: 'PUT',\n path: this.forwardPath(customerId, fqdn),\n body,\n ...opts,\n });\n }\n return { success: true, message: 'Domain forwarding updated successfully' };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n // the v2 customer-scoped forwarding resource path for a given fqdn\n private forwardPath(customerId: string, fqdn: string): string {\n return `/v2/customers/${encodeURIComponent(customerId)}/domains/forwards/${encodeURIComponent(fqdn)}`;\n }\n\n /**\n * Transfer authorization (EPP) code. GoDaddy exposes it as the `authCode`\n * field on the v1 domain-detail response; transfers were never moved to v3,\n * so this always reads from v1 regardless of the `useV3` routing. Returned\n * synchronously in the body — not email-only. The domain generally needs to\n * be unlocked and out of the 60-day post-registration/transfer lock for the\n * code to be usable for an outbound transfer.\n */\n override async getAuthCode(domainName: string, opts?: RequestOptions): Promise<string> {\n const d = await this.http.request<GoDaddyDomain>({\n path: `/v1/domains/${encodeURIComponent(domainName)}`,\n ...opts,\n });\n return d.authCode ?? '';\n }\n\n // map a v1 GoDaddy domain payload to the normalized Domain shape\n private toDomain(d: GoDaddyDomain): Domain {\n return createDomain({\n domainName: d.domain,\n registrar: this.name,\n status: d.status,\n createdDate: d.createdAt,\n expirationDate: d.expires,\n renewalDate: d.renewDeadline,\n autoRenew: d.renewAuto ?? false,\n locked: d.locked ?? false,\n privacy: d.privacy ?? false,\n nameservers: d.nameServers ?? [],\n });\n }\n\n // map a v3 GoDaddy domain payload to the normalized Domain shape. v3 renames\n // several fields (transferLock → locked, renewBy → renewalDate, expiresAt →\n // expirationDate).\n private toDomainV3(d: GdV3Domain): Domain {\n return createDomain({\n domainName: d.domain,\n registrar: this.name,\n status: d.status,\n createdDate: d.createdAt,\n expirationDate: d.expiresAt,\n renewalDate: d.renewBy,\n autoRenew: d.autoRenew ?? false,\n locked: d.transferLock ?? false,\n privacy: d.privacy ?? false,\n nameservers: d.nameServers ?? [],\n });\n }\n\n private async mutate(\n req: { method: string; path: string; body?: unknown; headers?: Record<string, string> },\n successMessage: string,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n try {\n await this.http.request({ ...req, ...opts });\n return { success: true, message: successMessage };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n}\n\n// --- contact mapping between GoDaddy's shape and the normalized Contact ---\n\nfunction fromGoDaddyContact(c: GoDaddyContact | undefined): Contact | undefined {\n if (!c) return undefined;\n const a = c.addressMailing ?? {};\n return {\n firstName: c.nameFirst ?? '',\n lastName: c.nameLast ?? '',\n organization: c.organization,\n email: c.email ?? '',\n phone: c.phone ?? '',\n fax: c.fax,\n address1: a.address1 ?? '',\n address2: a.address2,\n city: a.city ?? '',\n state: a.state,\n postalCode: a.postalCode ?? '',\n country: a.country ?? '',\n };\n}\n\nfunction toGoDaddyContact(c: Contact): GoDaddyContact {\n return {\n nameFirst: c.firstName,\n nameLast: c.lastName,\n organization: c.organization,\n email: c.email,\n phone: c.phone,\n fax: c.fax,\n addressMailing: {\n address1: c.address1,\n address2: c.address2,\n city: c.city,\n state: c.state ?? '',\n postalCode: c.postalCode,\n country: c.country,\n },\n };\n}\n\n// resolve a forwarding host relative to the apex into a full fqdn, and back.\n// \"@\" (or \"\") denotes the apex domain itself.\nfunction hostToFqdn(host: string, domain: string): string {\n return !host || host === '@' ? domain : `${host}.${domain}`;\n}\nfunction fqdnToHost(fqdn: string, domain: string): string {\n if (fqdn === domain) return '@';\n const suffix = `.${domain}`;\n return fqdn.endsWith(suffix) ? fqdn.slice(0, -suffix.length) : fqdn;\n}\n\n// --- v3 helpers ------------------------------------------------------------\n\n// Pick the pricing term to report — prefer the 1-year term, else the first.\nfunction pickTerm(prices?: GdV3TermPrice[]): GdV3TermPrice | undefined {\n if (!prices || prices.length === 0) return undefined;\n return prices.find(p => p.period === 1) ?? prices[0];\n}\n\n// Classify a v3 availability `inventory` value. Standard registry names report\n// \"REGISTRY\" (or \"STANDARD\"); premium/aftermarket names report a PREMIUM-type\n// value. Undefined when the field is absent.\nfunction isPremiumInventory(inventory?: string): boolean | undefined {\n if (inventory == null) return undefined;\n return /PREMIUM/i.test(inventory);\n}\n\n// Convert v3 \"Simple Money\" (integer minor units) to major units. Assumes\n// 2-decimal currencies (USD/EUR/…); zero-decimal currencies like JPY would need\n// currency-aware scaling, but GoDaddy prices in USD by default.\nfunction moneyToMajor(m?: GdV3Money): number | undefined {\n if (!m || m.value == null) return undefined;\n return m.value / 100;\n}\n\n// map a v3 DNS record to the normalized DnsRecord shape\nfunction fromV3Record(r: GdV3DnsRecord): DnsRecord {\n return {\n type: r.type,\n name: r.name,\n value: r.data,\n ttl: r.ttl,\n priority: r.priority,\n weight: r.weight,\n port: r.port,\n };\n}\n\n// map a normalized DnsRecord to a v3 record body. GoDaddy requires a minimum\n// TTL of 600s, so records without an explicit TTL default to 3600.\nfunction toV3Record(r: DnsRecord): GdV3DnsRecord {\n const out: GdV3DnsRecord = {\n type: r.type.toUpperCase(),\n name: r.name || '@',\n data: r.value,\n ttl: r.ttl ?? 3600,\n };\n if (r.priority != null) out.priority = r.priority;\n if (r.weight != null) out.weight = r.weight;\n if (r.port != null) out.port = r.port;\n return out;\n}\n\n// identity of a record for full-replace diffing: type + name + value, joined by\n// a unit-separator (U+001F) that can't appear in a hostname or record value —\n// avoids collisions without embedding a NUL (which would make the file binary).\nfunction dnsKeyV3(r: GdV3DnsRecord): string {\n return `${r.type.toUpperCase()}\\u001f${r.name || '@'}\\u001f${r.data}`;\n}\n\n// whether two records that share a key differ in a mutable field (TTL/priority/\n// weight/port), meaning the existing one should be PUT-updated\nfunction dnsFieldsDiffer(a: GdV3DnsRecord, b: GdV3DnsRecord): boolean {\n return (\n (a.ttl ?? 3600) !== (b.ttl ?? 3600) ||\n (a.priority ?? null) !== (b.priority ?? null) ||\n (a.weight ?? null) !== (b.weight ?? null) ||\n (a.port ?? null) !== (b.port ?? null)\n );\n}\n\n// NOTE: v3 registration takes contacts from the account identity (the quote's\n// `resolved.contactSource: \"ACCOUNT\"`) and rejects a `profile.contacts` block,\n// so there is no v3 contact mapper — see `registerDomainV3`. v1 uses\n// `toGoDaddyContact` above.\n","import type {\n ConfigField,\n ConnectionResult,\n Contact,\n ContactSet,\n DnsRecord,\n Domain,\n DomainAvailability,\n ListDomainsOptions,\n OperationResult,\n RegisterDomainInput,\n RegistrarOptions,\n RequestOptions,\n TldPricing,\n} from '../types';\nimport { createDomain, filterDomains } from '../utils';\nimport { AuthenticationError, NotImplementedError, toRegistrarError } from '../errors';\nimport { BaseRegistrar, selectBaseUrl } from '../registrar';\nimport { Feature, type RegistrarFeature } from '../features';\nimport type { RegistrarCredentials } from '../types';\nimport type { RequestConfig } from '../http';\n\nconst TOKEN_URL = 'https://api.namebright.com/auth/token';\n\n// response from the OAuth2 token endpoint\ninterface NbToken {\n access_token?: string;\n token_type?: string;\n expires_in?: number;\n}\n\n// the order returned by purchase/register and purchase/renew\ninterface NbOrder {\n OrderId?: number;\n TotalPrice?: number;\n}\n\n// a domain record from GET account/domains. The list endpoint does not return\n// nameservers (those come from account/domains/{domain}/nameservers).\ninterface NbDomain {\n DomainName?: string;\n domain?: string;\n Status?: string;\n ExpirationDate?: string;\n RegistrationDate?: string;\n AutoRenew?: boolean;\n Locked?: boolean;\n WhoIsPrivacy?: boolean;\n AuthCode?: string;\n}\n\n// the paged wrapper GET account/domains returns\ninterface NbDomainsPage {\n ResultsTotal?: number;\n CurrentPage?: number;\n Domains?: NbDomain[];\n domains?: NbDomain[];\n}\n\n// GET account/domains/{domain}/nameservers → { DomainName, NameServers: [...] }.\n// Be lenient about casing and a possible bare array.\ninterface NbNameservers {\n DomainName?: string;\n NameServers?: string[];\n Nameservers?: string[];\n nameservers?: string[];\n}\n\n// a contact object inside GET account/domains/{domain}/contacts/all. NameBright\n// splits the phone into a country-code part and the number.\ninterface NbContact {\n FirstName?: string;\n LastName?: string;\n Organization?: string;\n Department?: string;\n Email?: string;\n Address1?: string;\n Address2?: string;\n City?: string;\n Region?: string;\n Country?: string;\n PostalCode?: string;\n // NameBright returns the country-code parts as numbers (e.g. 1), not strings\n PhoneCountry?: string | number;\n Phone?: string | number;\n FaxCountry?: string | number;\n Fax?: string | number;\n}\n\n// GET account/domains/{domain}/contacts/all. NameBright exposes registrant,\n// administrative, and technical roles only (no billing).\ninterface NbContactsResponse {\n DomainName?: string;\n RegistrantContact?: NbContact;\n AdministrativeContact?: NbContact;\n TechnicalContact?: NbContact;\n}\n\n// the per-type DNS host records from GET account/domains/{domain}/hostrecords/all.\n// Each carries a numeric RecordId used to address it for deletion\n// (DELETE account/domains/{domain}/hostrecords/{type}/{RecordId}).\ninterface NbARecord {\n Subdomain?: string;\n IPV4Address?: string;\n RecordId?: number;\n}\ninterface NbAAAARecord {\n Subdomain?: string;\n IPV6Address?: string;\n RecordId?: number;\n}\ninterface NbCNAMERecord {\n Subdomain?: string;\n RedirectDomain?: string;\n RecordId?: number;\n}\ninterface NbMXRecord {\n Subdomain?: string;\n MailServer?: string;\n Priority?: number;\n RecordId?: number;\n}\ninterface NbTXTRecord {\n Subdomain?: string;\n TextRecord?: string;\n RecordId?: number;\n}\ninterface NbSRVRecord {\n Service?: string;\n Protocol?: string;\n Priority?: number;\n Weight?: number;\n Port?: number;\n Target?: string;\n RecordId?: number;\n}\n\ninterface NbHostRecords {\n DomainName?: string;\n ARecords?: NbARecord[];\n AAAARecords?: NbAAAARecord[];\n CNAMERecords?: NbCNAMERecord[];\n MXRecords?: NbMXRecord[];\n TXTRecords?: NbTXTRecord[];\n SRVRecords?: NbSRVRecord[];\n}\n\n// GET purchase/availability/{domain}. NameBright returns a per-domain result\n// with the standard unit price and an optional promotional price.\ninterface NbAvailability {\n DomainName?: string;\n ProductTypeName?: string;\n Status?: string;\n UnitPrice?: number;\n Promotion?: {\n PromotionPrice?: number;\n Discount?: number;\n Description?: string;\n };\n}\n\n/**\n * NameBright Registrar\n * API docs: https://api.namebright.com/rest/Help\n *\n * Credentials: create an API Application at\n * https://my.namebright.com/my-account/api-management. Each application has a\n * name and an IP whitelist; NameBright issues a client secret. The OAuth2\n * `client_id` is formatted \"<accountName>:<applicationName>\".\n *\n * Auth: OAuth2 client-credentials. We POST to the token endpoint for a bearer\n * token (valid ~30 minutes), cache it, and send it as `Authorization: Bearer`\n * on each REST call.\n *\n * The read operations are implemented here (testConnection, listDomains,\n * getDomain, getNameservers, getContacts, getDnsRecords, checkAvailability,\n * getAuthCode). `getPricing` throws NotImplementedError — NameBright has no\n * per-TLD price table.\n *\n * Write operations verified against a live account: lock/unlock, setAutoRenew,\n * and setPrivacy all update the shared `PUT /account/domains/{domain}` endpoint\n * (which takes the full AccountDomain body — we read-merge to avoid clobbering\n * the other flags). setDnsRecords applies a desired-state diff via per-type\n * POST/DELETE on `hostrecords/{type}[/{RecordId}]` (a blind delete-all +\n * re-create trips NameBright's flaky \"Duplicate host record\" check).\n *\n * updateNameservers (DELETE-all + per-server PUT on `nameservers[/{ns}]`) is\n * built from the documented endpoints but NOT live-verified — replacing the\n * nameservers on a live domain has no safe test path.\n *\n * registerDomain / renewDomain use the `purchase/register` and `purchase/renew`\n * order endpoints. They spend real money (each returns an order with a\n * `TotalPrice`), so they're built from the documented request shape but NOT\n * exercised against the live account. transferIn remains NotImplementedError —\n * NameBright's REST API exposes no transfer-in endpoint.\n */\nexport class NameBrightRegistrar extends BaseRegistrar {\n readonly name = 'namebright';\n\n static readonly displayName = 'NameBright';\n static readonly website = 'namebright.com';\n static readonly helpText =\n 'API access is not enabled by default — you must request it from NameBright ' +\n '(contact support / your account manager) before the API Management page is ' +\n 'available. Once enabled, create an API Application under my.namebright.com > ' +\n 'My Account > API Management. The Client ID is \"<accountName>:<applicationName>\"; ' +\n 'NameBright issues the Client Secret. Note the application also enforces an IP whitelist.';\n static readonly configFields: ConfigField[] = [\n { name: 'clientId', label: 'Client ID', type: 'text', required: true },\n { name: 'clientSecret', label: 'Client Secret', type: 'password', required: true },\n ];\n static readonly supportsSandbox = false; // NameBright has no sandbox environment\n // REST/JSON API covering the core lifecycle plus transfer-out auth code (the\n // `AuthCode` field on the domain-detail response). No DNSSEC, forwarding, or\n // push webhooks.\n static readonly extendedFeatures: readonly RegistrarFeature[] = [Feature.GetAuthCode];\n\n private token?: string;\n private tokenExpiresAt = 0;\n\n constructor(credentials: RegistrarCredentials, options?: RegistrarOptions) {\n super(\n credentials,\n {\n baseUrl: selectBaseUrl('NameBright', options?.environment, {\n production: 'https://api.namebright.com/rest',\n }),\n },\n options\n );\n }\n\n // fetch (and cache) an OAuth2 bearer token via the client-credentials grant\n private async getToken(opts?: RequestOptions): Promise<string> {\n const now = Date.now();\n if (this.token && now < this.tokenExpiresAt) return this.token;\n\n const res = await this.http.request<NbToken>({\n method: 'POST',\n path: TOKEN_URL,\n body: {\n grant_type: 'client_credentials',\n client_id: this.credentials.clientId,\n client_secret: this.credentials.clientSecret,\n },\n ...opts,\n });\n if (!res.access_token) {\n throw new AuthenticationError('NameBright: token endpoint returned no access_token');\n }\n this.token = res.access_token;\n // tokens last ~30 minutes; refresh a minute early\n const ttlMs = (res.expires_in ?? 1800) * 1000;\n this.tokenExpiresAt = now + ttlMs - 60_000;\n return this.token;\n }\n\n // issue an authenticated REST request, attaching a fresh bearer token\n private async authed<T>(\n config: Omit<RequestConfig, 'headers'>,\n opts?: RequestOptions\n ): Promise<T> {\n const token = await this.getToken(opts);\n return this.http.request<T>({\n ...config,\n headers: { Authorization: `Bearer ${token}` },\n ...opts,\n });\n }\n\n override async testConnection(opts?: RequestOptions): Promise<ConnectionResult> {\n try {\n // GET /account succeeds only with a valid token\n await this.authed({ path: 'account' }, opts);\n return { success: true, message: 'Connection successful' };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n override async listDomains(opts?: ListDomainsOptions): Promise<Domain[]> {\n // The list endpoint has no name filter, so `search` is applied client-side.\n // Nameservers are not returned here (see NbDomain).\n const { search, ...reqOpts } = opts ?? {};\n const domains: Domain[] = [];\n const perPage = 100; // domainsPerPage maximum\n let page = 1;\n let hasMore = true;\n\n while (hasMore) {\n const data = await this.authed<NbDomainsPage | NbDomain[]>(\n { path: 'account/domains', query: { page, domainsPerPage: perPage } },\n reqOpts\n );\n // the response may be a bare array or a paged object; be lenient\n const list = Array.isArray(data) ? data : (data?.Domains ?? data?.domains ?? []);\n\n for (const d of list) domains.push(this.toDomain(d));\n\n hasMore = list.length === perPage;\n page++;\n }\n return filterDomains(domains, search);\n }\n\n /**\n * Fetch a single domain via GET account/domains/{domain}. This endpoint carries\n * the same core fields as the list endpoint (plus Category/UpgradedDomain/\n * AuthCode, which we don't map) but not nameservers — use `getNameservers` for\n * those, so `nameservers` comes back empty here.\n */\n override async getDomain(domainName: string, opts?: RequestOptions): Promise<Domain> {\n const d = await this.authed<NbDomain>(\n { path: `account/domains/${encodeURIComponent(domainName)}` },\n opts\n );\n return this.toDomain(d);\n }\n\n /**\n * Transfer authorization (EPP) code. NameBright carries it as the `AuthCode`\n * field on the domain-detail response (GET account/domains/{domain}), returned\n * synchronously in the body — not email-only.\n */\n override async getAuthCode(domainName: string, opts?: RequestOptions): Promise<string> {\n const d = await this.authed<NbDomain>(\n { path: `account/domains/${encodeURIComponent(domainName)}` },\n opts\n );\n return d.AuthCode ?? '';\n }\n\n override async getNameservers(domainName: string, opts?: RequestOptions): Promise<string[]> {\n const res = await this.authed<NbNameservers | string[]>(\n { path: `account/domains/${encodeURIComponent(domainName)}/nameservers` },\n opts\n );\n if (Array.isArray(res)) return res.map(String);\n return (res.NameServers ?? res.Nameservers ?? res.nameservers ?? []).map(String);\n }\n\n /**\n * Read the registrant/admin/tech contacts via GET\n * account/domains/{domain}/contacts/all. NameBright has no billing contact, so\n * `billing` is always omitted.\n */\n override async getContacts(domainName: string, opts?: RequestOptions): Promise<ContactSet> {\n const res = await this.authed<NbContactsResponse>(\n { path: `account/domains/${encodeURIComponent(domainName)}/contacts/all` },\n opts\n );\n return {\n registrant: fromNbContact(res.RegistrantContact),\n admin: fromNbContact(res.AdministrativeContact),\n tech: fromNbContact(res.TechnicalContact),\n };\n }\n\n /**\n * Read DNS host records via GET account/domains/{domain}/hostrecords/all, which\n * groups records by type. NameBright doesn't return a per-record TTL, so `ttl`\n * is left unset.\n */\n override async getDnsRecords(domainName: string, opts?: RequestOptions): Promise<DnsRecord[]> {\n const res = await this.authed<NbHostRecords>(\n { path: `account/domains/${encodeURIComponent(domainName)}/hostrecords/all` },\n opts\n );\n return flattenHostRecords(res).map(e => e.record);\n }\n\n /**\n * NameBright exposes no per-TLD price table — only a per-domain availability\n * check that returns a registration price (no renewal/transfer prices), so\n * there's no `TldPricing` to return. Mirrors Spaceship's `getPricing`.\n */\n override getPricing(_tldOrDomain: string, _opts?: RequestOptions): Promise<TldPricing> {\n return Promise.reject(\n new NotImplementedError(\n `${this.name}: getPricing is not available — NameBright exposes no per-TLD pricing ` +\n 'endpoint (only a per-domain registration price via checkAvailability)'\n )\n );\n }\n\n /**\n * Availability via GET purchase/availability/{domain}. NameBright's endpoint is\n * per-domain, so multiple names are checked sequentially. It reports a `Status`\n * (\"AvailableForRegistration\") plus a `UnitPrice`, discounted by an optional\n * `Promotion`. NameBright bills in USD (the response carries no currency code).\n */\n override async checkAvailability(\n domainNames: string[],\n opts?: RequestOptions\n ): Promise<DomainAvailability[]> {\n const results: DomainAvailability[] = [];\n for (const domainName of domainNames) {\n const res = await this.authed<NbAvailability>(\n { path: `purchase/availability/${encodeURIComponent(domainName)}` },\n opts\n );\n const price = res.Promotion?.PromotionPrice ?? res.UnitPrice;\n const result: DomainAvailability = {\n domainName: res.DomainName ?? domainName,\n available: res.Status === 'AvailableForRegistration',\n };\n // NameBright returns UnitPrice 0 for unavailable names; only surface a\n // meaningful (positive) registration price.\n if (typeof price === 'number' && Number.isFinite(price) && price > 0) {\n result.price = price;\n result.currency = 'USD';\n }\n results.push(result);\n }\n return results;\n }\n\n // --- write operations ---------------------------------------------------\n\n override lockDomain(domainName: string, opts?: RequestOptions): Promise<OperationResult> {\n return this.setDomainFlag(domainName, { Locked: true }, 'Domain locked successfully', opts);\n }\n\n override unlockDomain(domainName: string, opts?: RequestOptions): Promise<OperationResult> {\n return this.setDomainFlag(domainName, { Locked: false }, 'Domain unlocked successfully', opts);\n }\n\n override setAutoRenew(\n domainName: string,\n enabled: boolean,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.setDomainFlag(\n domainName,\n { AutoRenew: enabled },\n `Auto-renew ${enabled ? 'enabled' : 'disabled'} successfully`,\n opts\n );\n }\n\n override setPrivacy(\n domainName: string,\n enabled: boolean,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.setDomainFlag(\n domainName,\n { WhoIsPrivacy: enabled },\n `WHOIS privacy ${enabled ? 'enabled' : 'disabled'} successfully`,\n opts\n );\n }\n\n /**\n * Registers a domain via the `purchase/register` order endpoint. NameBright's\n * request carries only the name + term; nameservers, privacy, auto-renew, and\n * contacts aren't part of registration (they use account defaults and the\n * per-flag/nameserver endpoints afterwards). Spends real money — built from the\n * documented shape, not exercised against the live account.\n */\n override registerDomain(\n domainName: string,\n input: RegisterDomainInput,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.purchase('register', domainName, input.years ?? 1, 'registered', opts);\n }\n\n override renewDomain(\n domainName: string,\n years = 1,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.purchase('renew', domainName, years, 'renewed', opts);\n }\n\n // POST an order to purchase/{register|renew}. Both take the same body and\n // return an order (OrderId + TotalPrice); a returned OrderId signals success.\n private async purchase(\n operation: 'register' | 'renew',\n domainName: string,\n years: number,\n verb: string,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n try {\n const order = await this.authed<NbOrder>(\n {\n method: 'POST',\n path: `purchase/${operation}`,\n body: { DomainName: domainName, Years: years, CategoryId: 0, CategoryName: null },\n },\n opts\n );\n if (order?.OrderId == null) {\n return { success: false, message: `NameBright: ${operation} returned no order id` };\n }\n return {\n success: true,\n message: `Domain ${domainName} ${verb} successfully (order ${order.OrderId})`,\n };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n /**\n * Update one of the boolean domain flags (Locked / AutoRenew / WhoIsPrivacy)\n * via the shared PUT account/domains/{domain}. That endpoint takes the full\n * AccountDomain body, so we first GET the current record and merge the change\n * over it — sending a bare `{ Locked: true }` would otherwise reset the other\n * flags to their defaults. We deliberately drop AuthCode from the round-trip.\n */\n private async setDomainFlag(\n domainName: string,\n change: Partial<Pick<NbDomain, 'Locked' | 'AutoRenew' | 'WhoIsPrivacy'>>,\n successMessage: string,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n try {\n const path = `account/domains/${encodeURIComponent(domainName)}`;\n const current = await this.authed<NbDomain & { Category?: string; UpgradedDomain?: boolean }>(\n { path },\n opts\n );\n const body = {\n DomainName: current.DomainName,\n Status: current.Status,\n ExpirationDate: current.ExpirationDate,\n Locked: current.Locked ?? false,\n AutoRenew: current.AutoRenew ?? false,\n WhoIsPrivacy: current.WhoIsPrivacy ?? false,\n Category: current.Category,\n UpgradedDomain: current.UpgradedDomain,\n ...change,\n };\n await this.authed({ method: 'PUT', path, body }, opts);\n return { success: true, message: successMessage };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n /**\n * Replace the domain's nameservers. NameBright has no bulk set: remove all\n * existing servers, then PUT each new one (the server is a path segment, with\n * no request body).\n *\n * NOTE: built from the documented endpoints but not live-verified — there is\n * no safe way to test nameserver replacement against a live production domain.\n */\n override async updateNameservers(\n domainName: string,\n nameservers: string[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n try {\n const base = `account/domains/${encodeURIComponent(domainName)}/nameservers`;\n await this.authed({ method: 'DELETE', path: base }, opts);\n for (const ns of nameservers) {\n await this.authed({ method: 'PUT', path: `${base}/${encodeURIComponent(ns)}` }, opts);\n }\n return { success: true, message: 'Nameservers updated successfully' };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n /**\n * Replace the domain's DNS host records with `records` (desired-state\n * semantics). NameBright manages records individually — per-type POST to\n * create, DELETE by RecordId to remove — with no bulk set, so we diff against\n * the current records: delete the ones no longer wanted and create the ones\n * that are new, leaving unchanged records in place. (A blind delete-all +\n * re-create trips NameBright's flaky \"Duplicate host record\" check when a\n * record is deleted and immediately re-posted, so the diff both avoids that\n * and skips needless churn.) NameBright supports no per-record TTL, so `ttl`\n * is ignored.\n */\n override async setDnsRecords(\n domainName: string,\n records: DnsRecord[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n try {\n const base = `account/domains/${encodeURIComponent(domainName)}/hostrecords`;\n const current = flattenHostRecords(\n await this.authed<NbHostRecords>({ path: `${base}/all` }, opts)\n );\n\n const desiredKeys = new Set(records.map(dnsRecordKey));\n const currentKeys = new Set(current.map(e => dnsRecordKey(e.record)));\n\n // delete records that are present now but not desired\n for (const e of current) {\n if (e.recordId != null && !desiredKeys.has(dnsRecordKey(e.record))) {\n await this.authed({ method: 'DELETE', path: `${base}/${e.segment}/${e.recordId}` }, opts);\n }\n }\n // create desired records that aren't already present\n for (const r of records) {\n if (!currentKeys.has(dnsRecordKey(r))) {\n const { segment, body } = toNbHostRecord(r);\n await this.authed({ method: 'POST', path: `${base}/${segment}`, body }, opts);\n }\n }\n return { success: true, message: 'DNS records updated successfully' };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n // map a NameBright domain object (from list or single-domain endpoints) to the\n // normalized Domain shape. Neither endpoint returns nameservers.\n private toDomain(d: NbDomain): Domain {\n return createDomain({\n domainName: d.DomainName ?? d.domain,\n registrar: this.name,\n status: d.Status ?? 'ok',\n createdDate: d.RegistrationDate,\n expirationDate: d.ExpirationDate,\n renewalDate: d.ExpirationDate,\n autoRenew: d.AutoRenew ?? false,\n locked: d.Locked ?? false,\n privacy: d.WhoIsPrivacy ?? false,\n nameservers: [],\n });\n }\n}\n\n// map a NameBright contact object to the normalized Contact (undefined if the\n// role isn't present). NameBright splits the phone into country code + number.\nfunction fromNbContact(c: NbContact | undefined): Contact | undefined {\n if (!c) return undefined;\n return {\n firstName: c.FirstName ?? '',\n lastName: c.LastName ?? '',\n organization: c.Organization ? String(c.Organization) : undefined,\n email: c.Email ?? '',\n phone: joinPhone(c.PhoneCountry, c.Phone),\n fax: c.Fax ? joinPhone(c.FaxCountry, c.Fax) : undefined,\n address1: c.Address1 ?? '',\n address2: c.Address2 ? String(c.Address2) : undefined,\n city: c.City ?? '',\n state: c.Region ?? '',\n postalCode: c.PostalCode ?? '',\n country: c.Country ?? '',\n };\n}\n\n// flatten NameBright's per-type host-record groups into generic DnsRecords,\n// preserving each record's endpoint segment and RecordId so callers can address\n// it for deletion. Order is stable (A, AAAA, CNAME, MX, TXT, SRV).\ninterface FlatHostRecord {\n record: DnsRecord;\n segment: string;\n recordId?: number;\n}\nfunction flattenHostRecords(res: NbHostRecords): FlatHostRecord[] {\n const out: FlatHostRecord[] = [];\n for (const r of res.ARecords ?? []) {\n out.push({\n record: { type: 'A', name: r.Subdomain ?? '@', value: r.IPV4Address ?? '' },\n segment: 'a',\n recordId: r.RecordId,\n });\n }\n for (const r of res.AAAARecords ?? []) {\n out.push({\n record: { type: 'AAAA', name: r.Subdomain ?? '@', value: r.IPV6Address ?? '' },\n segment: 'aaaa',\n recordId: r.RecordId,\n });\n }\n for (const r of res.CNAMERecords ?? []) {\n out.push({\n record: { type: 'CNAME', name: r.Subdomain ?? '@', value: r.RedirectDomain ?? '' },\n segment: 'cname',\n recordId: r.RecordId,\n });\n }\n for (const r of res.MXRecords ?? []) {\n const record: DnsRecord = { type: 'MX', name: r.Subdomain ?? '@', value: r.MailServer ?? '' };\n if (r.Priority != null) record.priority = r.Priority;\n out.push({ record, segment: 'mx', recordId: r.RecordId });\n }\n for (const r of res.TXTRecords ?? []) {\n out.push({\n record: { type: 'TXT', name: r.Subdomain ?? '@', value: r.TextRecord ?? '' },\n segment: 'txt',\n recordId: r.RecordId,\n });\n }\n for (const r of res.SRVRecords ?? []) {\n // NameBright splits SRV into service/protocol; recompose the standard\n // \"_service._protocol\" name that our generic record carries.\n const name = [r.Service, r.Protocol].filter(Boolean).join('.') || '@';\n const record: DnsRecord = { type: 'SRV', name, value: r.Target ?? '' };\n if (r.Priority != null) record.priority = r.Priority;\n if (r.Weight != null) record.weight = r.Weight;\n if (r.Port != null) record.port = r.Port;\n out.push({ record, segment: 'srv', recordId: r.RecordId });\n }\n return out;\n}\n\n// canonical identity of a DNS record for diffing (ignores TTL, which NameBright\n// doesn't store). Two records with the same key are considered equal.\nfunction dnsRecordKey(r: DnsRecord): string {\n return [\n r.type.toUpperCase(),\n r.name || '@',\n r.value,\n r.priority ?? '',\n r.weight ?? '',\n r.port ?? '',\n ].join('|');\n}\n\n// map a generic DnsRecord to NameBright's per-type POST endpoint segment and\n// request body. The record's `name` is the subdomain (\"@\" for the apex); TTL is\n// unsupported by NameBright and ignored. Throws on record types NameBright's\n// host-record API does not expose.\nfunction toNbHostRecord(r: DnsRecord): { segment: string; body: Record<string, unknown> } {\n const type = r.type.toUpperCase();\n const subdomain = r.name || '@';\n switch (type) {\n case 'A':\n return { segment: 'a', body: { Subdomain: subdomain, IPV4Address: r.value } };\n case 'AAAA':\n return { segment: 'aaaa', body: { Subdomain: subdomain, IPV6Address: r.value } };\n case 'CNAME':\n return { segment: 'cname', body: { Subdomain: subdomain, RedirectDomain: r.value } };\n case 'MX':\n return {\n segment: 'mx',\n body: { Subdomain: subdomain, MailServer: r.value, Priority: r.priority ?? 10 },\n };\n case 'TXT':\n return { segment: 'txt', body: { Subdomain: subdomain, TextRecord: r.value } };\n case 'SRV': {\n // our generic name carries \"_service._protocol\"; NameBright splits them.\n const [service, protocol] = r.name.split('.');\n return {\n segment: 'srv',\n body: {\n Service: service,\n Protocol: protocol,\n Priority: r.priority ?? 0,\n Weight: r.weight ?? 0,\n Port: r.port ?? 0,\n Target: r.value,\n },\n };\n }\n default:\n throw new Error(`NameBright: unsupported DNS record type \"${r.type}\"`);\n }\n}\n\n// combine a country-code part and a local number into \"+<cc>.<number>\" form,\n// leaving an already-complete number untouched when no country code is given.\n// NameBright returns PhoneCountry/FaxCountry as numbers (e.g. 1), so coerce to\n// string before trimming.\nfunction joinPhone(\n countryCode: string | number | undefined,\n number: string | number | undefined\n): string {\n const num = String(number ?? '').trim();\n const cc = String(countryCode ?? '')\n .trim()\n .replace(/^\\+/, '');\n if (!cc) return num;\n if (!num) return cc ? `+${cc}` : '';\n return `+${cc}.${num}`;\n}\n","import { XMLParser, type X2jOptions } from 'fast-xml-parser';\nimport { ParsingError } from './errors';\n\n// Shared XML parsing for registrar APIs that speak XML (e.g. Namecheap, Enom).\n// fast-xml-parser is pure JS with no Node built-ins, so this stays safe in\n// browsers, Cloudflare Workers, Deno, Bun, and Node.\n\n// default options applied to all registrar XML responses:\n// - attributes are kept (prefixed with `@_`)\n// - values are left as raw strings; providers coerce them explicitly, so a\n// ZIP like \"01234\" or a flag like \"true\" never changes type unexpectedly\nconst DEFAULT_XML_OPTIONS: Partial<X2jOptions> = {\n ignoreAttributes: false,\n attributeNamePrefix: '@_',\n textNodeName: '#text',\n parseAttributeValue: false,\n parseTagValue: false,\n trimValues: true,\n};\n\n// parse an XML string into a plain object, throwing ParsingError on failure\nexport function parseXml<T = unknown>(xml: string, options?: Partial<X2jOptions>): T {\n try {\n const parser = new XMLParser({ ...DEFAULT_XML_OPTIONS, ...options });\n return parser.parse(xml) as T;\n } catch (error) {\n throw new ParsingError(\n `Failed to parse XML: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n}\n\n// coerce a value that may be a single item or an array into an array.\n// XML parsers collapse a single repeated element into one object; this\n// normalizes both cases to an array.\nexport function ensureArray<T>(value: T | T[] | undefined | null): T[] {\n if (value == null) return [];\n return Array.isArray(value) ? value : [value];\n}\n","import type {\n ConfigField,\n ConnectionResult,\n Contact,\n ContactSet,\n DnsRecord,\n Domain,\n DomainAvailability,\n DomainForward,\n DomainForwardType,\n EmailForward,\n ListDomainsOptions,\n OperationResult,\n RegisterDomainInput,\n RegistrarOptions,\n RequestOptions,\n TldPricing,\n TransferDomainInput,\n} from '../types';\nimport {\n createDomain,\n filterDomains,\n normalizeDomain,\n requireConsent,\n settableForwards,\n} from '../utils';\nimport { toRegistrarError } from '../errors';\nimport { ensureArray, parseXml } from '../xml';\nimport { BaseRegistrar, selectBaseUrl } from '../registrar';\nimport { Feature, type RegistrarFeature } from '../features';\nimport type { RegistrarCredentials } from '../types';\n\n// shape of a Namecheap XML response (attributes prefixed with `@_`, text `#text`)\ninterface NcError {\n '#text'?: string;\n '@_Number'?: string;\n}\n\ninterface NcDomainEl {\n '@_Name'?: string;\n '@_Created'?: string;\n '@_Expires'?: string;\n '@_AutoRenew'?: string;\n '@_IsLocked'?: string;\n '@_WhoisGuard'?: string;\n}\n\n// namecheap.domains.getInfo result\ninterface NcGetInfoResult {\n '@_Status'?: string;\n '@_DomainName'?: string;\n 'DomainDetails'?: { CreatedDate?: string; ExpiredDate?: string };\n 'Whoisguard'?: { '@_Enabled'?: string; 'ID'?: string | number };\n}\n\n// namecheap.domains.check result element (attributes only)\ninterface NcCheckEl {\n '@_Domain'?: string;\n '@_Available'?: string;\n '@_IsPremiumName'?: string;\n '@_PremiumRegistrationPrice'?: string;\n}\n\n// a contact group in namecheap.domains.getContacts (children are text elements)\ninterface NcContactEl {\n OrganizationName?: string;\n FirstName?: string;\n LastName?: string;\n Address1?: string;\n Address2?: string;\n City?: string;\n StateProvince?: string;\n PostalCode?: string;\n Country?: string;\n Phone?: string;\n Fax?: string;\n EmailAddress?: string;\n}\n\n// a <Forward mailbox=\"alias\">destination</Forward> in\n// namecheap.domains.dns.getEmailForwarding\ninterface NcForwardEl {\n '@_mailbox'?: string;\n '#text'?: string;\n}\n\n// a host record in namecheap.domains.dns.getHosts (attributes only)\ninterface NcHostEl {\n '@_Name'?: string;\n '@_Type'?: string;\n '@_Address'?: string;\n '@_MXPref'?: string;\n '@_TTL'?: string;\n}\n\n// namecheap.users.getPricing is ProductType > ProductCategory > Product > Price\ninterface NcPriceEl {\n '@_Duration'?: string;\n '@_DurationType'?: string;\n '@_Price'?: string;\n '@_Currency'?: string;\n}\ninterface NcProductEl {\n '@_Name'?: string;\n 'Price'?: NcPriceEl | NcPriceEl[];\n}\ninterface NcProductCategoryEl {\n '@_Name'?: string;\n 'Product'?: NcProductEl | NcProductEl[];\n}\ninterface NcProductTypeEl {\n '@_Name'?: string;\n 'ProductCategory'?: NcProductCategoryEl | NcProductCategoryEl[];\n}\n\ninterface NcCommandResponse {\n DomainGetListResult?: { Domain?: NcDomainEl | NcDomainEl[] };\n DomainCheckResult?: NcCheckEl | NcCheckEl[];\n DomainGetInfoResult?: NcGetInfoResult;\n DomainDNSGetListResult?: {\n '@_Domain'?: string;\n '@_IsUsingOurDNS'?: string;\n 'Nameserver'?: string | string[];\n };\n // the docs show <Host>, but the live API has historically returned <host>\n DomainDNSGetHostsResult?: { Host?: NcHostEl | NcHostEl[]; host?: NcHostEl | NcHostEl[] };\n DomainDNSGetEmailForwardingResult?: {\n '@_Domain'?: string;\n 'Forward'?: NcForwardEl | NcForwardEl[];\n };\n DomainContactsResult?: {\n Registrant?: NcContactEl;\n Admin?: NcContactEl;\n Tech?: NcContactEl;\n AuxBilling?: NcContactEl;\n };\n UserGetPricingResult?: { ProductType?: NcProductTypeEl | NcProductTypeEl[] };\n // namecheap.domains.getRegistrarLock — the authoritative per-domain lock state\n DomainGetRegistrarLockResult?: { '@_RegistrarLockStatus'?: string };\n // namecheap.domains.setAutoRenew result (carries its own IsSuccess flag)\n SetAutoRenewResult?: { '@_IsSuccess'?: string };\n}\n\ninterface NcResponse {\n ApiResponse?: {\n '@_Status'?: string;\n 'Errors'?: { Error?: NcError | NcError[] | string };\n 'CommandResponse'?: NcCommandResponse;\n };\n}\n\n// Namecheap caps domains.check at 50 domains per request\nconst CHECK_BATCH_SIZE = 50;\n// the four contact roles Namecheap requires on every setContacts call, mapped\n// to our ContactSet keys (Namecheap calls the billing role \"AuxBilling\")\nconst NC_CONTACT_ROLES = [\n { prefix: 'Registrant', key: 'registrant' },\n { prefix: 'Admin', key: 'admin' },\n { prefix: 'Tech', key: 'tech' },\n { prefix: 'AuxBilling', key: 'billing' },\n] as const;\n\n/**\n * Namecheap Registrar\n * API docs: https://www.namecheap.com/support/api/intro/\n *\n * Credentials: enable API access under Profile > Tools > API Access, generate\n * an API key, and whitelist the IP(s) requests will originate from (Namecheap\n * enforces IP whitelisting). Supply that whitelisted IP as `clientIp`.\n *\n * Namecheap authenticates via query-string parameters (ApiUser, ApiKey,\n * UserName, ClientIp) and responds with XML — including for errors, which come\n * back as `<Errors>` nodes inside a 200 OK envelope, so success is read from the\n * root `Status=\"OK\"` attribute (`isOk`), not the HTTP status. XML is parsed via\n * the shared `parseXml` helper (fast-xml-parser).\n *\n * `setAutoRenew` uses `namecheap.domains.setAutoRenew` (DomainName + IsAutoRenew).\n * The command isn't in Namecheap's published method index but is live and keys on\n * DomainName (an SLD/TLD form is rejected); it returns its own `IsSuccess` flag,\n * which this reads rather than the envelope status.\n *\n * `registerDomain`/`transferIn` are implemented and require per-call `consent`;\n * they spend real money and are documented-but-unverified. Registration sends the\n * full four-role contact set but not yet per-TLD extended attributes (.us, .eu,\n * …), so those TLDs aren't supported for registration.\n */\nexport class NamecheapRegistrar extends BaseRegistrar {\n readonly name = 'namecheap';\n\n static readonly displayName = 'Namecheap';\n static readonly website = 'namecheap.com';\n static readonly helpText =\n 'Enable API access in your Namecheap account under Profile > Tools > API Access, ' +\n 'generate an API key, and whitelist your request IP(s) in the API settings. ' +\n 'Provide the whitelisted IP as the Client IP field.';\n static readonly configFields: ConfigField[] = [\n { name: 'username', label: 'Username', type: 'text', required: true },\n { name: 'apiKey', label: 'API Key', type: 'password', required: true },\n { name: 'clientIp', label: 'Client IP', type: 'text', required: false, default: '0.0.0.0' },\n ];\n // Namecheap runs a sandbox at api.sandbox.namecheap.com (separate account at\n // sandbox.namecheap.com with its own API key)\n static readonly supportsSandbox = true;\n // XML API. Beyond core, read+write alias-style email forwarding (via the\n // dedicated dns.getEmailForwarding/setEmailForwarding commands) and URL/domain\n // forwarding (URL/URL301/FRAME host records, read+written through the host set).\n // No DNSSEC or webhooks; auth-code retrieval and glue records are dashboard-\n // gated / unconfirmed, so they're left undeclared until verified live.\n static readonly extendedFeatures: readonly RegistrarFeature[] = [\n Feature.GetEmailForwarding,\n Feature.SetEmailForwarding,\n Feature.GetDomainForwarding,\n Feature.SetDomainForwarding,\n ];\n\n constructor(credentials: RegistrarCredentials, options?: RegistrarOptions) {\n super(\n credentials,\n {\n baseUrl: selectBaseUrl('Namecheap', options?.environment, {\n production: 'https://api.namecheap.com/xml.response',\n sandbox: 'https://api.sandbox.namecheap.com/xml.response',\n }),\n },\n options\n );\n }\n\n // common query parameters (credentials + command) for every Namecheap call\n private baseQuery(command: string, extra: Record<string, string> = {}): Record<string, string> {\n return {\n ApiUser: this.credentials.username,\n ApiKey: this.credentials.apiKey,\n UserName: this.credentials.username,\n // Namecheap validates against whitelisted IPs configured in the account\n ClientIp: this.credentials.clientIp || '0.0.0.0',\n Command: command,\n ...extra,\n };\n }\n\n // issue a command and parse the XML response\n private async call(\n command: string,\n extra: Record<string, string>,\n opts?: RequestOptions\n ): Promise<NcResponse> {\n const xml = await this.http.requestText({\n path: '',\n query: this.baseQuery(command, extra),\n ...opts,\n });\n return parseXml<NcResponse>(xml);\n }\n\n // issue a command and return its CommandResponse, throwing on an error status\n private async command(\n command: string,\n extra: Record<string, string>,\n opts?: RequestOptions\n ): Promise<NcCommandResponse> {\n const res = await this.call(command, extra, opts);\n if (!isOk(res)) throw new Error(errorText(res) ?? 'Namecheap API request failed');\n return res.ApiResponse?.CommandResponse ?? {};\n }\n\n override async testConnection(opts?: RequestOptions): Promise<ConnectionResult> {\n try {\n const res = await this.call('namecheap.domains.getList', {}, opts);\n return isOk(res)\n ? { success: true, message: 'Connection successful' }\n : { success: false, message: errorText(res) ?? 'Unknown error' };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n override async listDomains(opts?: ListDomainsOptions): Promise<Domain[]> {\n const { search, ...reqOpts } = opts ?? {};\n const domains: Domain[] = [];\n const perPage = 100; // Namecheap PageSize maximum (10..100)\n // `SearchTerm` filters by name substring server-side.\n const searchTerm = search?.trim();\n let page = 1;\n let hasMore = true;\n\n while (hasMore) {\n const cr = await this.command(\n 'namecheap.domains.getList',\n {\n PageSize: String(perPage),\n Page: String(page),\n ...(searchTerm ? { SearchTerm: searchTerm } : {}),\n },\n reqOpts\n );\n\n const elements = ensureArray(cr.DomainGetListResult?.Domain);\n for (const d of elements) {\n domains.push(\n createDomain({\n domainName: d['@_Name'],\n registrar: this.name,\n status: 'ok', // the list endpoint does not return a per-domain status\n createdDate: d['@_Created'],\n expirationDate: d['@_Expires'],\n renewalDate: d['@_Expires'],\n autoRenew: d['@_AutoRenew'] === 'true',\n locked: d['@_IsLocked'] === 'true',\n privacy: d['@_WhoisGuard'] === 'ENABLED',\n nameservers: [], // the list endpoint does not return nameservers\n })\n );\n }\n\n hasMore = elements.length === perPage;\n page++;\n }\n return filterDomains(domains, search);\n }\n\n /**\n * getInfo carries status, dates, and WhoisGuard state but not nameservers, so\n * `nameservers` comes back empty here — use `getNameservers` (dns.getList) for\n * those. The registrar transfer-lock flag isn't in getInfo either (its `Status`\n * reflects the domain lifecycle, e.g. \"Ok\"/\"Expired\", not the transfer lock),\n * so `locked` is read from the dedicated `getRegistrarLock` command, which is\n * the authoritative real-time source (getList's per-row `IsLocked` can lag —\n * confirmed stale in the sandbox after a lock the API had already applied).\n */\n override async getDomain(domainName: string, opts?: RequestOptions): Promise<Domain> {\n const cr = await this.command('namecheap.domains.getInfo', { DomainName: domainName }, opts);\n const info = cr.DomainGetInfoResult ?? {};\n const status = info['@_Status'] ?? '';\n return createDomain({\n domainName: info['@_DomainName'] ?? domainName,\n registrar: this.name,\n status,\n createdDate: info.DomainDetails?.CreatedDate,\n expirationDate: info.DomainDetails?.ExpiredDate,\n renewalDate: info.DomainDetails?.ExpiredDate,\n locked: await this.getRegistrarLock(domainName, opts),\n privacy: (info.Whoisguard?.['@_Enabled'] ?? '').toLowerCase() === 'true',\n nameservers: [],\n });\n }\n\n /**\n * Reads the registrar transfer-lock flag for a single domain via the dedicated\n * `getRegistrarLock` command (`RegistrarLockStatus`). getInfo doesn't expose the\n * lock, and getList's per-row `IsLocked` can lag the real state — verified live:\n * after a lock the API reported as applied, getList still showed `IsLocked=false`\n * while getRegistrarLock correctly returned `RegistrarLockStatus=true`.\n */\n private async getRegistrarLock(domainName: string, opts?: RequestOptions): Promise<boolean> {\n const cr = await this.command(\n 'namecheap.domains.getRegistrarLock',\n { DomainName: normalizeDomain(domainName) },\n opts\n );\n return cr.DomainGetRegistrarLockResult?.['@_RegistrarLockStatus'] === 'true';\n }\n\n /**\n * Availability via domains.check (batched at 50 per request, Namecheap's cap).\n * The check response only carries a price for *premium* names\n * (`PremiumRegistrationPrice`); regular registration pricing comes from\n * `getPricing`, so `price` is set only for premium results.\n */\n override async checkAvailability(\n domainNames: string[],\n opts?: RequestOptions\n ): Promise<DomainAvailability[]> {\n const results: DomainAvailability[] = [];\n for (let i = 0; i < domainNames.length; i += CHECK_BATCH_SIZE) {\n const batch = domainNames.slice(i, i + CHECK_BATCH_SIZE);\n const cr = await this.command(\n 'namecheap.domains.check',\n { DomainList: batch.join(',') },\n opts\n );\n for (const el of ensureArray(cr.DomainCheckResult)) {\n const premium = el['@_IsPremiumName'] === 'true';\n const premiumPrice = premium ? Number(el['@_PremiumRegistrationPrice']) : NaN;\n results.push({\n domainName: el['@_Domain'] ?? '',\n available: el['@_Available'] === 'true',\n premium,\n price: Number.isFinite(premiumPrice) && premiumPrice > 0 ? premiumPrice : undefined,\n });\n }\n }\n return results;\n }\n\n /**\n * Per-TLD pricing via users.getPricing — unlike GoDaddy/Dynadot, Namecheap has\n * a real price table, so a bare TLD works (a full domain is reduced to its\n * TLD). Reads the 1-year register/renew/transfer prices.\n */\n override async getPricing(tldOrDomain: string, opts?: RequestOptions): Promise<TldPricing> {\n const tld = (\n tldOrDomain.includes('.') ? tldOrDomain.slice(tldOrDomain.indexOf('.') + 1) : tldOrDomain\n ).toLowerCase();\n\n const cr = await this.command(\n 'namecheap.users.getPricing',\n { ProductType: 'DOMAIN', ProductName: tld },\n opts\n );\n const categories = ensureArray(\n ensureArray(cr.UserGetPricingResult?.ProductType)[0]?.ProductCategory\n );\n\n // find the 1-year Price for a given action category (REGISTER/RENEW/TRANSFER)\n const findPrice = (action: string): NcPriceEl | undefined => {\n const category = categories.find(c => c['@_Name']?.toUpperCase() === action);\n const product = ensureArray(category?.Product).find(p => p['@_Name']?.toLowerCase() === tld);\n const prices = ensureArray(product?.Price);\n return prices.find(p => p['@_Duration'] === '1') ?? prices[0];\n };\n\n const register = findPrice('REGISTER');\n const renew = findPrice('RENEW');\n const transfer = findPrice('TRANSFER');\n return {\n tld,\n currency: register?.['@_Currency'] ?? renew?.['@_Currency'] ?? 'USD',\n registration: toPrice(register),\n renewal: toPrice(renew),\n transfer: toPrice(transfer),\n };\n }\n\n /**\n * Registers a domain via domains.create, which requires all four contact roles\n * (omitted roles fall back to the registrant) and toggles free WhoisGuard when\n * privacy is requested. Note: TLDs that need per-TLD extended attributes (.us,\n * .eu, .ca, …) are not yet supported — those params aren't sent.\n */\n override async registerDomain(\n domainName: string,\n input: RegisterDomainInput,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n requireConsent(this.name, input.consent);\n const registrant = input.contacts.registrant;\n if (!registrant) {\n throw new Error(`${this.name}: registration requires at least a registrant contact`);\n }\n const params: Record<string, string> = {\n DomainName: domainName,\n Years: String(input.years ?? 1),\n };\n for (const { prefix, key } of NC_CONTACT_ROLES) {\n Object.assign(params, toNcContactParams(prefix, input.contacts[key] ?? registrant));\n }\n if (input.nameservers?.length) params.Nameservers = input.nameservers.join(',');\n if (input.privacy) {\n params.AddFreeWhoisguard = 'yes';\n params.WGEnabled = 'yes';\n }\n const res = await this.call('namecheap.domains.create', params, opts);\n return statusResult(res);\n }\n\n /**\n * Transfers a domain in via domains.transfer.create. Namecheap takes no\n * contacts on transfer (the existing registrant's carry over); it needs the\n * auth code as `EPPCode` and a `Years` of 1. Note: the privacy-enable param is\n * `WGenable` here (lowercase), unlike `WGEnabled` on create.\n */\n override async transferIn(\n domainName: string,\n input: TransferDomainInput,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n requireConsent(this.name, input.consent);\n const params: Record<string, string> = {\n DomainName: domainName,\n Years: String(input.years ?? 1),\n EPPCode: input.authCode,\n };\n if (input.privacy != null) {\n params.AddFreeWhoisguard = input.privacy ? 'yes' : 'no';\n params.WGenable = input.privacy ? 'yes' : 'no';\n }\n const res = await this.call('namecheap.domains.transfer.create', params, opts);\n return statusResult(res);\n }\n\n override async renewDomain(\n domainName: string,\n years = 1,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const res = await this.call(\n 'namecheap.domains.renew',\n { DomainName: domainName, Years: String(years) },\n opts\n );\n return statusResult(res);\n }\n\n /**\n * Toggles auto-renew via `namecheap.domains.setAutoRenew`. The command carries\n * its own `IsSuccess` flag inside an otherwise-OK envelope (a malformed request\n * comes back `Status=\"OK\"` with `IsSuccess=\"false\"`), so success is read from\n * that flag, not the envelope status.\n */\n override async setAutoRenew(\n domainName: string,\n enabled: boolean,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const cr = await this.command(\n 'namecheap.domains.setAutoRenew',\n { DomainName: domainName, IsAutoRenew: enabled ? 'true' : 'false' },\n opts\n );\n if (cr.SetAutoRenewResult?.['@_IsSuccess'] === 'true') {\n return { success: true, message: 'OK' };\n }\n return { success: false, message: `Failed to ${enabled ? 'enable' : 'disable'} auto-renew` };\n }\n\n override async getNameservers(domainName: string, opts?: RequestOptions): Promise<string[]> {\n const { sld, tld } = splitDomain(domainName);\n const cr = await this.command('namecheap.domains.dns.getList', { SLD: sld, TLD: tld }, opts);\n return ensureArray(cr.DomainDNSGetListResult?.Nameserver).map(String);\n }\n\n override async updateNameservers(\n domainName: string,\n nameservers: string[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n if (nameservers.length < 2 || nameservers.length > 12) {\n throw new Error('Namecheap requires 2-12 nameservers');\n }\n const { sld, tld } = splitDomain(domainName);\n const res = await this.call(\n 'namecheap.domains.dns.setCustom',\n { SLD: sld, TLD: tld, Nameservers: nameservers.join(',') },\n opts\n );\n return statusResult(res);\n }\n\n override async lockDomain(domainName: string, opts?: RequestOptions): Promise<OperationResult> {\n const res = await this.call(\n 'namecheap.domains.setRegistrarLock',\n { DomainName: domainName, LockAction: 'LOCK' },\n opts\n );\n return statusResult(res);\n }\n\n override async unlockDomain(domainName: string, opts?: RequestOptions): Promise<OperationResult> {\n const res = await this.call(\n 'namecheap.domains.setRegistrarLock',\n { DomainName: domainName, LockAction: 'UNLOCK' },\n opts\n );\n return statusResult(res);\n }\n\n /**\n * Toggles WhoisGuard (Namecheap's domain privacy), which is a separate entity\n * keyed by a numeric `WhoisguardID` (read from getInfo). Enabling additionally\n * needs a `ForwardedToEmail` — the address WhoisGuard-masked mail is relayed to\n * — which is taken from the domain's registrant contact. Throws if the domain\n * has no WhoisGuard allotted (e.g. TLDs that don't offer it).\n */\n override async setPrivacy(\n domainName: string,\n enabled: boolean,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const cr = await this.command('namecheap.domains.getInfo', { DomainName: domainName }, opts);\n const id = cr.DomainGetInfoResult?.Whoisguard?.ID;\n if (id == null || String(id) === '0') {\n throw new Error(`${this.name}: ${domainName} has no WhoisGuard subscription to toggle`);\n }\n if (!enabled) {\n const res = await this.call(\n 'namecheap.whoisguard.disable',\n { WhoisguardID: String(id) },\n opts\n );\n return statusResult(res);\n }\n // enabling requires a forwarding address — use the registrant's email\n const contacts = await this.getContacts(domainName, opts);\n const email = contacts.registrant?.email || contacts.admin?.email;\n if (!email) {\n throw new Error(\n `${this.name}: cannot enable WhoisGuard without a registrant email to forward to`\n );\n }\n const res = await this.call(\n 'namecheap.whoisguard.enable',\n { WhoisguardID: String(id), ForwardedToEmail: email },\n opts\n );\n return statusResult(res);\n }\n\n override async getContacts(domainName: string, opts?: RequestOptions): Promise<ContactSet> {\n const cr = await this.command(\n 'namecheap.domains.getContacts',\n { DomainName: domainName },\n opts\n );\n const result = cr.DomainContactsResult ?? {};\n return {\n registrant: fromNcContact(result.Registrant),\n admin: fromNcContact(result.Admin),\n tech: fromNcContact(result.Tech),\n billing: fromNcContact(result.AuxBilling),\n };\n }\n\n /**\n * Namecheap's setContacts requires all four roles (Registrant/Admin/Tech/\n * AuxBilling) on every call, so any role the caller omits falls back to the\n * registrant. A registrant is therefore mandatory.\n */\n override async updateContacts(\n domainName: string,\n contacts: ContactSet,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const registrant = contacts.registrant;\n if (!registrant) {\n throw new Error('Namecheap updateContacts requires at least a registrant contact');\n }\n const params: Record<string, string> = { DomainName: domainName };\n for (const { prefix, key } of NC_CONTACT_ROLES) {\n Object.assign(params, toNcContactParams(prefix, contacts[key] ?? registrant));\n }\n const res = await this.call('namecheap.domains.setContacts', params, opts);\n return statusResult(res);\n }\n\n override async getDnsRecords(domainName: string, opts?: RequestOptions): Promise<DnsRecord[]> {\n const { sld, tld } = splitDomain(domainName);\n const cr = await this.command('namecheap.domains.dns.getHosts', { SLD: sld, TLD: tld }, opts);\n const result = cr.DomainDNSGetHostsResult ?? {};\n // the docs show <Host> but the live API has historically returned <host>\n const hosts = ensureArray(result.Host ?? result.host);\n return hosts.map(h => {\n const type = (h['@_Type'] ?? '').toUpperCase();\n const record: DnsRecord = {\n type,\n name: h['@_Name'] ?? '',\n value: h['@_Address'] ?? '',\n };\n if (h['@_TTL'] != null) record.ttl = Number(h['@_TTL']);\n if (type === 'MX' && h['@_MXPref'] != null) record.priority = Number(h['@_MXPref']);\n return record;\n });\n }\n\n /**\n * Replaces the entire record set via dns.setHosts (full-replace: any record\n * not sent is removed). Host params are 1-indexed. `EmailType` is set to `MX`\n * when MX records are present so mail routing follows the records; otherwise\n * it's omitted to leave Namecheap's default.\n */\n override async setDnsRecords(\n domainName: string,\n records: DnsRecord[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const { sld, tld } = splitDomain(domainName);\n const params: Record<string, string> = { SLD: sld, TLD: tld };\n let hasMx = false;\n\n records.forEach((r, idx) => {\n const n = idx + 1; // Namecheap host params are 1-based\n const type = r.type.toUpperCase();\n params[`HostName${n}`] = r.name || '@';\n params[`RecordType${n}`] = type;\n params[`Address${n}`] = r.value;\n if (type === 'MX') {\n hasMx = true;\n params[`MXPref${n}`] = String(r.priority ?? 10);\n }\n if (r.ttl != null) params[`TTL${n}`] = String(r.ttl);\n });\n if (hasMx) params.EmailType = 'MX';\n\n const res = await this.call('namecheap.domains.dns.setHosts', params, opts);\n return statusResult(res);\n }\n\n // --- extended: email forwarding ---\n\n override async getEmailForwarding(\n domainName: string,\n opts?: RequestOptions\n ): Promise<EmailForward[]> {\n const cr = await this.command(\n 'namecheap.domains.dns.getEmailForwarding',\n { DomainName: domainName },\n opts\n );\n return ensureArray(cr.DomainDNSGetEmailForwardingResult?.Forward)\n .map(f => ({\n alias: (f['@_mailbox'] ?? '').toString(),\n forwardTo: (f['#text'] ?? '').toString().trim(),\n }))\n .filter(f => f.alias && f.forwardTo);\n }\n\n /**\n * Full-replace via dns.setEmailForwarding: mailbox/forward params are 1-indexed\n * and any alias not sent is removed, so an empty `forwards` clears all\n * forwarding. Requires the domain to use Namecheap's DNS.\n */\n override async setEmailForwarding(\n domainName: string,\n forwards: EmailForward[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const params: Record<string, string> = { DomainName: domainName };\n forwards.forEach((f, idx) => {\n const n = idx + 1; // Namecheap forwarding params are 1-based\n params[`MailBox${n}`] = f.alias;\n params[`ForwardTo${n}`] = f.forwardTo;\n });\n const res = await this.call('namecheap.domains.dns.setEmailForwarding', params, opts);\n return statusResult(res);\n }\n\n // --- extended: domain (URL) forwarding ---\n\n /**\n * Namecheap has no dedicated domain-forwarding endpoint; URL forwarding lives in\n * the host-record set as URL/URL301/FRAME records, so this reads the hosts and\n * returns just the forwarding ones.\n */\n override async getDomainForwarding(\n domainName: string,\n opts?: RequestOptions\n ): Promise<DomainForward[]> {\n const records = await this.getDnsRecords(domainName, opts);\n return records\n .filter(r => isUrlRecordType(r.type))\n .map(r => ({\n host: r.name || '@',\n url: r.value,\n type: NC_URL_TYPE_TO_FORWARD[r.type.toUpperCase()],\n }));\n }\n\n /**\n * Because URL forwarding is stored in the host set and dns.setHosts is a full\n * replace, this preserves every non-forwarding record and swaps in the new\n * URL-family records — so an empty `forwards` clears URL forwarding while\n * leaving the rest of the zone intact.\n */\n override async setDomainForwarding(\n domainName: string,\n forwards: DomainForward[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const settable = settableForwards(forwards); // reject masked before any write\n const existing = await this.getDnsRecords(domainName, opts);\n const kept = existing.filter(r => !isUrlRecordType(r.type));\n const urlRecords: DnsRecord[] = settable.map(f => ({\n type: NC_FORWARD_TO_URL_TYPE[f.type],\n name: f.host || '@',\n value: f.url,\n }));\n return this.setDnsRecords(domainName, [...kept, ...urlRecords], opts);\n }\n}\n\n// Namecheap URL host-record types <-> the normalized DomainForward.type\nconst NC_URL_TYPE_TO_FORWARD: Record<string, DomainForwardType> = {\n URL: 'temporary',\n URL301: 'permanent',\n FRAME: 'masked', // read-only; setDomainForwarding rejects it\n};\nconst NC_FORWARD_TO_URL_TYPE: Record<'temporary' | 'permanent', string> = {\n temporary: 'URL',\n permanent: 'URL301',\n};\n\n// whether a host-record type is one of Namecheap's URL-forwarding pseudo-records\nfunction isUrlRecordType(type: string): boolean {\n return type.toUpperCase() in NC_URL_TYPE_TO_FORWARD;\n}\n\n// whether the response's root Status attribute is \"OK\"\nfunction isOk(res: NcResponse): boolean {\n return res.ApiResponse?.['@_Status'] === 'OK';\n}\n\n// extract the first error message from an error response, if present\nfunction errorText(res: NcResponse): string | null {\n const error = res.ApiResponse?.Errors?.Error;\n if (!error) return null;\n const first = ensureArray(error)[0];\n if (typeof first === 'string') return first.trim() || null;\n return first?.['#text']?.trim() ?? null;\n}\n\n// map a Namecheap response's root Status to an OperationResult\nfunction statusResult(res: NcResponse): OperationResult {\n if (isOk(res)) return { success: true, message: 'OK' };\n return { success: false, message: errorText(res) ?? 'Unknown response' };\n}\n\n// split a domain into second-level label + TLD (the TLD may contain a dot, e.g.\n// \"co.uk\"). Namecheap's DNS/nameserver commands take SLD and TLD separately.\nfunction splitDomain(domain: string): { sld: string; tld: string } {\n const dot = domain.indexOf('.');\n return dot === -1\n ? { sld: domain, tld: '' }\n : { sld: domain.slice(0, dot), tld: domain.slice(dot + 1) };\n}\n\n// parse a Namecheap price element's Price attribute into a number, or undefined\nfunction toPrice(price: NcPriceEl | undefined): number | undefined {\n if (!price?.['@_Price']) return undefined;\n const n = Number(price['@_Price']);\n return Number.isFinite(n) ? n : undefined;\n}\n\n// --- contact mapping between Namecheap's shape and the normalized Contact ---\n\nfunction fromNcContact(c: NcContactEl | undefined): Contact | undefined {\n if (!c) return undefined;\n const text = (v: string | undefined): string => (v ?? '').toString();\n return {\n firstName: text(c.FirstName),\n lastName: text(c.LastName),\n organization: c.OrganizationName ? String(c.OrganizationName) : undefined,\n email: text(c.EmailAddress),\n phone: text(c.Phone),\n fax: c.Fax ? String(c.Fax) : undefined,\n address1: text(c.Address1),\n address2: c.Address2 ? String(c.Address2) : undefined,\n city: text(c.City),\n state: text(c.StateProvince),\n postalCode: text(c.PostalCode),\n country: text(c.Country),\n };\n}\n\n// build the prefixed request params (e.g. RegistrantFirstName) for one role\nfunction toNcContactParams(prefix: string, c: Contact): Record<string, string> {\n const params: Record<string, string> = {\n [`${prefix}FirstName`]: c.firstName,\n [`${prefix}LastName`]: c.lastName,\n [`${prefix}Address1`]: c.address1,\n [`${prefix}City`]: c.city,\n [`${prefix}StateProvince`]: c.state ?? '',\n [`${prefix}PostalCode`]: c.postalCode,\n [`${prefix}Country`]: c.country,\n [`${prefix}Phone`]: c.phone,\n [`${prefix}EmailAddress`]: c.email,\n };\n if (c.organization) params[`${prefix}OrganizationName`] = c.organization;\n if (c.address2) params[`${prefix}Address2`] = c.address2;\n if (c.fax) params[`${prefix}Fax`] = c.fax;\n return params;\n}\n","import type {\n ConfigField,\n ConnectionResult,\n Contact,\n ContactSet,\n DnsRecord,\n DnssecStatus,\n Domain,\n DomainAvailability,\n DomainForward,\n DomainForwardType,\n EmailForward,\n ListDomainsOptions,\n OperationResult,\n RegisterDomainInput,\n RegistrarOptions,\n RequestOptions,\n TldPricing,\n TransferDomainInput,\n} from '../types';\nimport { createDomain, filterDomains, settableForwards } from '../utils';\nimport { NotFoundError, toRegistrarError } from '../errors';\nimport { ensureArray, parseXml } from '../xml';\nimport { BaseRegistrar, selectBaseUrl } from '../registrar';\nimport { Feature, type RegistrarFeature } from '../features';\nimport type { RegistrarCredentials } from '../types';\n\n// NameSilo returns a `{ request, reply }` envelope for every operation. All\n// calls return HTTP 200; success/failure is signalled by `reply.code` (300 = ok).\ninterface NsReply {\n code?: number | string;\n detail?: string;\n domains?: unknown;\n pager?: { page?: number; page_size?: number; total_count?: number };\n // getDomainInfo fields (present only on that call's reply)\n created?: string;\n expires?: string;\n status?: string;\n locked?: string;\n private?: string;\n auto_renew?: string;\n nameservers?: unknown;\n // getDomainInfo also returns the per-role internal contact IDs\n contact_ids?: NsContactIds;\n // contactList returns full contact records (single object or array)\n contact?: NsContact | NsContact[];\n // contactAdd returns the new contact's id\n contact_id?: string | number;\n // dnsListRecords returns resource_record entries (single object or array)\n resource_record?: NsResourceRecord | NsResourceRecord[];\n // dnsSecListRecords returns ds_record entries (single object or array)\n ds_record?: NsDsRecord | NsDsRecord[];\n // listEmailForwards returns addresses entries (single object or array)\n addresses?: NsEmailAddresses | NsEmailAddresses[];\n // getDomainInfo also carries the apex URL-forwarding config\n forward_url?: string;\n forward_type?: string;\n traffic_type?: string;\n // checkRegisterAvailability groups results; each group wraps `domain` entries\n available?: unknown;\n unavailable?: unknown;\n invalid?: unknown;\n // getPrices returns one node per TLD keyed directly on the reply (e.g.\n // reply.com = { registration, renew, transfer }); read via a Record cast\n}\n\n// one DS record from dnsSecListRecords (read fields are snake_case)\ninterface NsDsRecord {\n digest?: string;\n digest_type?: string | number;\n algorithm?: string | number;\n key_tag?: string | number;\n}\n\n// one mailbox from listEmailForwards: `email` is the local part, `forwards_to`\n// is one address or an array of them\ninterface NsEmailAddresses {\n email?: string;\n forwards_to?: string | string[];\n}\n\ninterface NsResponse {\n reply?: NsReply;\n}\n\n// getDomainInfo.contact_ids: internal NameSilo IDs per role (strings)\ninterface NsContactIds {\n registrant?: string | number;\n administrative?: string | number;\n technical?: string | number;\n billing?: string | number;\n}\n\n// a full contact record from contactList (empty XML elements parse to '' or {})\ninterface NsContact {\n contact_id?: string | number;\n first_name?: unknown;\n last_name?: unknown;\n company?: unknown;\n address?: unknown;\n address2?: unknown;\n city?: unknown;\n state?: unknown;\n zip?: unknown;\n country?: unknown;\n email?: unknown;\n phone?: unknown;\n fax?: unknown;\n}\n\n// a DNS record from dnsListRecords (distance carries the MX priority)\ninterface NsResourceRecord {\n record_id?: string | number;\n type?: unknown;\n host?: unknown;\n value?: unknown;\n ttl?: unknown;\n distance?: unknown;\n}\n\n// one TLD's price node from getPrices\ninterface NsPriceNode {\n registration?: unknown;\n renew?: unknown;\n transfer?: unknown;\n}\n\n// a normalized availability entry parsed from a checkRegisterAvailability group\ninterface NsAvailEntry {\n name: string;\n price?: number;\n premium?: boolean;\n duration?: number;\n}\n\n// a domain entry from listDomains, which may arrive as a bare name or an object\ninterface NsDomainEntry {\n domain?: string;\n created?: string;\n expires?: string;\n}\n\n/**\n * NameSilo Registrar\n * API docs: https://www.namesilo.com/api-reference\n *\n * Credentials: generate an API key in your NameSilo account under\n * Account Options > API Manager. The key may optionally be restricted to up to\n * five IP addresses there.\n *\n * Note: NameSilo uses a simple HTTP GET API — every call hits\n * `/{operation}` with `version`, `type=json`, and `key` query parameters (the\n * key travels in the URL, per their API design). Responses carry a numeric\n * `reply.code` (300 = success) rather than using HTTP status codes.\n */\nexport class NameSiloRegistrar extends BaseRegistrar {\n readonly name = 'namesilo';\n\n static readonly displayName = 'NameSilo';\n static readonly website = 'namesilo.com';\n static readonly helpText =\n 'Generate an API key in your NameSilo account under Account Options > API Manager. ' +\n 'You can optionally restrict the key to specific IP addresses there. For sandbox ' +\n 'testing, use { environment: \"sandbox\" } (OTE host ote.namesilo.com) — OTE ' +\n 'credentials are not self-service; you must contact NameSilo support to be issued them.';\n static readonly configFields: ConfigField[] = [\n { name: 'apiKey', label: 'API Key', type: 'password', required: true },\n ];\n // NameSilo runs an OTE/test environment at ote.namesilo.com; sandbox keys are\n // issued by emailing NameSilo support (not self-service).\n static readonly supportsSandbox = true;\n // JSON API with broad coverage. Beyond core: DNSSEC read/disable, email\n // forwarding, and domain (URL) forwarding. GetAuthCode is intentionally NOT\n // declared — NameSilo's retrieveAuthCode emails the EPP code to the\n // registrant and never returns it, so it can't satisfy the getAuthCode\n // contract. No webhooks (polling only).\n static readonly extendedFeatures: readonly RegistrarFeature[] = [\n Feature.GetDnssec,\n Feature.DisableDnssec,\n Feature.GetEmailForwarding,\n Feature.SetEmailForwarding,\n Feature.GetDomainForwarding,\n Feature.SetDomainForwarding,\n ];\n\n constructor(credentials: RegistrarCredentials, options?: RegistrarOptions) {\n super(\n credentials,\n {\n baseUrl: selectBaseUrl('NameSilo', options?.environment, {\n production: 'https://www.namesilo.com/api',\n sandbox: 'https://ote.namesilo.com/api',\n }),\n },\n options\n );\n }\n\n // issue an operation with the standard auth params merged in\n private call(\n operation: string,\n extra: Record<string, string | number> = {},\n opts?: RequestOptions\n ): Promise<NsResponse> {\n return this.http.request<NsResponse>({\n path: `/${operation}`,\n query: { version: 1, type: 'json', key: this.credentials.apiKey, ...extra },\n ...opts,\n });\n }\n\n override async testConnection(opts?: RequestOptions): Promise<ConnectionResult> {\n try {\n // getAccountBalance is the cheapest read-only call that validates the key\n const res = await this.call('getAccountBalance', {}, opts);\n return replyOk(res)\n ? { success: true, message: 'Connection successful' }\n : { success: false, message: replyDetail(res) };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n /**\n * listDomains returns names + created/expires dates only. Nameservers, status,\n * lock, privacy, and auto-renew are NOT in the list response and cannot be\n * batched in — use `getDomain` per domain for those. `search` is applied\n * client-side (NameSilo has no server-side name filter).\n */\n override async listDomains(opts?: ListDomainsOptions): Promise<Domain[]> {\n const { search, ...reqOpts } = opts ?? {};\n const domains: Domain[] = [];\n const perPage = 100; // NameSilo page size\n let page = 1;\n let hasMore = true;\n\n while (hasMore) {\n const res = await this.call('listDomains', { page, pageSize: perPage }, reqOpts);\n if (!replyOk(res)) {\n throw new Error(replyDetail(res));\n }\n\n const entries = extractDomainEntries(res.reply?.domains);\n for (const entry of entries) {\n domains.push(\n createDomain({\n domainName: entry.domain,\n registrar: this.name,\n status: 'ok', // the list endpoint does not return a per-domain status\n createdDate: entry.created,\n expirationDate: entry.expires,\n renewalDate: entry.expires,\n nameservers: [], // not returned by listDomains (see getDomain)\n })\n );\n }\n\n hasMore = entries.length === perPage;\n page++;\n }\n return filterDomains(domains, search);\n }\n\n /**\n * getDomainInfo carries the details listDomains omits: status, lock, privacy,\n * auto-renew, and nameservers. This is the only way to get NS for a NameSilo\n * domain (one call per domain).\n */\n override async getDomain(domainName: string, opts?: RequestOptions): Promise<Domain> {\n const res = await this.call('getDomainInfo', { domain: domainName }, opts);\n if (!replyOk(res)) {\n throw new NotFoundError(`NameSilo: domain '${domainName}' not found (${replyDetail(res)})`);\n }\n const r = res.reply ?? {};\n return createDomain({\n domainName,\n registrar: this.name,\n status: r.status,\n createdDate: r.created,\n expirationDate: r.expires,\n renewalDate: r.expires,\n autoRenew: isYes(r.auto_renew),\n locked: isYes(r.locked),\n privacy: isYes(r.private),\n nameservers: extractNsHosts(r.nameservers),\n });\n }\n\n override async getNameservers(domainName: string, opts?: RequestOptions): Promise<string[]> {\n const domain = await this.getDomain(domainName, opts);\n return domain.nameservers;\n }\n\n /**\n * NameSilo has no per-domain contact read: getDomainInfo returns only the\n * internal contact IDs per role, so we resolve them against the full account\n * contact profiles from `contactList` (one extra call), matching by ID.\n */\n override async getContacts(domainName: string, opts?: RequestOptions): Promise<ContactSet> {\n const infoRes = await this.call('getDomainInfo', { domain: domainName }, opts);\n if (!replyOk(infoRes)) {\n throw new NotFoundError(\n `NameSilo: domain '${domainName}' not found (${replyDetail(infoRes)})`\n );\n }\n const ids = infoRes.reply?.contact_ids ?? {};\n\n const listRes = await this.call('contactList', {}, opts);\n if (!replyOk(listRes)) {\n throw new Error(replyDetail(listRes));\n }\n const byId = new Map<string, NsContact>();\n for (const c of ensureArray(listRes.reply?.contact)) {\n byId.set(text(c.contact_id), c);\n }\n\n const lookup = (id: string | number | undefined): Contact | undefined => {\n const key = text(id);\n return key ? fromNsContact(byId.get(key)) : undefined;\n };\n return {\n registrant: lookup(ids.registrant),\n admin: lookup(ids.administrative),\n tech: lookup(ids.technical),\n billing: lookup(ids.billing),\n };\n }\n\n override async getDnsRecords(domainName: string, opts?: RequestOptions): Promise<DnsRecord[]> {\n const res = await this.call('dnsListRecords', { domain: domainName }, opts);\n if (!replyOk(res)) {\n throw new Error(replyDetail(res));\n }\n return ensureArray(res.reply?.resource_record).map(rr => {\n const type = text(rr.type).toUpperCase();\n const record: DnsRecord = {\n type,\n name: text(rr.host),\n value: text(rr.value),\n };\n const ttl = Number(rr.ttl);\n if (Number.isFinite(ttl)) record.ttl = ttl;\n // NameSilo carries the MX priority in `distance`\n const distance = Number(rr.distance);\n if (type === 'MX' && Number.isFinite(distance)) record.priority = distance;\n return record;\n });\n }\n\n /**\n * Per-TLD pricing via getPrices, which returns every supported TLD keyed\n * directly on the reply (e.g. reply.com = { registration, renew, transfer }).\n * Prices are already in major USD units. A bare TLD works; a full domain is\n * reduced to its TLD.\n */\n override async getPricing(tldOrDomain: string, opts?: RequestOptions): Promise<TldPricing> {\n const tld = (\n tldOrDomain.includes('.') ? tldOrDomain.slice(tldOrDomain.indexOf('.') + 1) : tldOrDomain\n ).toLowerCase();\n\n const res = await this.call('getPrices', {}, opts);\n if (!replyOk(res)) {\n throw new Error(replyDetail(res));\n }\n const reply = (res.reply ?? {}) as Record<string, unknown>;\n const node = reply[tld];\n if (!node || typeof node !== 'object') {\n throw new NotFoundError(`NameSilo: no pricing found for TLD '${tld}'`);\n }\n const price = node as NsPriceNode;\n return {\n tld,\n currency: 'USD',\n registration: toPrice(price.registration),\n renewal: toPrice(price.renew),\n transfer: toPrice(price.transfer),\n };\n }\n\n /**\n * Availability via checkRegisterAvailability (up to 200 domains per request).\n * The reply splits names into `available`, `unavailable`, and `invalid`\n * groups; available entries carry `price`/`premium`/`duration` attributes.\n * Malformed names land in `invalid` and are omitted from the result.\n */\n override async checkAvailability(\n domainNames: string[],\n opts?: RequestOptions\n ): Promise<DomainAvailability[]> {\n const res = await this.call(\n 'checkRegisterAvailability',\n { domains: domainNames.join(',') },\n opts\n );\n if (!replyOk(res)) {\n throw new Error(replyDetail(res));\n }\n const reply = res.reply ?? {};\n const results: DomainAvailability[] = [];\n\n for (const entry of extractAvailEntries(reply.available)) {\n const result: DomainAvailability = { domainName: entry.name, available: true };\n if (entry.premium != null) result.premium = entry.premium;\n if (entry.price != null) {\n result.price = entry.price;\n result.currency = 'USD';\n }\n if (entry.duration != null) result.period = entry.duration;\n results.push(result);\n }\n for (const entry of extractAvailEntries(reply.unavailable)) {\n results.push({ domainName: entry.name, available: false });\n }\n return results;\n }\n\n override async renewDomain(\n domainName: string,\n years = 1,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const res = await this.call('renewDomain', { domain: domainName, years }, opts);\n return statusResult(res);\n }\n\n override async updateNameservers(\n domainName: string,\n nameservers: string[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n if (nameservers.length < 2 || nameservers.length > 13) {\n throw new Error('NameSilo requires 2-13 nameservers');\n }\n const query: Record<string, string | number> = { domain: domainName };\n nameservers.forEach((ns, i) => {\n query[`ns${i + 1}`] = ns; // ns1..ns13\n });\n const res = await this.call('changeNameServers', query, opts);\n return statusResult(res);\n }\n\n override async lockDomain(domainName: string, opts?: RequestOptions): Promise<OperationResult> {\n // 252 = \"already locked\" — treat as an idempotent success\n const res = await this.call('domainLock', { domain: domainName }, opts);\n return statusResult(res, [252]);\n }\n\n override async unlockDomain(domainName: string, opts?: RequestOptions): Promise<OperationResult> {\n // 253 = \"already unlocked\" — treat as an idempotent success\n const res = await this.call('domainUnlock', { domain: domainName }, opts);\n return statusResult(res, [253]);\n }\n\n // --- extended capabilities ---------------------------------------------\n\n /**\n * DNSSEC status via dnsSecListRecords, which returns zero or more `ds_record`\n * entries (snake_case fields on read). A non-empty list means DNSSEC is on.\n */\n override async getDnssec(domainName: string, opts?: RequestOptions): Promise<DnssecStatus> {\n const res = await this.call('dnsSecListRecords', { domain: domainName }, opts);\n if (!replyOk(res)) throw new Error(replyDetail(res));\n const list = ensureArray<NsDsRecord>(res.reply?.ds_record);\n return {\n enabled: list.length > 0,\n dsRecords: list.map(d => ({\n keyTag: Number(d.key_tag) || 0,\n algorithm: Number(d.algorithm) || 0,\n digestType: Number(d.digest_type) || 0,\n digest: text(d.digest),\n })),\n };\n }\n\n /**\n * Disable DNSSEC by deleting every DS record (dnsSecDeleteRecord, once per\n * record — NameSilo has no bulk off). The delete params are camelCase and echo\n * the record's identifying fields.\n */\n override async disableDnssec(\n domainName: string,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n try {\n const res = await this.call('dnsSecListRecords', { domain: domainName }, opts);\n if (!replyOk(res)) return statusResult(res);\n for (const d of ensureArray<NsDsRecord>(res.reply?.ds_record)) {\n const del = await this.call(\n 'dnsSecDeleteRecord',\n {\n domain: domainName,\n digest: text(d.digest),\n keyTag: text(d.key_tag),\n digestType: text(d.digest_type),\n alg: text(d.algorithm),\n },\n opts\n );\n if (!replyOk(del)) return statusResult(del);\n }\n return { success: true, message: 'DNSSEC disabled successfully' };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n /**\n * Read the raw email-forward rows via listEmailForwards. NameSilo's `type=json`\n * output for this one call is lossy — it drops the alias (the `<email>` tag) and\n * returns only nested `forwards_to` arrays — so this call is fetched as XML and\n * parsed. The XML `<email>` is the full address (alias@domain); return just the\n * local part, plus its destinations.\n */\n private async listEmailForwards(\n domainName: string,\n opts?: RequestOptions\n ): Promise<{ alias: string; forwardsTo: string[] }[]> {\n const xml = await this.http.requestText({\n path: '/listEmailForwards',\n query: { version: 1, type: 'xml', key: this.credentials.apiKey, domain: domainName },\n ...opts,\n });\n const reply = parseXml<{ namesilo?: NsResponse }>(xml)?.namesilo?.reply;\n if (!reply || Number(reply.code) !== 300) {\n throw new Error(reply?.detail ? text(reply.detail) : 'NameSilo: listEmailForwards failed');\n }\n const suffix = `@${domainName.toLowerCase()}`;\n return ensureArray<NsEmailAddresses>(reply.addresses).map(a => {\n const full = text(a.email);\n const alias = full.toLowerCase().endsWith(suffix)\n ? full.slice(0, full.length - suffix.length)\n : full;\n return { alias, forwardsTo: ensureArray<string>(a.forwards_to).map(text).filter(Boolean) };\n });\n }\n\n /**\n * Read email forwarding. Expands each alias's destinations into its own\n * {alias, forwardTo} row.\n */\n override async getEmailForwarding(\n domainName: string,\n opts?: RequestOptions\n ): Promise<EmailForward[]> {\n const rows = await this.listEmailForwards(domainName, opts);\n const out: EmailForward[] = [];\n for (const { alias, forwardsTo } of rows) {\n for (const dest of forwardsTo) {\n if (alias && dest) out.push({ alias, forwardTo: dest });\n }\n }\n return out;\n }\n\n /**\n * Replace email forwarding (full replace; empty clears). NameSilo has no bulk\n * endpoint, so diff by mailbox: configureEmailForward upserts one alias with up\n * to 5 destinations (forward1..forward5); deleteEmailForward removes an alias.\n */\n override async setEmailForwarding(\n domainName: string,\n forwards: EmailForward[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n try {\n const desired = new Map<string, string[]>();\n for (const f of forwards) {\n const list = desired.get(f.alias) ?? [];\n list.push(f.forwardTo);\n desired.set(f.alias, list);\n }\n const currentAliases = new Set(\n (await this.listEmailForwards(domainName, opts)).map(r => r.alias).filter(Boolean)\n );\n\n for (const alias of currentAliases) {\n if (!desired.has(alias)) {\n const del = await this.call(\n 'deleteEmailForward',\n { domain: domainName, email: alias },\n opts\n );\n if (!replyOk(del)) return statusResult(del);\n }\n }\n for (const [alias, destinations] of desired) {\n const query: Record<string, string | number> = { domain: domainName, email: alias };\n // NameSilo supports up to 5 destinations: forward1..forward5\n destinations.slice(0, 5).forEach((dest, i) => {\n query[`forward${i + 1}`] = dest;\n });\n const set = await this.call('configureEmailForward', query, opts);\n if (!replyOk(set)) return statusResult(set);\n }\n return { success: true, message: 'Email forwarding updated successfully' };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n /**\n * Read the apex URL forwarding from getDomainInfo (`forward_url`/`forward_type`).\n * NameSilo has no forwarding-list endpoint, so only the apex forward is\n * readable — per-subdomain forwards can be set but not enumerated.\n */\n override async getDomainForwarding(\n domainName: string,\n opts?: RequestOptions\n ): Promise<DomainForward[]> {\n const res = await this.call('getDomainInfo', { domain: domainName }, opts);\n if (!replyOk(res)) throw new Error(replyDetail(res));\n // NameSilo keeps the last `forward_url` even after forwarding is switched off,\n // so gate on `traffic_type` — only \"Forwarded\" means an active apex forward.\n // (A never-forwarded domain also reports forward_url \"N/A\".)\n if (text(res.reply?.traffic_type) !== 'Forwarded') return [];\n const url = text(res.reply?.forward_url);\n if (!url || url === 'N/A') return [];\n return [{ host: '@', url, type: nsForwardType(res.reply?.forward_type) }];\n }\n\n /**\n * Set apex URL forwarding via domainForward (method 301/302/cloaked). NameSilo\n * can't list per-subdomain forwards, so this interface supports the apex forward\n * only (host \"@\"); an empty list clears it by restoring NameSilo's default\n * nameservers (there is no dedicated \"stop forwarding\" command).\n */\n override async setDomainForwarding(\n domainName: string,\n forwards: DomainForward[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n if (forwards.length === 0) {\n return this.updateNameservers(domainName, NAMESILO_DEFAULT_NS, opts);\n }\n if (forwards.length > 1) {\n throw new Error('NameSilo supports a single apex (\"@\") forward via this interface');\n }\n const [f] = settableForwards(forwards); // reject masked before any write\n if (f.host && f.host !== '@') {\n throw new Error(\n 'NameSilo per-subdomain forwards are not listable, so only the apex (\"@\") forward is supported'\n );\n }\n const scheme = /^(https?):\\/\\/(.*)$/i.exec(f.url);\n const protocol = scheme ? scheme[1].toLowerCase() : 'http';\n const address = scheme ? scheme[2] : f.url;\n const res = await this.call(\n 'domainForward',\n { domain: domainName, protocol, address, method: NS_FORWARD_METHOD[f.type] },\n opts\n );\n return statusResult(res);\n }\n\n override async setAutoRenew(\n domainName: string,\n enabled: boolean,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n // 300 on change; 280 = \"already set to that value\" — idempotent success\n const res = await this.call(\n enabled ? 'addAutoRenewal' : 'removeAutoRenewal',\n { domain: domainName },\n opts\n );\n return statusResult(res, [280]);\n }\n\n override async setPrivacy(\n domainName: string,\n enabled: boolean,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n // 300 on change; 280 = \"already in that state\" — idempotent success\n const res = await this.call(\n enabled ? 'addPrivacy' : 'removePrivacy',\n { domain: domainName },\n opts\n );\n return statusResult(res, [280]);\n }\n\n /**\n * Replaces the record set. NameSilo has no atomic \"set all\" endpoint — records\n * are added/deleted individually by id — so this diffs against the current\n * records: it adds records not already present and deletes those no longer in\n * the desired set, leaving unchanged records (and their ids) untouched. The\n * delegation nameservers aren't part of this list (see `updateNameservers`).\n */\n override async setDnsRecords(\n domainName: string,\n records: DnsRecord[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const listRes = await this.call('dnsListRecords', { domain: domainName }, opts);\n if (!replyOk(listRes)) return { success: false, message: replyDetail(listRes) };\n const existing = ensureArray(listRes.reply?.resource_record);\n\n const existingByKey = new Map<string, string>(); // record key -> record_id\n for (const rr of existing) {\n const k = dnsKey(text(rr.type), text(rr.host), text(rr.value), Number(rr.distance));\n existingByKey.set(k, text(rr.record_id));\n }\n\n // add desired records that aren't already present\n const desiredKeys = new Set<string>();\n for (const r of records) {\n const type = r.type.toUpperCase();\n const k = dnsKey(type, r.name || '@', r.value, r.priority);\n desiredKeys.add(k);\n if (existingByKey.has(k)) continue;\n const query: Record<string, string | number> = {\n domain: domainName,\n rrtype: type,\n rrhost: r.name === '@' ? '' : r.name, // NameSilo wants a bare host, empty at the apex\n rrvalue: r.value,\n rrttl: r.ttl ?? 7207, // NameSilo's default TTL\n };\n if (type === 'MX') query.rrdistance = r.priority ?? 10;\n const addRes = await this.call('dnsAddRecord', query, opts);\n if (!replyOk(addRes)) return { success: false, message: replyDetail(addRes) };\n }\n\n // delete existing records no longer in the desired set\n for (const [k, rrid] of existingByKey) {\n if (desiredKeys.has(k) || !rrid) continue;\n const delRes = await this.call('dnsDeleteRecord', { domain: domainName, rrid }, opts);\n if (!replyOk(delRes)) return { success: false, message: replyDetail(delRes) };\n }\n return { success: true, message: 'DNS records updated successfully' };\n }\n\n /**\n * Updates contact roles. NameSilo contacts are account-level records referenced\n * by id, so this creates a new contact profile per supplied role (`contactAdd`)\n * and points the domain's roles at the new ids (`contactDomainAssociate`).\n * Identical contacts across roles are created once. Roles not supplied keep\n * their current association.\n */\n override async updateContacts(\n domainName: string,\n contacts: ContactSet,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const roles: [keyof ContactSet, string][] = [\n ['registrant', 'registrant'],\n ['admin', 'administrative'],\n ['tech', 'technical'],\n ['billing', 'billing'],\n ];\n const association: Record<string, string | number> = { domain: domainName };\n const idByContact = new Map<Contact, string>();\n for (const [role, param] of roles) {\n const contact = contacts[role];\n if (!contact) continue;\n let id = idByContact.get(contact);\n if (!id) {\n const addRes = await this.call('contactAdd', toNsContactParams(contact), opts);\n if (!replyOk(addRes)) return { success: false, message: replyDetail(addRes) };\n id = text(addRes.reply?.contact_id);\n if (!id) return { success: false, message: 'NameSilo: contactAdd returned no contact_id' };\n idByContact.set(contact, id);\n }\n association[param] = id;\n }\n if (Object.keys(association).length === 1) {\n throw new Error('NameSilo: updateContacts requires at least one contact role');\n }\n const assocRes = await this.call('contactDomainAssociate', association, opts);\n return statusResult(assocRes);\n }\n\n /**\n * Registers a domain. NameSilo registers the domain against the account's\n * default contact profile (use `updateContacts` afterwards to set specific\n * contacts). `private`/`auto_renew` are honored, and initial nameservers are\n * passed when supplied. Spends real money; not exercised against a live account.\n */\n override async registerDomain(\n domainName: string,\n input: RegisterDomainInput,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const query: Record<string, string | number> = {\n domain: domainName,\n years: input.years ?? 1,\n private: input.privacy ? 1 : 0,\n auto_renew: input.autoRenew ? 1 : 0,\n };\n (input.nameservers ?? []).forEach((ns, i) => {\n query[`ns${i + 1}`] = ns;\n });\n const res = await this.call('registerDomain', query, opts);\n return statusResult(res);\n }\n\n /**\n * Transfers a domain in with its EPP auth code. `private`/`auto_renew` are\n * honored; contacts come from the account default. Spends real money; not\n * exercised against a live account.\n */\n override async transferIn(\n domainName: string,\n input: TransferDomainInput,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const query: Record<string, string | number> = {\n domain: domainName,\n auth: input.authCode,\n private: input.privacy ? 1 : 0,\n auto_renew: input.autoRenew ? 1 : 0,\n };\n const res = await this.call('transferDomain', query, opts);\n return statusResult(res);\n }\n}\n\n// safely stringify an unknown XML value: strings/numbers/booleans pass through\n// (trimmed), everything else (e.g. an empty `{}` from a self-closing element)\n// becomes ''. Guards against no-base-to-string on arbitrary objects.\nfunction text(v: unknown): string {\n if (typeof v === 'string') return v.trim();\n if (typeof v === 'number' || typeof v === 'boolean') return String(v);\n return '';\n}\n\n// a stable identity key for a DNS record: type + relative host (apex as \"@\") +\n// value, plus the MX distance (priority) which is part of an MX record's identity\nfunction dnsKey(type: string, host: string, value: string, distance: number | undefined): string {\n const t = type.toUpperCase();\n const dist = t === 'MX' && Number.isFinite(distance) ? String(distance) : '';\n return [t, host || '@', value, dist].join('\\x00');\n}\n\n// map the normalized Contact to NameSilo's contactAdd parameters (fn/ln/ad/…)\nfunction toNsContactParams(c: Contact): Record<string, string | number> {\n const params: Record<string, string | number> = {\n fn: c.firstName,\n ln: c.lastName,\n ad: c.address1,\n cy: c.city,\n st: c.state ?? '',\n zp: c.postalCode,\n ct: c.country,\n em: c.email,\n ph: c.phone,\n };\n if (c.organization) params.cp = c.organization;\n if (c.address2) params.ad2 = c.address2;\n if (c.fax) params.fx = c.fax;\n return params;\n}\n\n// parse an unknown price-ish value into a positive number, or undefined\nfunction toPrice(v: unknown): number | undefined {\n if (typeof v !== 'string' && typeof v !== 'number') return undefined;\n const n = Number(v);\n return Number.isFinite(n) ? n : undefined;\n}\n\n// map a NameSilo contact record to the normalized Contact shape\nfunction fromNsContact(c: NsContact | undefined): Contact | undefined {\n if (!c) return undefined;\n const opt = (v: unknown): string | undefined => {\n const s = text(v);\n return s ? s : undefined;\n };\n return {\n firstName: text(c.first_name),\n lastName: text(c.last_name),\n organization: opt(c.company),\n email: text(c.email),\n phone: text(c.phone),\n fax: opt(c.fax),\n address1: text(c.address),\n address2: opt(c.address2),\n city: text(c.city),\n state: text(c.state),\n postalCode: text(c.zip),\n country: text(c.country),\n };\n}\n\n// normalize a checkRegisterAvailability group into availability entries. A group\n// is `{ domain: <entry|entry[]> }`; each entry is a bare domain string, or (for\n// available names) an object carrying the name plus price/premium/duration.\n// NameSilo's JSON attribute naming isn't contractually documented, so read the\n// bare, `@`, and `@_` forms defensively (mirroring extractNsHosts' #text guard).\nfunction extractAvailEntries(group: unknown): NsAvailEntry[] {\n if (!group) return [];\n const raw =\n typeof group === 'object' && !Array.isArray(group) && 'domain' in group\n ? ((group as { domain?: unknown }).domain ?? [])\n : group;\n return ensureArray(raw)\n .map((item): NsAvailEntry => {\n if (typeof item === 'string') return { name: item.trim() };\n if (item && typeof item === 'object') {\n const o = item as Record<string, unknown>;\n const name = text(o['#text'] ?? o.value ?? o.domain);\n const priceRaw = o.price ?? o['@price'] ?? o['@_price'];\n const premiumRaw = o.premium ?? o['@premium'] ?? o['@_premium'];\n const durationRaw = o.duration ?? o['@duration'] ?? o['@_duration'];\n const entry: NsAvailEntry = { name };\n const price = toPrice(priceRaw);\n if (price != null && price > 0) entry.price = price;\n if (premiumRaw != null && text(premiumRaw) !== '') entry.premium = isYes(premiumRaw);\n const duration = toPrice(durationRaw);\n if (duration != null && duration > 0) entry.duration = duration;\n return entry;\n }\n return { name: '' };\n })\n .filter(e => e.name);\n}\n\n// NameSilo booleans arrive as \"Yes\"/\"No\" (or 1/0) strings\nfunction isYes(v: unknown): boolean {\n if (typeof v !== 'string' && typeof v !== 'number' && typeof v !== 'boolean') return false;\n const s = String(v).trim().toLowerCase();\n return s === 'yes' || s === '1' || s === 'true';\n}\n\n// NameSilo's DNS-hosting nameservers (DNSOWL). There is no dedicated \"stop\n// forwarding\" command; re-pointing the domain at these flips its `traffic_type`\n// from \"Forwarded\" back to \"Custom DNS\", which deactivates the apex forward.\n// (The parking servers ns1/ns2.namesilo.com do NOT clear forwarding.)\nconst NAMESILO_DEFAULT_NS = ['ns1.dnsowl.com', 'ns2.dnsowl.com', 'ns3.dnsowl.com'];\n\n// map our generic (settable) forward type to NameSilo's domainForward `method`\nconst NS_FORWARD_METHOD: Record<'temporary' | 'permanent', string> = {\n permanent: '301',\n temporary: '302',\n};\n\n// interpret NameSilo's read-side forward_type into our generic type. A masked/\n// cloaked forward is reported as read-only `masked` (setDomainForwarding rejects it).\nfunction nsForwardType(v: string | undefined): DomainForwardType {\n const s = (v ?? '').toLowerCase();\n if (s.includes('cloak') || s.includes('frame') || s.includes('mask')) return 'masked';\n if (s.includes('302') || s.includes('temp')) return 'temporary';\n return 'permanent';\n}\n\n// getDomainInfo returns nameservers as an array of `{ nameserver: \"HOST\",\n// position: N }`. Some other endpoints wrap them as `{ nameserver: [...] }` or\n// carry the host in `#text`, so all forms are handled defensively.\nfunction extractNsHosts(ns: unknown): string[] {\n if (!ns) return [];\n const raw =\n typeof ns === 'object' && !Array.isArray(ns) && 'nameserver' in ns\n ? ((ns as { nameserver?: unknown }).nameserver ?? [])\n : ns;\n const list = Array.isArray(raw) ? raw : [raw];\n return list\n .map(item => {\n if (typeof item === 'string') return item;\n if (item && typeof item === 'object') {\n const o = item as Record<string, unknown>;\n if (typeof o.nameserver === 'string') return o.nameserver; // { nameserver: \"HOST\", position }\n if (typeof o['#text'] === 'string') return o['#text'];\n }\n return '';\n })\n .filter(Boolean);\n}\n\n// whether the response's reply.code is in the success family (300)\nfunction replyOk(res: NsResponse): boolean {\n return Number(res.reply?.code) === 300;\n}\n\n// human-readable detail from a reply, for error messages\nfunction replyDetail(res: NsResponse): string {\n return res.reply?.detail?.trim() || 'Unknown response';\n}\n\n// map a reply to an OperationResult; extra codes are also treated as success\nfunction statusResult(res: NsResponse, okCodes: number[] = []): OperationResult {\n const code = Number(res.reply?.code);\n if (code === 300 || okCodes.includes(code)) {\n return { success: true, message: res.reply?.detail?.trim() || 'success' };\n }\n return { success: false, message: replyDetail(res) };\n}\n\n// listDomains may return domains as an array of names, an array of objects, or\n// an object wrapping a `domain` array — normalize all shapes to entry objects\nfunction extractDomainEntries(domains: unknown): NsDomainEntry[] {\n if (!domains) return [];\n const raw = Array.isArray(domains)\n ? domains\n : typeof domains === 'object' && 'domain' in domains\n ? ((domains as { domain?: unknown }).domain ?? [])\n : [];\n const list = Array.isArray(raw) ? raw : [raw];\n return list.map(item => (typeof item === 'string' ? { domain: item } : (item as NsDomainEntry)));\n}\n","import type {\n ConfigField,\n Contact,\n ConnectionResult,\n ContactSet,\n DnsRecord,\n DnssecStatus,\n Domain,\n DomainAvailability,\n DomainForward,\n DomainForwardType,\n ListDomainsOptions,\n OperationResult,\n RegisterDomainInput,\n RegistrarOptions,\n RequestOptions,\n TldPricing,\n TransferDomainInput,\n} from '../types';\nimport { createDomain, filterDomains, normalizeDomain, settableForwards } from '../utils';\nimport { NotFoundError, NotImplementedError, toRegistrarError } from '../errors';\nimport { BaseRegistrar, selectBaseUrl } from '../registrar';\nimport { Feature, type RegistrarFeature } from '../features';\nimport type { RegistrarCredentials } from '../types';\n\n// Porkbun returns `{ status: \"SUCCESS\" | \"ERROR\", ... }` for every operation.\ninterface PbResponse {\n status?: string;\n message?: string;\n domains?: PbDomain[];\n}\n\ninterface PbDomain {\n domain?: string;\n status?: string;\n createDate?: string;\n expireDate?: string;\n securityLock?: string | number;\n whoisPrivacy?: string | number;\n autoRenew?: string | number;\n}\n\n// domain/getNs response — `ns` is the current nameserver list\ninterface PbNsResponse extends PbResponse {\n ns?: string[];\n}\n\n// a single DNS record from dns/retrieve. All fields arrive as strings.\ninterface PbDnsRecord {\n id?: string;\n name?: string; // fully-qualified host, e.g. \"www.example.com\" (\"example.com\" at apex)\n type?: string;\n content?: string; // record data (for SRV: \"weight port target\")\n ttl?: string;\n prio?: string; // priority, for MX / SRV\n notes?: string;\n}\n\ninterface PbDnsResponse extends PbResponse {\n records?: PbDnsRecord[];\n}\n\n// one TLD's price points from pricing/get. Values are strings in major USD units.\ninterface PbTldPrice {\n registration?: string;\n renewal?: string;\n transfer?: string;\n}\n\ninterface PbPricingResponse extends PbResponse {\n pricing?: Record<string, PbTldPrice>;\n}\n\n// bulk/per-domain response (e.g. domain/updateAutoRenew) — the per-domain\n// outcome is nested under `results`, keyed by domain name.\ninterface PbBulkResponse extends PbResponse {\n results?: Record<string, { status?: string; message?: string }>;\n}\n\n// domain/getUrlForwarding — one URL-forward rule. `type` is\n// permanent/temporary/masked; `redirectType` is the matching 301/302.\ninterface PbUrlForward {\n id?: string;\n subdomain?: string; // \"\" at the apex\n location?: string; // destination URL\n type?: string;\n includePath?: string;\n wildcard?: string;\n}\ninterface PbUrlForwardResponse extends PbResponse {\n forwards?: PbUrlForward[];\n}\n\n// dns/getDnssecRecords — DS records keyed by key tag (or null when none)\ninterface PbDnssecRecord {\n keyTag?: string | number;\n alg?: string | number;\n digestType?: string | number;\n digest?: string;\n maxSigLife?: string;\n}\ninterface PbDnssecResponse extends PbResponse {\n records?: Record<string, PbDnssecRecord> | null;\n}\n\n// map between our generic (settable) forward type and Porkbun's `type` value\nconst FORWARD_TO_PB_TYPE: Record<'temporary' | 'permanent', string> = {\n temporary: 'temporary', // 302\n permanent: 'permanent', // 301\n};\nconst PB_TYPE_TO_FORWARD: Record<string, DomainForwardType> = {\n temporary: 'temporary',\n permanent: 'permanent',\n masked: 'masked', // read-only; setDomainForwarding rejects it\n};\n\n// Porkbun's contact shape: phone is split into a national number plus a numeric\n// country code, distinct from the library's single international `phone`.\ninterface PbContact {\n firstName: string;\n lastName: string;\n organization?: string;\n email: string;\n phone: string;\n phoneCountryCode: string;\n address1: string;\n address2?: string;\n city: string;\n state?: string;\n postalCode: string;\n country: string;\n}\n\n// domain/checkDomain response — availability sits under `response`. With\n// `priceType: \"renewal\"`, per-operation prices appear under `additional`\n// (`additional.renewal.price` is the exact renewal, premium included). The\n// top-level `price` stays the first-year registration price regardless.\ninterface PbCheckResponse extends PbResponse {\n response?: {\n avail?: string; // \"yes\" | \"no\"\n type?: string; // \"registration\" | ...\n price?: string;\n regularPrice?: string;\n premium?: string; // \"yes\" | \"no\"\n additional?: {\n renewal?: { type?: string; price?: string; regularPrice?: string };\n transfer?: { type?: string; price?: string; regularPrice?: string };\n };\n };\n}\n\n/**\n * Porkbun Registrar\n * API docs: https://porkbun.com/api/json/v3/documentation\n *\n * Credentials: create an API key + secret under Account > API Access, then\n * enable API access for each domain you want to manage (Porkbun gates most\n * operations behind a per-domain \"API Access\" toggle in the domain's settings).\n *\n * Note: Porkbun uses a JSON POST API; credentials travel in the request body as\n * `apikey` / `secretapikey`. Success is signalled by `status: \"SUCCESS\"`.\n *\n * Write field notes (all verified end-to-end in the sandbox): register and renew\n * take a `cost` in pennies that must exactly match the current price (fetched\n * from `checkDomain`/`pricing/get`), plus `agreeToTerms: \"yes\"` on register;\n * Porkbun always registers/renews the registry-minimum term, so `years` is not\n * honored. `create` carries no nameservers/auto-renew/contacts fields, so those\n * are applied as follow-up calls (contacts default to the account WHOIS at\n * registration — set them afterwards with `updateContacts`). Auto-renew is\n * toggled with `status: \"on\"|\"off\"` and reports its result in a nested\n * `results[domain]` object. Transfer-in needs `authCode` + the transfer `cost`.\n * Porkbun manages the apex NS records itself (creating NS at the apex is\n * rejected and its default nameservers auto-restore), so `setDnsRecords` leaves\n * them untouched.\n *\n * API gaps (left as NotImplementedError): the transfer lock is read-only via the\n * API (`securityLock` is exposed but has no toggle endpoint), WHOIS privacy has\n * no post-registration toggle (settable only at registration), and there is no\n * contact-read (WHOIS) endpoint.\n */\nexport class PorkbunRegistrar extends BaseRegistrar {\n readonly name = 'porkbun';\n\n static readonly displayName = 'Porkbun';\n static readonly website = 'porkbun.com';\n static readonly helpText =\n 'Create an API key and secret in your Porkbun account under Account > API Access, ' +\n 'then enable \"API Access\" on each domain you want to manage (per-domain toggle in ' +\n 'the domain details). For testing, use a sandbox key (prefixed \"pk1_sb_\") with ' +\n '{ environment: \"sandbox\" } — it hits the same base URL but an isolated test ' +\n 'environment with $1,000 of fake credit and no real charges (top up or reset via ' +\n 'POST /sandbox/topup and POST /sandbox/reset).';\n static readonly configFields: ConfigField[] = [\n { name: 'apiKey', label: 'API Key', type: 'password', required: true },\n { name: 'secretApiKey', label: 'Secret API Key', type: 'password', required: true },\n ];\n // Porkbun's sandbox is the SAME base URL with a swapped key: a sandbox key is\n // prefixed `pk1_sb_` and runs against an isolated test environment (no real\n // registry actions, no DNS changes, no charges). Each sandbox starts with\n // $1,000 of fake credit and every response includes `\"sandbox\": true`. Top up\n // or reset a sandbox with `POST /sandbox/topup` / `POST /sandbox/reset` using a\n // sandbox key. Because only the key differs, the sandbox base URL equals\n // production — selecting `environment: 'sandbox'` just avoids throwing.\n static readonly supportsSandbox = true;\n // JSON API. Beyond core: DNSSEC read/disable and URL (domain) forwarding, both\n // implemented and verified in the sandbox. No auth-code retrieval or email\n // forwarding via the API; transfer lock and WHOIS-privacy toggles have no write\n // endpoint (privacy is set only at registration).\n static readonly extendedFeatures: readonly RegistrarFeature[] = [\n Feature.GetDnssec,\n Feature.DisableDnssec,\n Feature.GetDomainForwarding,\n Feature.SetDomainForwarding,\n ];\n\n constructor(credentials: RegistrarCredentials, options?: RegistrarOptions) {\n super(\n credentials,\n {\n baseUrl: selectBaseUrl('Porkbun', options?.environment, {\n production: 'https://api.porkbun.com/api/json/v3',\n // sandbox shares the production URL; the `pk1_sb_` key selects the\n // isolated test environment server-side.\n sandbox: 'https://api.porkbun.com/api/json/v3',\n }),\n },\n options\n );\n }\n\n // POST an operation with the credentials merged into the JSON body\n private call<T extends PbResponse = PbResponse>(\n path: string,\n extra: Record<string, unknown> = {},\n opts?: RequestOptions\n ): Promise<T> {\n return this.http.request<T>({\n method: 'POST',\n path,\n body: {\n apikey: this.credentials.apiKey,\n secretapikey: this.credentials.secretApiKey,\n ...extra,\n },\n ...opts,\n });\n }\n\n override async testConnection(opts?: RequestOptions): Promise<ConnectionResult> {\n try {\n const res = await this.call('/ping', {}, opts);\n return isOk(res)\n ? { success: true, message: 'Connection successful' }\n : { success: false, message: res.message ?? 'Unknown error' };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n override async listDomains(opts?: ListDomainsOptions): Promise<Domain[]> {\n // listAll has no name filter, so `search` is applied client-side. Porkbun\n // returns fixed 1000-domain chunks and pages by `start` offset.\n const { search, ...reqOpts } = opts ?? {};\n const domains: Domain[] = [];\n const chunk = 1000; // Porkbun returns up to 1000 domains per call\n let start = 0;\n let hasMore = true;\n\n while (hasMore) {\n const res = await this.call('/domain/listAll', { start, includeLabels: 'no' }, reqOpts);\n if (!isOk(res)) {\n throw new Error(res.message ?? 'API request failed');\n }\n\n const list = res.domains ?? [];\n for (const d of list) {\n domains.push(\n createDomain({\n domainName: d.domain,\n registrar: this.name,\n status: d.status ?? 'ok',\n createdDate: d.createDate,\n expirationDate: d.expireDate,\n renewalDate: d.expireDate,\n autoRenew: isYes(d.autoRenew),\n locked: isYes(d.securityLock),\n privacy: isYes(d.whoisPrivacy),\n nameservers: [], // not returned by listAll (see domain/getNs)\n })\n );\n }\n\n hasMore = list.length === chunk;\n start += chunk;\n }\n return filterDomains(domains, search);\n }\n\n /**\n * Porkbun has no per-domain \"get info\" endpoint, so this lists the account and\n * returns the matching record. `listDomains` already normalizes every field, so\n * the result carries the same shape as any other provider's `getDomain`. Throws\n * NotFoundError when the domain isn't in the account.\n */\n override async getDomain(domainName: string, opts?: RequestOptions): Promise<Domain> {\n const target = normalizeDomain(domainName);\n const domains = await this.listDomains(opts);\n const match = domains.find(d => normalizeDomain(d.domainName) === target);\n if (!match) {\n throw new NotFoundError(`${this.name}: domain ${domainName} not found in this account`);\n }\n return match;\n }\n\n override async getNameservers(domainName: string, opts?: RequestOptions): Promise<string[]> {\n const res = await this.call<PbNsResponse>(\n `/domain/getNs/${encodeURIComponent(domainName)}`,\n {},\n opts\n );\n if (!isOk(res)) throw new Error(res.message ?? 'API request failed');\n return res.ns ?? [];\n }\n\n /**\n * Porkbun exposes no WHOIS/contact retrieval endpoint — contact details are\n * only settable at registration and never read back through the API — so there\n * is no way to fulfil this. (Mirrors Spaceship's `getPricing` gap handling.)\n */\n override getContacts(_domainName: string, _opts?: RequestOptions): Promise<ContactSet> {\n return Promise.reject(\n new NotImplementedError(\n `${this.name}: getContacts is not available — Porkbun's API has no contact-read ` +\n '(WHOIS) endpoint'\n )\n );\n }\n\n override async getDnsRecords(domainName: string, opts?: RequestOptions): Promise<DnsRecord[]> {\n const res = await this.call<PbDnsResponse>(\n `/dns/retrieve/${encodeURIComponent(domainName)}`,\n {},\n opts\n );\n if (!isOk(res)) throw new Error(res.message ?? 'API request failed');\n return (res.records ?? []).map(r => toDnsRecord(r, domainName));\n }\n\n /**\n * Renewal price for a specific name (premium included) when given a full\n * domain; the standard per-TLD price table when given a bare TLD.\n *\n * For a full domain, `checkDomain` with `priceType: \"renewal\"` returns the\n * exact renewal fee for that exact name under `additional.renewal.price` —\n * elevated for premium names — and it works whether or not the domain is in the\n * account. `pricing/get` only has the generic per-TLD rate, which misses\n * premium renewals, so we deliberately do NOT fall back to it here: if the\n * per-name check can't price the domain we return no renewal, leaving the\n * caller to fill from its own base pricing.\n *\n * For a bare TLD (as the renew/transfer write flows pass), there is no specific\n * name to price, so this returns the `pricing/get` table entry directly.\n */\n override async getPricing(tldOrDomain: string, opts?: RequestOptions): Promise<TldPricing> {\n // A dot means a full domain (e.g. \"example.com\"); a bare label is a TLD.\n if (tldOrDomain.includes('.')) {\n const tld = extractTld(tldOrDomain);\n const checked = await this.renewPriceCheck(tldOrDomain, opts);\n return checked\n ? { tld, currency: checked.currency, renewal: checked.renewal }\n : { tld, currency: 'USD' };\n }\n return this.tldPricing(tldOrDomain, opts);\n }\n\n /**\n * The standard per-TLD price points from `pricing/get` (strings in major USD\n * units). Throws NotFoundError when the TLD isn't in the table. Used by the\n * renew/transfer flows and by `getPricing` for a bare TLD.\n */\n private async tldPricing(tld: string, opts?: RequestOptions): Promise<TldPricing> {\n const res = await this.call<PbPricingResponse>('/pricing/get', {}, opts);\n if (!isOk(res)) throw new Error(res.message ?? 'API request failed');\n const price = res.pricing?.[tld];\n if (!price) {\n throw new NotFoundError(`${this.name}: no pricing found for TLD .${tld}`);\n }\n return {\n tld,\n currency: 'USD', // Porkbun prices are always quoted in USD\n registration: toPrice(price.registration),\n renewal: toPrice(price.renewal),\n transfer: toPrice(price.transfer),\n };\n }\n\n /**\n * The exact renewal fee for a specific name via `checkDomain` +\n * `priceType: \"renewal\"`, read from `additional.renewal.price` (premium\n * included). Returns null when the name can't be priced (error, rate limit, or\n * a missing renewal figure) so `getPricing` can fall back. Note: Porkbun\n * rate-limits `checkDomain` to one call per ~10s; the shared HTTP layer retries\n * on the 429 (honoring Retry-After).\n */\n private async renewPriceCheck(\n domain: string,\n opts?: RequestOptions\n ): Promise<{ renewal: number; currency: string } | null> {\n try {\n const res = await this.call<PbCheckResponse>(\n `/domain/checkDomain/${encodeURIComponent(domain)}`,\n { priceType: 'renewal' },\n opts\n );\n if (!isOk(res)) return null;\n const renewal = toPrice(res.response?.additional?.renewal?.price);\n return renewal != null ? { renewal, currency: 'USD' } : null;\n } catch {\n return null;\n }\n }\n\n /**\n * Porkbun's checkDomain takes a single domain per call, so this issues one\n * request per name. The price it reports (major USD units) is the first-year\n * registration price for both regular and premium names.\n */\n override async checkAvailability(\n domainNames: string[],\n opts?: RequestOptions\n ): Promise<DomainAvailability[]> {\n const results: DomainAvailability[] = [];\n for (const domainName of domainNames) {\n const res = await this.call<PbCheckResponse>(\n `/domain/checkDomain/${encodeURIComponent(domainName)}`,\n {},\n opts\n );\n if (!isOk(res)) throw new Error(res.message ?? 'API request failed');\n const info = res.response ?? {};\n const price = toPrice(info.price);\n results.push({\n domainName,\n available: info.avail === 'yes',\n premium: info.premium === 'yes',\n price,\n currency: price != null ? 'USD' : undefined,\n period: price != null ? 1 : undefined,\n });\n }\n return results;\n }\n\n override async updateNameservers(\n domainName: string,\n nameservers: string[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n if (nameservers.length < 2) {\n throw new Error('Porkbun requires at least 2 nameservers');\n }\n const res = await this.call(\n `/domain/updateNs/${encodeURIComponent(domainName)}`,\n { ns: nameservers },\n opts\n );\n return statusResult(res);\n }\n\n /**\n * Registers a domain. Porkbun's `create` requires a `cost` (pennies) that\n * exactly matches the domain's current price — fetched here via `checkDomain`\n * — plus agreement to its terms (sent automatically; invoking this method is\n * the agreement). It always registers the registry-minimum term, so `years` is\n * ignored. Contacts aren't accepted at registration (Porkbun applies the\n * account-default WHOIS); use `updateContacts` afterwards to set them.\n * Nameservers and auto-renew have no `create` field, so they're applied as\n * follow-up calls when provided.\n */\n override async registerDomain(\n domainName: string,\n input: RegisterDomainInput,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const [availability] = await this.checkAvailability([domainName], opts);\n if (!availability?.available) {\n throw new Error(`${this.name}: ${domainName} is not available for registration`);\n }\n if (availability.price == null) {\n throw new Error(`${this.name}: could not determine the registration price for ${domainName}`);\n }\n const body: Record<string, unknown> = {\n cost: toPennies(availability.price),\n agreeToTerms: 'yes',\n };\n // whoisPrivacy is optional; omitting it uses the account default\n if (input.privacy != null) body.whoisPrivacy = input.privacy;\n\n const res = await this.call(`/domain/create/${encodeURIComponent(domainName)}`, body, opts);\n if (!isOk(res)) return statusResult(res);\n\n // create has no nameserver / auto-renew fields — apply them separately\n if (input.nameservers && input.nameservers.length > 0) {\n await this.updateNameservers(domainName, input.nameservers, opts);\n }\n if (input.autoRenew != null) {\n await this.setAutoRenew(domainName, input.autoRenew, opts);\n }\n return { success: true, message: `Domain ${domainName} registered successfully` };\n }\n\n /**\n * Renews a domain. Porkbun renews the registry-minimum term (usually 1 year)\n * and ignores any requested `years`; it requires a `cost` (pennies) matching\n * the domain's current renewal price, fetched here from `pricing/get`. Premium\n * renewals aren't supported via the API.\n */\n override async renewDomain(\n domainName: string,\n _years = 1,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const pricing = await this.tldPricing(extractTld(domainName), opts);\n if (pricing.renewal == null) {\n throw new Error(`${this.name}: could not determine the renewal price for ${domainName}`);\n }\n const res = await this.call(\n `/domain/renew/${encodeURIComponent(domainName)}`,\n { cost: toPennies(pricing.renewal) },\n opts\n );\n return statusResult(res);\n }\n\n override async setAutoRenew(\n domainName: string,\n enabled: boolean,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const res = await this.call<PbBulkResponse>(\n `/domain/updateAutoRenew/${encodeURIComponent(domainName)}`,\n { status: enabled ? 'on' : 'off' },\n opts\n );\n // updateAutoRenew reports the real outcome in a nested results[domain] entry,\n // even when the top-level status is SUCCESS.\n return bulkResult(\n res,\n domainName,\n `Auto-renew ${enabled ? 'enabled' : 'disabled'} successfully`\n );\n }\n\n /**\n * Transfers a domain in with its EPP auth code. Porkbun's `transfer` requires a\n * `cost` (pennies) matching the current transfer price, fetched here from\n * `pricing/get`. The transfer body carries no contacts/privacy/auto-renew — the\n * existing registration's details carry over — and premium/`.uk` transfers\n * aren't supported via the API.\n */\n override async transferIn(\n domainName: string,\n input: TransferDomainInput,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const pricing = await this.tldPricing(extractTld(domainName), opts);\n if (pricing.transfer == null) {\n throw new Error(`${this.name}: could not determine the transfer price for ${domainName}`);\n }\n const res = await this.call(\n `/domain/transfer/${encodeURIComponent(domainName)}`,\n { authCode: input.authCode, cost: toPennies(pricing.transfer) },\n opts\n );\n return statusResult(res, `Domain ${domainName} transfer requested successfully`);\n }\n\n /**\n * Updates contact roles. Only the roles present in `contacts` are changed;\n * unspecified roles are left as-is. Porkbun splits the phone into a national\n * number plus a numeric country code, and runs Google Address Validation on\n * registrant changes for address-validated TLDs.\n */\n override async updateContacts(\n domainName: string,\n contacts: ContactSet,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const roles: Record<string, PbContact> = {};\n if (contacts.registrant) roles.registrant = toPorkbunContact(contacts.registrant);\n if (contacts.admin) roles.admin = toPorkbunContact(contacts.admin);\n if (contacts.tech) roles.tech = toPorkbunContact(contacts.tech);\n if (contacts.billing) roles.billing = toPorkbunContact(contacts.billing);\n if (Object.keys(roles).length === 0) {\n throw new Error(`${this.name}: updateContacts requires at least one contact role`);\n }\n const res = await this.call(\n `/domain/updateContacts/${encodeURIComponent(domainName)}`,\n { contacts: roles },\n opts\n );\n return statusResult(res, 'Contacts updated successfully');\n }\n\n /**\n * Replaces the entire editable record set (full-replace / PUT semantics):\n * retrieves the current records, deletes them, then creates the supplied set.\n * The apex NS records are Porkbun-managed (it rejects creating NS at the apex\n * and auto-restores its defaults), so they're skipped on both delete and\n * create. Because Porkbun has no atomic \"set all\" endpoint, this issues one\n * call per record.\n */\n override async setDnsRecords(\n domainName: string,\n records: DnsRecord[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const zone = normalizeDomain(domainName);\n const existing = await this.call<PbDnsResponse>(\n `/dns/retrieve/${encodeURIComponent(domainName)}`,\n {},\n opts\n );\n if (!isOk(existing)) return statusResult(existing);\n\n for (const r of existing.records ?? []) {\n if (isApexNs(r.type, r.name, zone) || r.id == null) continue;\n const del = await this.call(\n `/dns/delete/${encodeURIComponent(domainName)}/${r.id}`,\n {},\n opts\n );\n if (!isOk(del)) return statusResult(del);\n }\n\n for (const record of records) {\n const name = relativeName(record.name, domainName);\n const type = record.type.toUpperCase();\n if (type === 'NS' && (name === '@' || name === '')) continue; // apex NS is managed by Porkbun\n const create = await this.call(\n `/dns/create/${encodeURIComponent(domainName)}`,\n toPorkbunDnsRecord(record, name, type),\n opts\n );\n if (!isOk(create)) return statusResult(create);\n }\n return { success: true, message: 'DNS records updated successfully' };\n }\n\n // --- extended capabilities ---------------------------------------------\n\n /**\n * DNSSEC status via dns/getDnssecRecords, which returns DS records keyed by key\n * tag (or `null` when there are none). A non-empty set means DNSSEC is enabled.\n */\n override async getDnssec(domainName: string, opts?: RequestOptions): Promise<DnssecStatus> {\n const res = await this.call<PbDnssecResponse>(\n `/dns/getDnssecRecords/${encodeURIComponent(domainName)}`,\n {},\n opts\n );\n if (!isOk(res)) throw new Error(res.message ?? 'API request failed');\n const dsRecords = Object.values(res.records ?? {}).map(r => ({\n keyTag: Number(r.keyTag) || 0,\n algorithm: Number(r.alg) || 0,\n digestType: Number(r.digestType) || 0,\n digest: r.digest ?? '',\n }));\n return { enabled: dsRecords.length > 0, dsRecords };\n }\n\n /**\n * Disable DNSSEC by removing every DS record. Porkbun has no single \"off\" call,\n * so read the current records and delete each by its key tag.\n */\n override async disableDnssec(\n domainName: string,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n try {\n const res = await this.call<PbDnssecResponse>(\n `/dns/getDnssecRecords/${encodeURIComponent(domainName)}`,\n {},\n opts\n );\n if (!isOk(res)) return statusResult(res);\n for (const keyTag of Object.keys(res.records ?? {})) {\n const del = await this.call(\n `/dns/deleteDnssecRecord/${encodeURIComponent(domainName)}/${encodeURIComponent(keyTag)}`,\n {},\n opts\n );\n if (!isOk(del)) return statusResult(del);\n }\n return { success: true, message: 'DNSSEC disabled successfully' };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n /**\n * Read URL forwarding via domain/getUrlForwarding. Porkbun forwards per\n * subdomain (\"\" = apex), so each rule maps to a DomainForward with `host` set\n * to the subdomain (or \"@\" at the apex).\n */\n override async getDomainForwarding(\n domainName: string,\n opts?: RequestOptions\n ): Promise<DomainForward[]> {\n const res = await this.call<PbUrlForwardResponse>(\n `/domain/getUrlForwarding/${encodeURIComponent(domainName)}`,\n {},\n opts\n );\n if (!isOk(res)) throw new Error(res.message ?? 'API request failed');\n return (res.forwards ?? []).map(f => ({\n host: f.subdomain || '@',\n url: f.location ?? '',\n type: PB_TYPE_TO_FORWARD[(f.type ?? '').toLowerCase()] ?? 'permanent',\n }));\n }\n\n /**\n * Replace URL forwarding (full replace; an empty list clears it). Porkbun has\n * no bulk set, so delete every existing forward by id, then add each desired\n * one via domain/addUrlForward.\n */\n override async setDomainForwarding(\n domainName: string,\n forwards: DomainForward[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n try {\n const settable = settableForwards(forwards); // reject masked before any write\n const enc = encodeURIComponent(domainName);\n const existing = await this.call<PbUrlForwardResponse>(\n `/domain/getUrlForwarding/${enc}`,\n {},\n opts\n );\n if (!isOk(existing)) return statusResult(existing);\n for (const f of existing.forwards ?? []) {\n if (f.id == null) continue;\n const del = await this.call(\n `/domain/deleteUrlForward/${enc}/${encodeURIComponent(f.id)}`,\n {},\n opts\n );\n if (!isOk(del)) return statusResult(del);\n }\n for (const f of settable) {\n const add = await this.call(\n `/domain/addUrlForward/${enc}`,\n {\n subdomain: f.host === '@' ? '' : f.host,\n location: f.url,\n type: FORWARD_TO_PB_TYPE[f.type],\n includePath: 'no',\n wildcard: 'no',\n },\n opts\n );\n if (!isOk(add)) return statusResult(add);\n }\n return { success: true, message: 'Domain forwarding updated successfully' };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n}\n\n// whether the response status is \"SUCCESS\"\nfunction isOk(res: PbResponse): boolean {\n return res.status === 'SUCCESS';\n}\n\n// map a response's status to an OperationResult\nfunction statusResult(res: PbResponse, successMessage = 'SUCCESS'): OperationResult {\n if (isOk(res)) return { success: true, message: res.message ?? successMessage };\n return { success: false, message: res.message ?? 'Unknown response' };\n}\n\n// map a bulk/per-domain response (e.g. updateAutoRenew) to an OperationResult.\n// The top-level status can be SUCCESS while the per-domain entry failed, so the\n// real outcome is read from results[domain].\nfunction bulkResult(\n res: PbBulkResponse,\n domainName: string,\n successMessage: string\n): OperationResult {\n const entry = res.results?.[domainName];\n if (isOk(res) && (!entry || entry.status === 'SUCCESS')) {\n return { success: true, message: entry?.message ?? successMessage };\n }\n return { success: false, message: entry?.message ?? res.message ?? 'Unknown response' };\n}\n\n// Porkbun booleans arrive as \"1\"/\"0\" (sometimes numbers) — normalize to boolean\nfunction isYes(value: string | number | undefined): boolean {\n return value === '1' || value === 1 || value === 'yes';\n}\n\n// reduce a TLD or full domain to its bare TLD (no leading dot, lowercased). A\n// multi-label TLD (e.g. \"co.uk\") is preserved by taking everything after the\n// first label of a full domain.\nfunction extractTld(tldOrDomain: string): string {\n const value = tldOrDomain.trim().toLowerCase().replace(/^\\.+/, '');\n return value.includes('.') ? value.slice(value.indexOf('.') + 1) : value;\n}\n\n// convert major USD units (e.g. 11.08) to integer pennies (1108), as Porkbun's\n// `cost` field requires\nfunction toPennies(major: number): number {\n return Math.round(major * 100);\n}\n\n// whether a record is an apex NS record (Porkbun-managed: can't be created and\n// auto-restores, so setDnsRecords must leave it alone). `name` may be the\n// fully-qualified host from a retrieve, or \"@\"/\"\" for the apex.\nfunction isApexNs(type: string | undefined, name: string | undefined, zone: string): boolean {\n if ((type ?? '').toUpperCase() !== 'NS') return false;\n const n = normalizeDomain(name ?? '');\n return n === zone || n === '' || name === '@';\n}\n\n// map a normalized DnsRecord to a Porkbun dns/create body. `name` is already the\n// zone-relative host (\"@\"/\"\" at the apex); Porkbun wants the bare subdomain\n// (empty string at the apex). SRV data is packed as \"<weight> <port> <target>\".\nfunction toPorkbunDnsRecord(\n record: DnsRecord,\n name: string,\n type: string\n): Record<string, unknown> {\n const body: Record<string, unknown> = {\n name: name === '@' ? '' : name,\n type,\n content: record.value,\n };\n if (record.ttl != null) body.ttl = String(record.ttl);\n if (record.priority != null) body.prio = String(record.priority);\n if (type === 'SRV') {\n body.content = `${record.weight ?? 0} ${record.port ?? 0} ${record.value}`;\n }\n return body;\n}\n\n// map the library's Contact to Porkbun's shape, splitting the international\n// phone (\"+1.4805551234\") into a national number + numeric country code\nfunction toPorkbunContact(c: Contact): PbContact {\n const { countryCode, national } = splitPhone(c.phone);\n const contact: PbContact = {\n firstName: c.firstName,\n lastName: c.lastName,\n email: c.email,\n phone: national,\n phoneCountryCode: countryCode,\n address1: c.address1,\n city: c.city,\n postalCode: c.postalCode,\n country: c.country,\n };\n if (c.organization) contact.organization = c.organization;\n if (c.address2) contact.address2 = c.address2;\n if (c.state) contact.state = c.state;\n return contact;\n}\n\n// split an international phone (\"+1.4805551234\" — \"+<cc>.<national>\") into its\n// numeric country code and national number (digits only). Falls back gracefully\n// for values without the leading \"+\" or the \".\" separator.\nfunction splitPhone(phone: string): { countryCode: string; national: string } {\n const trimmed = (phone ?? '').trim();\n const dot = trimmed.indexOf('.');\n if (trimmed.startsWith('+') && dot > 1) {\n return {\n countryCode: trimmed.slice(1, dot).replace(/\\D/g, ''),\n national: trimmed.slice(dot + 1).replace(/\\D/g, ''),\n };\n }\n // no recognizable separator: return all digits as the national number\n return { countryCode: '', national: trimmed.replace(/\\D/g, '') };\n}\n\n// parse a Porkbun price string (major USD units) into a number, or undefined\nfunction toPrice(value: string | undefined): number | undefined {\n if (value == null || value === '') return undefined;\n const n = Number(value);\n return Number.isFinite(n) ? n : undefined;\n}\n\n// convert a Porkbun fully-qualified record name to a name relative to the zone\n// apex (\"@\" at the apex), matching the DnsRecord contract.\nfunction relativeName(name: string, domainName: string): string {\n const fqdn = normalizeDomain(name);\n const zone = normalizeDomain(domainName);\n if (fqdn === zone || fqdn === '') return '@';\n if (fqdn.endsWith(`.${zone}`)) return fqdn.slice(0, -(zone.length + 1));\n return fqdn;\n}\n\n// map a Porkbun DNS record to the normalized DnsRecord shape. Porkbun stores SRV\n// data as prio=priority and content=\"weight port target\"; other types put their\n// value in `content`.\nfunction toDnsRecord(r: PbDnsRecord, domainName: string): DnsRecord {\n const type = (r.type ?? '').toUpperCase();\n const record: DnsRecord = {\n type,\n name: relativeName(r.name ?? '', domainName),\n value: r.content ?? '',\n };\n if (r.ttl != null && r.ttl !== '') {\n const ttl = Number(r.ttl);\n if (Number.isFinite(ttl)) record.ttl = ttl;\n }\n const prio = r.prio != null && r.prio !== '' ? Number(r.prio) : NaN;\n if ((type === 'MX' || type === 'SRV') && Number.isFinite(prio)) {\n record.priority = prio;\n }\n if (type === 'SRV') {\n // content is \"<weight> <port> <target>\"\n const parts = (r.content ?? '').trim().split(/\\s+/);\n if (parts.length === 3) {\n const weight = Number(parts[0]);\n const port = Number(parts[1]);\n if (Number.isFinite(weight)) record.weight = weight;\n if (Number.isFinite(port)) record.port = port;\n record.value = parts[2];\n }\n }\n return record;\n}\n","import type {\n ConfigField,\n ConnectionResult,\n Contact,\n ContactSet,\n DnsRecord,\n Domain,\n DomainAvailability,\n ListDomainsOptions,\n OperationResult,\n RegisterDomainInput,\n RegistrarOptions,\n RequestOptions,\n TldPricing,\n TransferDomainInput,\n} from '../types';\nimport { createDomain, filterDomains, requireConsent, sleep } from '../utils';\nimport { NotImplementedError, toRegistrarError } from '../errors';\nimport { BaseRegistrar, selectBaseUrl } from '../registrar';\nimport { Feature, type RegistrarFeature } from '../features';\nimport type { RegistrarCredentials } from '../types';\n\ninterface SpaceshipNameservers {\n provider?: string;\n hosts?: string[];\n}\n\ninterface SpaceshipPrivacy {\n contactForm?: boolean;\n level?: string; // \"public\" | \"high\"\n}\n\ninterface SpaceshipDomainContacts {\n registrant?: string;\n admin?: string;\n tech?: string;\n billing?: string;\n}\n\ninterface SpaceshipDomain {\n name: string;\n unicodeName?: string;\n isPremium?: boolean;\n autoRenew?: boolean;\n registrationDate?: string;\n expirationDate?: string;\n lifecycleStatus?: string;\n eppStatuses?: string[];\n privacyProtection?: SpaceshipPrivacy;\n nameservers?: SpaceshipNameservers;\n contacts?: SpaceshipDomainContacts;\n}\n\ninterface SpaceshipPage<T> {\n items?: T[];\n total?: number;\n}\n\n// one premium price point from an availability check\ninterface SpaceshipPremiumPrice {\n operation?: string; // \"register\" | \"transfer\" | \"renew\" | \"restore\"\n price?: number;\n currency?: string;\n}\n\ninterface SpaceshipAvailability {\n domain?: string;\n result?: string; // \"available\" | \"taken\" | \"invalidDomainName\" | ...\n premiumPricing?: SpaceshipPremiumPrice[];\n}\n\n// a contact record (ContactDetails)\ninterface SpaceshipContact {\n firstName?: string;\n lastName?: string;\n organization?: string;\n email?: string;\n address1?: string;\n address2?: string;\n city?: string;\n stateProvince?: string;\n postalCode?: string;\n country?: string;\n phone?: string;\n phoneExt?: string;\n fax?: string;\n}\n\n// a DNS record (ResourceRecord — a discriminated union on `type`)\ninterface SpaceshipRecord {\n type?: string;\n name?: string;\n ttl?: number;\n group?: { type?: string }; // \"custom\" | \"product\" | \"personalNs\" (read-only)\n address?: string; // A / AAAA\n cname?: string; // CNAME\n nameserver?: string; // NS\n value?: string; // TXT / CAA\n exchange?: string; // MX\n preference?: number; // MX priority\n target?: string; // SRV / ALIAS\n priority?: number; // SRV\n weight?: number; // SRV\n port?: number; // SRV\n}\n\n// DNS types this provider can write from our generic DnsRecord shape. Others\n// (SRV, CAA, HTTPS, …) need sub-fields our record doesn't carry, so writing them\n// throws rather than sending an incomplete record. Reads handle every type.\nconst WRITABLE_DNS_TYPES = new Set(['A', 'AAAA', 'CNAME', 'NS', 'TXT', 'MX']);\n\n/**\n * Spaceship Registrar\n * API docs: https://docs.spaceship.dev/\n *\n * Credentials: generate an API key + secret in the Spaceship API Manager\n * (\"New API key\"). Both are sent as X-Api-Key and X-Api-Secret headers.\n *\n * Modern REST/JSON API (`/api/v1`). A few operations are asynchronous — register,\n * transfer, and renew return `202` with a `spaceship-async-operationid` header\n * and complete out of band (poll `GET /async-operations/{id}`); the rest are\n * synchronous 2xx/204.\n *\n * `registerDomain`/`transferIn` are implemented (async, 202) and require\n * per-call `consent`; they spend real money and haven't been exercised against a\n * funded account, so treat them as documented-but-unverified.\n *\n * `getPricing` is overridden to throw a specific error: Spaceship exposes no\n * pricing endpoint at all (only per-domain premium prices via an availability\n * check), so there's no TLD price to return.\n */\nexport class SpaceshipRegistrar extends BaseRegistrar {\n readonly name = 'spaceship';\n\n static readonly displayName = 'Spaceship';\n static readonly website = 'spaceship.com';\n static readonly helpText =\n 'Generate your API key and secret in the API Manager at Spaceship using the ' +\n '\"New API key\" button. The API requires both X-API-Key and X-API-Secret headers.';\n static readonly configFields: ConfigField[] = [\n { name: 'apiKey', label: 'API Key', type: 'password', required: true },\n { name: 'apiSecret', label: 'API Secret', type: 'password', required: true },\n ];\n static readonly supportsSandbox = false; // Spaceship has no public sandbox environment\n // Modern REST API. Beyond core: transfer-out auth-code retrieval\n // (GET .../transfer/auth-code). No DNSSEC or forwarding via the API; Spacemail\n // (email) has no public API.\n static readonly extendedFeatures: readonly RegistrarFeature[] = [Feature.GetAuthCode];\n\n constructor(credentials: RegistrarCredentials, options?: RegistrarOptions) {\n super(\n credentials,\n {\n baseUrl: selectBaseUrl('Spaceship', options?.environment, {\n production: 'https://spaceship.dev/api',\n }),\n headers: {\n 'X-API-Key': credentials.apiKey,\n 'X-API-Secret': credentials.apiSecret,\n 'Content-Type': 'application/json',\n },\n },\n options\n );\n }\n\n override async testConnection(opts?: RequestOptions): Promise<ConnectionResult> {\n try {\n await this.http.request<SpaceshipPage<SpaceshipDomain>>({\n path: '/v1/domains',\n query: { take: 1, skip: 0 },\n ...opts,\n });\n return { success: true, message: 'Connection successful' };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n override async listDomains(opts?: ListDomainsOptions): Promise<Domain[]> {\n // No server-side name filter on this endpoint, so `search` is client-side.\n const { search, ...reqOpts } = opts ?? {};\n const domains: Domain[] = [];\n const take = 100; // Spaceship API maximum page size (1-100)\n let skip = 0;\n let hasMore = true;\n\n while (hasMore) {\n const res = await this.http.request<SpaceshipPage<SpaceshipDomain>>({\n path: '/v1/domains',\n query: { take, skip },\n ...reqOpts,\n });\n const list = res.items ?? [];\n for (const d of list) domains.push(this.toDomain(d));\n hasMore = list.length === take;\n skip += take;\n if (hasMore) await sleep(200); // gentle rate limiting between pages\n }\n return filterDomains(domains, search);\n }\n\n override async getDomain(domainName: string, opts?: RequestOptions): Promise<Domain> {\n return this.toDomain(await this.getRaw(domainName, opts));\n }\n\n override async getNameservers(domainName: string, opts?: RequestOptions): Promise<string[]> {\n const d = await this.getRaw(domainName, opts);\n return d.nameservers?.hosts ?? [];\n }\n\n /**\n * Transfer authorization (EPP) code via GET /v1/domains/{domain}/transfer/auth-code.\n * Synchronous; the code is returned in `authCode`. Requires the API key to\n * carry the `domains:transfer` scope.\n */\n override async getAuthCode(domainName: string, opts?: RequestOptions): Promise<string> {\n const res = await this.http.request<{ authCode?: string }>({\n path: `/v1/domains/${encodeURIComponent(domainName)}/transfer/auth-code`,\n ...opts,\n });\n return res.authCode ?? '';\n }\n\n /**\n * Bulk availability via POST /v1/domains/available. Spaceship reports a `result`\n * enum (not a bool) and only carries a price for *premium* names, so `price` is\n * set from the premium \"register\" price when present.\n */\n override async checkAvailability(\n domainNames: string[],\n opts?: RequestOptions\n ): Promise<DomainAvailability[]> {\n const res = await this.http.request<{ domains?: SpaceshipAvailability[] }>({\n method: 'POST',\n path: '/v1/domains/available',\n body: { domains: domainNames },\n ...opts,\n });\n return (res.domains ?? []).map(a => {\n const premium = (a.premiumPricing?.length ?? 0) > 0;\n const registerPrice = a.premiumPricing?.find(p => p.operation === 'register');\n return {\n domainName: a.domain ?? '',\n available: a.result === 'available',\n premium,\n price: registerPrice?.price,\n currency: registerPrice?.currency,\n };\n });\n }\n\n override getPricing(_tldOrDomain: string, _opts?: RequestOptions): Promise<TldPricing> {\n return Promise.reject(\n new NotImplementedError(\n `${this.name}: getPricing is not available — Spaceship exposes no pricing endpoint ` +\n '(only per-domain premium prices via an availability check)'\n )\n );\n }\n\n /**\n * Registers a domain. Contacts are separate resources, so this saves each\n * supplied contact (getting an id) and references the ids on the domain;\n * omitted roles fall back to the registrant. Registration is async (202).\n */\n override async registerDomain(\n domainName: string,\n input: RegisterDomainInput,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n requireConsent(this.name, input.consent);\n if (!input.contacts.registrant) {\n throw new Error(`${this.name}: registration requires at least a registrant contact`);\n }\n try {\n const contacts = await this.saveContactSet(input.contacts, opts);\n const body = {\n autoRenew: input.autoRenew ?? false,\n years: input.years ?? 1,\n privacyProtection: { level: input.privacy ? 'high' : 'public', userConsent: true },\n contacts,\n };\n await this.http.request({\n method: 'POST',\n path: `/v1/domains/${encodeURIComponent(domainName)}`,\n body,\n ...opts,\n });\n return { success: true, message: `Domain ${domainName} registration requested successfully` };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n /**\n * Transfers a domain in with its auth code. Contacts are optional (Spaceship\n * carries over the existing registration's where not supplied); when given,\n * they're saved and referenced by id. Async (202).\n */\n override async transferIn(\n domainName: string,\n input: TransferDomainInput,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n requireConsent(this.name, input.consent);\n try {\n const body: Record<string, unknown> = {\n authCode: input.authCode,\n autoRenew: input.autoRenew ?? false,\n };\n if (input.privacy != null) {\n body.privacyProtection = { level: input.privacy ? 'high' : 'public', userConsent: true };\n }\n if (input.contacts) body.contacts = await this.saveContactSet(input.contacts, opts);\n await this.http.request({\n method: 'POST',\n path: `/v1/domains/${encodeURIComponent(domainName)}/transfer`,\n body,\n ...opts,\n });\n return { success: true, message: `Domain ${domainName} transfer requested successfully` };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n /**\n * Renewal is async (202 + operation id). Spaceship requires the current\n * expiration date as a guard, so this fetches the domain first to supply it.\n */\n override async renewDomain(\n domainName: string,\n years = 1,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const d = await this.getRaw(domainName, opts);\n if (!d.expirationDate) {\n throw new Error(`Spaceship: could not determine current expiration date for ${domainName}`);\n }\n return this.mutate(\n {\n method: 'POST',\n path: `/v1/domains/${encodeURIComponent(domainName)}/renew`,\n body: { years, currentExpirationDate: d.expirationDate },\n },\n 'Domain renewal requested successfully',\n opts\n );\n }\n\n override async setAutoRenew(\n domainName: string,\n enabled: boolean,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.mutate(\n {\n method: 'PUT',\n path: `/v1/domains/${encodeURIComponent(domainName)}/autorenew`,\n body: { isEnabled: enabled },\n },\n `Auto-renew ${enabled ? 'enabled' : 'disabled'} successfully`,\n opts\n );\n }\n\n override async updateNameservers(\n domainName: string,\n nameservers: string[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.mutate(\n {\n method: 'PUT',\n path: `/v1/domains/${encodeURIComponent(domainName)}/nameservers`,\n // custom nameservers go under a provider wrapper\n body: { provider: 'custom', hosts: nameservers },\n },\n 'Nameservers updated successfully',\n opts\n );\n }\n\n override async lockDomain(domainName: string, opts?: RequestOptions): Promise<OperationResult> {\n return this.mutate(\n {\n method: 'PUT',\n path: `/v1/domains/${encodeURIComponent(domainName)}/transfer/lock`,\n body: { isLocked: true },\n },\n 'Domain transfer lock enabled successfully',\n opts\n );\n }\n\n override async unlockDomain(domainName: string, opts?: RequestOptions): Promise<OperationResult> {\n return this.mutate(\n {\n method: 'PUT',\n path: `/v1/domains/${encodeURIComponent(domainName)}/transfer/lock`,\n body: { isLocked: false },\n },\n 'Domain transfer lock disabled successfully',\n opts\n );\n }\n\n /**\n * WHOIS privacy via the privacy preference (`public` = details visible, `high`\n * = protected). Enabling requires consent, which calling this with\n * `enabled = true` supplies.\n */\n override async setPrivacy(\n domainName: string,\n enabled: boolean,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n return this.mutate(\n {\n method: 'PUT',\n path: `/v1/domains/${encodeURIComponent(domainName)}/privacy/preference`,\n body: { privacyLevel: enabled ? 'high' : 'public', userConsent: enabled },\n },\n `Privacy ${enabled ? 'enabled' : 'disabled'} successfully`,\n opts\n );\n }\n\n override async getContacts(domainName: string, opts?: RequestOptions): Promise<ContactSet> {\n const d = await this.getRaw(domainName, opts);\n const refs = d.contacts ?? {};\n // contacts are referenced by id; resolve each present role in parallel\n const [registrant, admin, tech, billing] = await Promise.all([\n this.getContact(refs.registrant, opts),\n this.getContact(refs.admin, opts),\n this.getContact(refs.tech, opts),\n this.getContact(refs.billing, opts),\n ]);\n return { registrant, admin, tech, billing };\n }\n\n /**\n * Two-step: save each supplied contact (which returns a contact id), then\n * assign the ids to the domain. Spaceship requires a registrant on assignment,\n * so any omitted role falls back to the registrant.\n */\n override async updateContacts(\n domainName: string,\n contacts: ContactSet,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n if (!contacts.registrant) {\n throw new Error(`${this.name}: updateContacts requires at least a registrant contact`);\n }\n try {\n const contactIds = await this.saveContactSet(contacts, opts);\n await this.http.request({\n method: 'PUT',\n path: `/v1/domains/${encodeURIComponent(domainName)}/contacts`,\n body: contactIds,\n ...opts,\n });\n return { success: true, message: 'Contacts updated successfully' };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n override async getDnsRecords(domainName: string, opts?: RequestOptions): Promise<DnsRecord[]> {\n const records = await this.fetchRecords(domainName, opts);\n return records.map(toDnsRecord);\n }\n\n /**\n * Spaceship's DNS API is upsert-based (PUT adds/updates; there is no atomic\n * replace). To honor replace semantics, this upserts the new set, then deletes\n * any custom records whose (type, name) is no longer present — done in that\n * order so the zone is never momentarily empty. Only the common record types\n * are writable from the generic shape (see `WRITABLE_DNS_TYPES`).\n */\n override async setDnsRecords(\n domainName: string,\n records: DnsRecord[],\n opts?: RequestOptions\n ): Promise<OperationResult> {\n const items = records.map(toSpaceshipRecord);\n try {\n const existing = await this.fetchRecords(domainName, opts);\n\n // The upsert endpoint rejects an empty `items` array (422), so skip it when\n // there's nothing to add/replace — clearing a zone is then handled entirely\n // by the stale-delete pass below.\n if (items.length > 0) {\n await this.http.request({\n method: 'PUT',\n path: `/v1/dns/records/${encodeURIComponent(domainName)}`,\n body: { force: true, items },\n ...opts,\n });\n }\n\n // delete custom records whose (type, name) no longer appears in the new\n // set. Spaceship's delete endpoint matches on the full record, so it needs\n // each record's value field (address/cname/value/exchange/…) — send the\n // existing records with only the read-only `group` metadata stripped.\n const keep = new Set(items.map(r => recordKey(r.type, r.name)));\n const stale = existing\n .filter(r => (r.group?.type ?? 'custom') === 'custom')\n .filter(r => !keep.has(recordKey(r.type, r.name)))\n .map(({ group: _group, ...rr }) => rr);\n if (stale.length > 0) {\n await this.http.request({\n method: 'DELETE',\n path: `/v1/dns/records/${encodeURIComponent(domainName)}`,\n body: stale,\n ...opts,\n });\n }\n return { success: true, message: 'DNS records updated successfully' };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n\n // --- internal helpers ---\n\n // GET a single domain's raw payload\n private getRaw(domainName: string, opts?: RequestOptions): Promise<SpaceshipDomain> {\n return this.http.request<SpaceshipDomain>({\n path: `/v1/domains/${encodeURIComponent(domainName)}`,\n ...opts,\n });\n }\n\n // resolve one contact id to a normalized Contact (undefined if unset)\n private async getContact(\n id: string | undefined,\n opts?: RequestOptions\n ): Promise<Contact | undefined> {\n if (!id) return undefined;\n const c = await this.http.request<SpaceshipContact>({\n path: `/v1/contacts/${encodeURIComponent(id)}`,\n ...opts,\n });\n return fromSpaceshipContact(c);\n }\n\n // save all four contact roles and return their ids (Spaceship requires a\n // registrant; omitted roles fall back to it)\n private async saveContactSet(\n contacts: ContactSet,\n opts?: RequestOptions\n ): Promise<SpaceshipDomainContacts> {\n if (!contacts.registrant) {\n throw new Error(`${this.name}: a registrant contact is required`);\n }\n const registrant = await this.saveContact(contacts.registrant, opts);\n return {\n registrant,\n admin: contacts.admin ? await this.saveContact(contacts.admin, opts) : registrant,\n tech: contacts.tech ? await this.saveContact(contacts.tech, opts) : registrant,\n billing: contacts.billing ? await this.saveContact(contacts.billing, opts) : registrant,\n };\n }\n\n // save a contact and return its Spaceship contact id\n private async saveContact(contact: Contact, opts?: RequestOptions): Promise<string> {\n const res = await this.http.request<{ contactId: string }>({\n method: 'PUT',\n path: '/v1/contacts',\n body: toSpaceshipContact(contact),\n ...opts,\n });\n return res.contactId;\n }\n\n // fetch all DNS records for a domain (paginated; take/skip are required)\n private async fetchRecords(\n domainName: string,\n opts?: RequestOptions\n ): Promise<SpaceshipRecord[]> {\n const records: SpaceshipRecord[] = [];\n const take = 100;\n let skip = 0;\n let hasMore = true;\n while (hasMore) {\n const res = await this.http.request<SpaceshipPage<SpaceshipRecord>>({\n path: `/v1/dns/records/${encodeURIComponent(domainName)}`,\n query: { take, skip },\n ...opts,\n });\n const items = res.items ?? [];\n records.push(...items);\n hasMore = items.length === take;\n skip += take;\n if (hasMore) await sleep(200);\n }\n return records;\n }\n\n // map a Spaceship domain payload to the normalized Domain shape\n private toDomain(d: SpaceshipDomain): Domain {\n return createDomain({\n domainName: d.name,\n registrar: this.name,\n status: d.lifecycleStatus ?? '',\n createdDate: d.registrationDate,\n expirationDate: d.expirationDate,\n renewalDate: d.expirationDate,\n autoRenew: d.autoRenew ?? false,\n // transfer lock shows up as an EPP status, not a dedicated flag\n locked: (d.eppStatuses ?? []).includes('clientTransferProhibited'),\n privacy: d.privacyProtection?.level === 'high',\n // normalizeNameservers understands the { hosts } shape\n nameservers: d.nameservers,\n });\n }\n\n // run a mutating request; success is any 2xx (async ops return 202)\n private async mutate(\n req: { method: string; path: string; body?: unknown },\n successMessage: string,\n opts?: RequestOptions\n ): Promise<OperationResult> {\n try {\n await this.http.request({ ...req, ...opts });\n return { success: true, message: successMessage };\n } catch (error) {\n return { success: false, message: toRegistrarError(error).message };\n }\n }\n}\n\n// --- record mapping between Spaceship's per-type shape and our DnsRecord ---\n\n// extract the primary value for a Spaceship record based on its type\nfunction spaceshipRecordValue(r: SpaceshipRecord, type: string): string {\n switch (type) {\n case 'A':\n case 'AAAA':\n return r.address ?? '';\n case 'CNAME':\n return r.cname ?? '';\n case 'NS':\n return r.nameserver ?? '';\n case 'MX':\n return r.exchange ?? '';\n case 'SRV':\n case 'ALIAS':\n return r.target ?? '';\n default:\n return r.value ?? '';\n }\n}\n\nfunction toDnsRecord(r: SpaceshipRecord): DnsRecord {\n const type = (r.type ?? '').toUpperCase();\n const record: DnsRecord = { type, name: r.name ?? '', value: spaceshipRecordValue(r, type) };\n if (r.ttl != null) record.ttl = r.ttl;\n if (type === 'MX' && r.preference != null) record.priority = r.preference;\n if (type === 'SRV') {\n if (r.priority != null) record.priority = r.priority;\n if (r.weight != null) record.weight = r.weight;\n if (r.port != null) record.port = r.port;\n }\n return record;\n}\n\nfunction toSpaceshipRecord(r: DnsRecord): SpaceshipRecord {\n const type = r.type.toUpperCase();\n if (!WRITABLE_DNS_TYPES.has(type)) {\n throw new Error(`Spaceship: writing DNS record type '${type}' is not supported`);\n }\n const record: SpaceshipRecord = { type, name: r.name || '@' };\n if (r.ttl != null) record.ttl = r.ttl;\n switch (type) {\n case 'A':\n case 'AAAA':\n record.address = r.value;\n break;\n case 'CNAME':\n record.cname = r.value;\n break;\n case 'NS':\n record.nameserver = r.value;\n break;\n case 'MX':\n record.exchange = r.value;\n record.preference = r.priority ?? 10;\n break;\n default: // TXT\n record.value = r.value;\n }\n return record;\n}\n\n// a stable key for a (type, name) pair, for set membership\nfunction recordKey(type: string | undefined, name: string | undefined): string {\n return `${(type ?? '').toUpperCase()}\\x00${name ?? '@'}`;\n}\n\n// --- contact mapping between Spaceship's shape and the normalized Contact ---\n\nfunction fromSpaceshipContact(c: SpaceshipContact): Contact {\n return {\n firstName: c.firstName ?? '',\n lastName: c.lastName ?? '',\n organization: c.organization,\n email: c.email ?? '',\n phone: c.phone ?? '',\n fax: c.fax,\n address1: c.address1 ?? '',\n address2: c.address2,\n city: c.city ?? '',\n state: c.stateProvince,\n postalCode: c.postalCode ?? '',\n country: c.country ?? '',\n };\n}\n\nfunction toSpaceshipContact(c: Contact): SpaceshipContact {\n return {\n firstName: c.firstName,\n lastName: c.lastName,\n organization: c.organization,\n email: c.email,\n phone: c.phone,\n fax: c.fax,\n address1: c.address1,\n address2: c.address2,\n city: c.city,\n stateProvince: c.state,\n postalCode: c.postalCode,\n country: c.country,\n };\n}\n","import type {\n Registrar,\n RegistrarConstructor,\n RegistrarCredentials,\n RegistrarOptions,\n} from '../types';\nimport { CloudflareRegistrar } from './cloudflare';\nimport { DynadotRegistrar } from './dynadot';\nimport { GandiRegistrar } from './gandi';\nimport { GoDaddyRegistrar } from './godaddy';\nimport { NameBrightRegistrar } from './namebright';\nimport { NamecheapRegistrar } from './namecheap';\nimport { NameSiloRegistrar } from './namesilo';\nimport { PorkbunRegistrar } from './porkbun';\nimport { SpaceshipRegistrar } from './spaceship';\n\n// the built-in registrar providers, keyed by id\nexport const registrars = {\n cloudflare: CloudflareRegistrar,\n dynadot: DynadotRegistrar,\n gandi: GandiRegistrar,\n godaddy: GoDaddyRegistrar,\n namebright: NameBrightRegistrar,\n namecheap: NamecheapRegistrar,\n namesilo: NameSiloRegistrar,\n porkbun: PorkbunRegistrar,\n spaceship: SpaceshipRegistrar,\n} satisfies Record<string, RegistrarConstructor>;\n\n// id of a built-in registrar\nexport type RegistrarName = keyof typeof registrars;\n\n// construct a registrar provider by id\nexport function createRegistrar(\n name: RegistrarName,\n credentials: RegistrarCredentials,\n options?: RegistrarOptions\n): Registrar {\n const RegistrarClass = registrars[name];\n return new RegistrarClass(credentials, options);\n}\n"]}
|