@aoxborrow/registrar-client 0.2.0 → 0.3.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 CHANGED
@@ -4,6 +4,7 @@
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
5
  [![Node.js](https://img.shields.io/badge/node-%3E%3D20.0.0-brightgreen.svg)](https://nodejs.org)
6
6
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.9-blue.svg)](https://www.typescriptlang.org)
7
+ [![Sponsor](https://img.shields.io/badge/Sponsor-%E2%9D%A4-ea4aaa?logo=githubsponsors&logoColor=white)](https://github.com/sponsors/aoxborrow)
7
8
 
8
9
  > One consistent, fully-typed TypeScript interface to many domain registrar APIs.
9
10
 
package/dist/index.cjs CHANGED
@@ -258,7 +258,7 @@ var RegistrarClient = class {
258
258
  try {
259
259
  const detail = await this.provider.getDomain(name, opts);
260
260
  let merged = { ...domains[index], ...detail };
261
- if (merged.nameservers.length === 0) {
261
+ if (merged.nameservers.length === 0 && this.provider.requiresNameserversFetch) {
262
262
  try {
263
263
  const nameservers = normalizeNameservers(
264
264
  await this.provider.getNameservers(name, opts)
@@ -646,6 +646,11 @@ var BaseRegistrar = class {
646
646
  supports(feature) {
647
647
  return this.features.includes(feature);
648
648
  }
649
+ // See Registrar.requiresNameserversFetch. Defaults true, so a provider
650
+ // whose getNameservers hits a real endpoint keeps the enrichment fallback
651
+ // without opting in; the providers whose getNameservers just re-reads getDomain
652
+ // override this to false to drop the redundant call.
653
+ requiresNameserversFetch = true;
649
654
  constructor(credentials, httpConfig, options) {
650
655
  const { environment = "production", ...clientOptions } = options ?? {};
651
656
  this.credentials = credentials;
@@ -1716,6 +1721,9 @@ ${bodyStr}`;
1716
1721
  if (!data.domain_info) throw new NotFoundError(`Dynadot: domain '${domainName}' not found`);
1717
1722
  return data.domain_info;
1718
1723
  }
1724
+ // getNameservers re-reads getDomain (domain_info carries NS inline; no separate
1725
+ // endpoint), so listing enrichment gains nothing from the fallback — skip it.
1726
+ requiresNameserversFetch = false;
1719
1727
  async getNameservers(domainName, opts) {
1720
1728
  const domain = await this.getDomain(domainName, opts);
1721
1729
  return domain.nameservers;
@@ -3159,6 +3167,9 @@ var GoDaddyRegistrar = class _GoDaddyRegistrar extends BaseRegistrar {
3159
3167
  });
3160
3168
  return this.toDomain(d);
3161
3169
  }
3170
+ // getNameservers re-reads getDomain (GoDaddy has no dedicated NS endpoint), so
3171
+ // listing enrichment gains nothing from the fallback — skip it.
3172
+ requiresNameserversFetch = false;
3162
3173
  async getNameservers(domainName, opts) {
3163
3174
  const domain = await this.getDomain(domainName, opts);
3164
3175
  return domain.nameservers;
@@ -5060,6 +5071,9 @@ var NameSiloRegistrar = class extends BaseRegistrar {
5060
5071
  nameservers: extractNsHosts(r.nameservers)
5061
5072
  });
5062
5073
  }
5074
+ // getNameservers re-reads getDomain (getDomainInfo carries NS; no separate
5075
+ // endpoint), so listing enrichment gains nothing from the fallback — skip it.
5076
+ requiresNameserversFetch = false;
5063
5077
  async getNameservers(domainName, opts) {
5064
5078
  const domain = await this.getDomain(domainName, opts);
5065
5079
  return domain.nameservers;
@@ -6301,6 +6315,9 @@ var SpaceshipRegistrar = class extends BaseRegistrar {
6301
6315
  async getDomain(domainName, opts) {
6302
6316
  return this.toDomain(await this.getRaw(domainName, opts));
6303
6317
  }
6318
+ // getNameservers reads the same getRaw payload as getDomain (no dedicated NS
6319
+ // endpoint), so listing enrichment gains nothing from the fallback — skip it.
6320
+ requiresNameserversFetch = false;
6304
6321
  async getNameservers(domainName, opts) {
6305
6322
  const d = await this.getRaw(domainName, opts);
6306
6323
  return d.nameservers?.hosts ?? [];