@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 +1 -0
- package/dist/index.cjs +18 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +18 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
- package/src/client.ts +4 -2
- package/src/registrar.ts +6 -0
- package/src/registrars/dynadot.ts +4 -0
- package/src/registrars/godaddy.ts +4 -0
- package/src/registrars/namesilo.ts +4 -0
- package/src/registrars/spaceship.ts +4 -0
- package/src/types.ts +7 -0
package/dist/index.d.cts
CHANGED
|
@@ -181,6 +181,7 @@ interface Registrar {
|
|
|
181
181
|
readonly name: string;
|
|
182
182
|
readonly environment: RegistrarEnvironment;
|
|
183
183
|
readonly features: readonly RegistrarFeature[];
|
|
184
|
+
readonly requiresNameserversFetch: boolean;
|
|
184
185
|
supports(feature: RegistrarFeature): boolean;
|
|
185
186
|
testConnection(opts?: RequestOptions): Promise<ConnectionResult>;
|
|
186
187
|
listDomains(opts?: ListDomainsOptions): Promise<Domain[]>;
|
|
@@ -361,6 +362,7 @@ declare abstract class BaseRegistrar implements Registrar {
|
|
|
361
362
|
static get features(): readonly RegistrarFeature[];
|
|
362
363
|
get features(): readonly RegistrarFeature[];
|
|
363
364
|
supports(feature: RegistrarFeature): boolean;
|
|
365
|
+
readonly requiresNameserversFetch: boolean;
|
|
364
366
|
constructor(credentials: RegistrarCredentials, httpConfig: Omit<HttpClientConfig, 'options'>, options?: RegistrarOptions);
|
|
365
367
|
testConnection(_opts?: RequestOptions): Promise<ConnectionResult>;
|
|
366
368
|
listDomains(_opts?: ListDomainsOptions): Promise<Domain[]>;
|
|
@@ -450,6 +452,7 @@ declare class DynadotRegistrar extends BaseRegistrar {
|
|
|
450
452
|
listDomains(opts?: ListDomainsOptions): Promise<Domain[]>;
|
|
451
453
|
getDomain(domainName: string, opts?: RequestOptions): Promise<Domain>;
|
|
452
454
|
private domainInfo;
|
|
455
|
+
readonly requiresNameserversFetch = false;
|
|
453
456
|
getNameservers(domainName: string, opts?: RequestOptions): Promise<string[]>;
|
|
454
457
|
getContacts(domainName: string, opts?: RequestOptions): Promise<ContactSet>;
|
|
455
458
|
getDnsRecords(domainName: string, opts?: RequestOptions): Promise<DnsRecord[]>;
|
|
@@ -532,6 +535,7 @@ declare class GoDaddyRegistrar extends BaseRegistrar {
|
|
|
532
535
|
private listDomainsV3;
|
|
533
536
|
private listDomainsV1;
|
|
534
537
|
getDomain(domainName: string, opts?: RequestOptions): Promise<Domain>;
|
|
538
|
+
readonly requiresNameserversFetch = false;
|
|
535
539
|
getNameservers(domainName: string, opts?: RequestOptions): Promise<string[]>;
|
|
536
540
|
checkAvailability(domainNames: string[], opts?: RequestOptions): Promise<DomainAvailability[]>;
|
|
537
541
|
getPricing(tldOrDomain: string, opts?: RequestOptions): Promise<TldPricing>;
|
|
@@ -647,6 +651,7 @@ declare class NameSiloRegistrar extends BaseRegistrar {
|
|
|
647
651
|
testConnection(opts?: RequestOptions): Promise<ConnectionResult>;
|
|
648
652
|
listDomains(opts?: ListDomainsOptions): Promise<Domain[]>;
|
|
649
653
|
getDomain(domainName: string, opts?: RequestOptions): Promise<Domain>;
|
|
654
|
+
readonly requiresNameserversFetch = false;
|
|
650
655
|
getNameservers(domainName: string, opts?: RequestOptions): Promise<string[]>;
|
|
651
656
|
getContacts(domainName: string, opts?: RequestOptions): Promise<ContactSet>;
|
|
652
657
|
getDnsRecords(domainName: string, opts?: RequestOptions): Promise<DnsRecord[]>;
|
|
@@ -716,6 +721,7 @@ declare class SpaceshipRegistrar extends BaseRegistrar {
|
|
|
716
721
|
testConnection(opts?: RequestOptions): Promise<ConnectionResult>;
|
|
717
722
|
listDomains(opts?: ListDomainsOptions): Promise<Domain[]>;
|
|
718
723
|
getDomain(domainName: string, opts?: RequestOptions): Promise<Domain>;
|
|
724
|
+
readonly requiresNameserversFetch = false;
|
|
719
725
|
getNameservers(domainName: string, opts?: RequestOptions): Promise<string[]>;
|
|
720
726
|
getAuthCode(domainName: string, opts?: RequestOptions): Promise<string>;
|
|
721
727
|
checkAvailability(domainNames: string[], opts?: RequestOptions): Promise<DomainAvailability[]>;
|
package/dist/index.d.ts
CHANGED
|
@@ -181,6 +181,7 @@ interface Registrar {
|
|
|
181
181
|
readonly name: string;
|
|
182
182
|
readonly environment: RegistrarEnvironment;
|
|
183
183
|
readonly features: readonly RegistrarFeature[];
|
|
184
|
+
readonly requiresNameserversFetch: boolean;
|
|
184
185
|
supports(feature: RegistrarFeature): boolean;
|
|
185
186
|
testConnection(opts?: RequestOptions): Promise<ConnectionResult>;
|
|
186
187
|
listDomains(opts?: ListDomainsOptions): Promise<Domain[]>;
|
|
@@ -361,6 +362,7 @@ declare abstract class BaseRegistrar implements Registrar {
|
|
|
361
362
|
static get features(): readonly RegistrarFeature[];
|
|
362
363
|
get features(): readonly RegistrarFeature[];
|
|
363
364
|
supports(feature: RegistrarFeature): boolean;
|
|
365
|
+
readonly requiresNameserversFetch: boolean;
|
|
364
366
|
constructor(credentials: RegistrarCredentials, httpConfig: Omit<HttpClientConfig, 'options'>, options?: RegistrarOptions);
|
|
365
367
|
testConnection(_opts?: RequestOptions): Promise<ConnectionResult>;
|
|
366
368
|
listDomains(_opts?: ListDomainsOptions): Promise<Domain[]>;
|
|
@@ -450,6 +452,7 @@ declare class DynadotRegistrar extends BaseRegistrar {
|
|
|
450
452
|
listDomains(opts?: ListDomainsOptions): Promise<Domain[]>;
|
|
451
453
|
getDomain(domainName: string, opts?: RequestOptions): Promise<Domain>;
|
|
452
454
|
private domainInfo;
|
|
455
|
+
readonly requiresNameserversFetch = false;
|
|
453
456
|
getNameservers(domainName: string, opts?: RequestOptions): Promise<string[]>;
|
|
454
457
|
getContacts(domainName: string, opts?: RequestOptions): Promise<ContactSet>;
|
|
455
458
|
getDnsRecords(domainName: string, opts?: RequestOptions): Promise<DnsRecord[]>;
|
|
@@ -532,6 +535,7 @@ declare class GoDaddyRegistrar extends BaseRegistrar {
|
|
|
532
535
|
private listDomainsV3;
|
|
533
536
|
private listDomainsV1;
|
|
534
537
|
getDomain(domainName: string, opts?: RequestOptions): Promise<Domain>;
|
|
538
|
+
readonly requiresNameserversFetch = false;
|
|
535
539
|
getNameservers(domainName: string, opts?: RequestOptions): Promise<string[]>;
|
|
536
540
|
checkAvailability(domainNames: string[], opts?: RequestOptions): Promise<DomainAvailability[]>;
|
|
537
541
|
getPricing(tldOrDomain: string, opts?: RequestOptions): Promise<TldPricing>;
|
|
@@ -647,6 +651,7 @@ declare class NameSiloRegistrar extends BaseRegistrar {
|
|
|
647
651
|
testConnection(opts?: RequestOptions): Promise<ConnectionResult>;
|
|
648
652
|
listDomains(opts?: ListDomainsOptions): Promise<Domain[]>;
|
|
649
653
|
getDomain(domainName: string, opts?: RequestOptions): Promise<Domain>;
|
|
654
|
+
readonly requiresNameserversFetch = false;
|
|
650
655
|
getNameservers(domainName: string, opts?: RequestOptions): Promise<string[]>;
|
|
651
656
|
getContacts(domainName: string, opts?: RequestOptions): Promise<ContactSet>;
|
|
652
657
|
getDnsRecords(domainName: string, opts?: RequestOptions): Promise<DnsRecord[]>;
|
|
@@ -716,6 +721,7 @@ declare class SpaceshipRegistrar extends BaseRegistrar {
|
|
|
716
721
|
testConnection(opts?: RequestOptions): Promise<ConnectionResult>;
|
|
717
722
|
listDomains(opts?: ListDomainsOptions): Promise<Domain[]>;
|
|
718
723
|
getDomain(domainName: string, opts?: RequestOptions): Promise<Domain>;
|
|
724
|
+
readonly requiresNameserversFetch = false;
|
|
719
725
|
getNameservers(domainName: string, opts?: RequestOptions): Promise<string[]>;
|
|
720
726
|
getAuthCode(domainName: string, opts?: RequestOptions): Promise<string>;
|
|
721
727
|
checkAvailability(domainNames: string[], opts?: RequestOptions): Promise<DomainAvailability[]>;
|
package/dist/index.js
CHANGED
|
@@ -256,7 +256,7 @@ var RegistrarClient = class {
|
|
|
256
256
|
try {
|
|
257
257
|
const detail = await this.provider.getDomain(name, opts);
|
|
258
258
|
let merged = { ...domains[index], ...detail };
|
|
259
|
-
if (merged.nameservers.length === 0) {
|
|
259
|
+
if (merged.nameservers.length === 0 && this.provider.requiresNameserversFetch) {
|
|
260
260
|
try {
|
|
261
261
|
const nameservers = normalizeNameservers(
|
|
262
262
|
await this.provider.getNameservers(name, opts)
|
|
@@ -644,6 +644,11 @@ var BaseRegistrar = class {
|
|
|
644
644
|
supports(feature) {
|
|
645
645
|
return this.features.includes(feature);
|
|
646
646
|
}
|
|
647
|
+
// See Registrar.requiresNameserversFetch. Defaults true, so a provider
|
|
648
|
+
// whose getNameservers hits a real endpoint keeps the enrichment fallback
|
|
649
|
+
// without opting in; the providers whose getNameservers just re-reads getDomain
|
|
650
|
+
// override this to false to drop the redundant call.
|
|
651
|
+
requiresNameserversFetch = true;
|
|
647
652
|
constructor(credentials, httpConfig, options) {
|
|
648
653
|
const { environment = "production", ...clientOptions } = options ?? {};
|
|
649
654
|
this.credentials = credentials;
|
|
@@ -1714,6 +1719,9 @@ ${bodyStr}`;
|
|
|
1714
1719
|
if (!data.domain_info) throw new NotFoundError(`Dynadot: domain '${domainName}' not found`);
|
|
1715
1720
|
return data.domain_info;
|
|
1716
1721
|
}
|
|
1722
|
+
// getNameservers re-reads getDomain (domain_info carries NS inline; no separate
|
|
1723
|
+
// endpoint), so listing enrichment gains nothing from the fallback — skip it.
|
|
1724
|
+
requiresNameserversFetch = false;
|
|
1717
1725
|
async getNameservers(domainName, opts) {
|
|
1718
1726
|
const domain = await this.getDomain(domainName, opts);
|
|
1719
1727
|
return domain.nameservers;
|
|
@@ -3157,6 +3165,9 @@ var GoDaddyRegistrar = class _GoDaddyRegistrar extends BaseRegistrar {
|
|
|
3157
3165
|
});
|
|
3158
3166
|
return this.toDomain(d);
|
|
3159
3167
|
}
|
|
3168
|
+
// getNameservers re-reads getDomain (GoDaddy has no dedicated NS endpoint), so
|
|
3169
|
+
// listing enrichment gains nothing from the fallback — skip it.
|
|
3170
|
+
requiresNameserversFetch = false;
|
|
3160
3171
|
async getNameservers(domainName, opts) {
|
|
3161
3172
|
const domain = await this.getDomain(domainName, opts);
|
|
3162
3173
|
return domain.nameservers;
|
|
@@ -5058,6 +5069,9 @@ var NameSiloRegistrar = class extends BaseRegistrar {
|
|
|
5058
5069
|
nameservers: extractNsHosts(r.nameservers)
|
|
5059
5070
|
});
|
|
5060
5071
|
}
|
|
5072
|
+
// getNameservers re-reads getDomain (getDomainInfo carries NS; no separate
|
|
5073
|
+
// endpoint), so listing enrichment gains nothing from the fallback — skip it.
|
|
5074
|
+
requiresNameserversFetch = false;
|
|
5061
5075
|
async getNameservers(domainName, opts) {
|
|
5062
5076
|
const domain = await this.getDomain(domainName, opts);
|
|
5063
5077
|
return domain.nameservers;
|
|
@@ -6299,6 +6313,9 @@ var SpaceshipRegistrar = class extends BaseRegistrar {
|
|
|
6299
6313
|
async getDomain(domainName, opts) {
|
|
6300
6314
|
return this.toDomain(await this.getRaw(domainName, opts));
|
|
6301
6315
|
}
|
|
6316
|
+
// getNameservers reads the same getRaw payload as getDomain (no dedicated NS
|
|
6317
|
+
// endpoint), so listing enrichment gains nothing from the fallback — skip it.
|
|
6318
|
+
requiresNameserversFetch = false;
|
|
6302
6319
|
async getNameservers(domainName, opts) {
|
|
6303
6320
|
const d = await this.getRaw(domainName, opts);
|
|
6304
6321
|
return d.nameservers?.hosts ?? [];
|