@aoxborrow/registrar-client 0.1.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.
@@ -0,0 +1,41 @@
1
+ import type {
2
+ Registrar,
3
+ RegistrarConstructor,
4
+ RegistrarCredentials,
5
+ RegistrarOptions,
6
+ } from '../types';
7
+ import { CloudflareRegistrar } from './cloudflare';
8
+ import { DynadotRegistrar } from './dynadot';
9
+ import { GandiRegistrar } from './gandi';
10
+ import { GoDaddyRegistrar } from './godaddy';
11
+ import { NameBrightRegistrar } from './namebright';
12
+ import { NamecheapRegistrar } from './namecheap';
13
+ import { NameSiloRegistrar } from './namesilo';
14
+ import { PorkbunRegistrar } from './porkbun';
15
+ import { SpaceshipRegistrar } from './spaceship';
16
+
17
+ // the built-in registrar providers, keyed by id
18
+ export const registrars = {
19
+ cloudflare: CloudflareRegistrar,
20
+ dynadot: DynadotRegistrar,
21
+ gandi: GandiRegistrar,
22
+ godaddy: GoDaddyRegistrar,
23
+ namebright: NameBrightRegistrar,
24
+ namecheap: NamecheapRegistrar,
25
+ namesilo: NameSiloRegistrar,
26
+ porkbun: PorkbunRegistrar,
27
+ spaceship: SpaceshipRegistrar,
28
+ } satisfies Record<string, RegistrarConstructor>;
29
+
30
+ // id of a built-in registrar
31
+ export type RegistrarName = keyof typeof registrars;
32
+
33
+ // construct a registrar provider by id
34
+ export function createRegistrar(
35
+ name: RegistrarName,
36
+ credentials: RegistrarCredentials,
37
+ options?: RegistrarOptions
38
+ ): Registrar {
39
+ const RegistrarClass = registrars[name];
40
+ return new RegistrarClass(credentials, options);
41
+ }