@gusnips/one-click-dns 0.0.0-stage → 0.1.1
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/LICENSE +21 -0
- package/README.md +151 -2
- package/dist/bounded-fetch-nozW2egX.d.cts +5 -0
- package/dist/bounded-fetch-nozW2egX.d.ts +5 -0
- package/dist/chunk-2T2PEF4H.js +521 -0
- package/dist/chunk-56ZUD4EQ.js +525 -0
- package/dist/chunk-P2O7INDB.js +8 -0
- package/dist/hosts-B0_V4Ned.d.cts +106 -0
- package/dist/hosts-B0_V4Ned.d.ts +106 -0
- package/dist/index.cjs +745 -0
- package/dist/index.d.cts +119 -0
- package/dist/index.d.ts +119 -0
- package/dist/index.js +198 -0
- package/dist/server/index.cjs +1320 -0
- package/dist/server/index.d.cts +145 -0
- package/dist/server/index.d.ts +145 -0
- package/dist/server/index.js +274 -0
- package/dist/writers/index.cjs +555 -0
- package/dist/writers/index.d.cts +64 -0
- package/dist/writers/index.d.ts +64 -0
- package/dist/writers/index.js +17 -0
- package/package.json +93 -4
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The DNS hosts we know steps for. A closed list. Order is the order a picker shows them and a
|
|
3
|
+
* detection lists them in.
|
|
4
|
+
*
|
|
5
|
+
* `cpanel` and `namecheap-hosting` both hand the person cPanel's Zone Editor. `hostinger` and
|
|
6
|
+
* `cpanel` have no name server pattern, so DNS alone never names them: a person picks them by
|
|
7
|
+
* hand.
|
|
8
|
+
*/
|
|
9
|
+
declare const DNS_HOST_IDS: readonly ["cloudflare", "godaddy", "namecheap", "namecheap-hosting", "squarespace", "route53", "google-cloud-dns", "azure-dns", "ionos", "hostinger", "porkbun", "name-com", "dynadot", "namesilo", "gandi", "ovhcloud", "digitalocean", "hetzner", "vercel", "netlify", "wix", "wordpress-com", "cpanel", "bluehost", "hostgator", "hostgator-br", "siteground", "registro-br", "locaweb", "kinghost", "uol-host", "umbler", "dnsimple"];
|
|
10
|
+
type DnsHostId = (typeof DNS_HOST_IDS)[number];
|
|
11
|
+
/** The labels on the form of one record type. */
|
|
12
|
+
interface DnsFields {
|
|
13
|
+
/** The box that takes the record's name. */
|
|
14
|
+
name: string | null;
|
|
15
|
+
/** The box that takes its value: a CNAME's target, or a TXT's text. */
|
|
16
|
+
value: string | null;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* What goes wrong at a host, each with a sentence of its own in the app.
|
|
20
|
+
*
|
|
21
|
+
* - `proxyOff`: a record is proxied by default and the proxy hides it (Cloudflare);
|
|
22
|
+
* - `trailingDot`: without a dot at the end, the host adds the zone to a CNAME's target
|
|
23
|
+
* (OVHcloud, Hetzner, DigitalOcean);
|
|
24
|
+
* - `quotedTxt`: the host wants straight quotes around a TXT value (Route 53, Hetzner);
|
|
25
|
+
* - `secondSave`: adding the record is not saving it (KingHost);
|
|
26
|
+
* - `advancedMode`: the basic mode can't add the record (Registro.br);
|
|
27
|
+
* - `oneSpf`: the host may already hold an SPF record, and a domain may have only one;
|
|
28
|
+
* - `shortName`: the name box takes only the part before the zone, and the host adds the rest.
|
|
29
|
+
*
|
|
30
|
+
* `trailingDot` and `quotedTxt` also change the value we hand over (`records.ts`).
|
|
31
|
+
*/
|
|
32
|
+
type DnsTrap = {
|
|
33
|
+
kind: "proxyOff";
|
|
34
|
+
field: string;
|
|
35
|
+
value: string;
|
|
36
|
+
} | {
|
|
37
|
+
kind: "trailingDot";
|
|
38
|
+
} | {
|
|
39
|
+
kind: "quotedTxt";
|
|
40
|
+
} | {
|
|
41
|
+
kind: "secondSave";
|
|
42
|
+
button: string;
|
|
43
|
+
} | {
|
|
44
|
+
kind: "advancedMode";
|
|
45
|
+
mode: string;
|
|
46
|
+
} | {
|
|
47
|
+
kind: "oneSpf";
|
|
48
|
+
} | {
|
|
49
|
+
kind: "shortName";
|
|
50
|
+
};
|
|
51
|
+
type DnsTrapKind = DnsTrap["kind"];
|
|
52
|
+
interface DnsHost {
|
|
53
|
+
/** The brand, as the company writes it. */
|
|
54
|
+
name: string;
|
|
55
|
+
/** The host's name servers, as patterns over a lowercase name with no trailing dot. A set
|
|
56
|
+
* of names belongs to this host only when every name matches one of them. Empty: no
|
|
57
|
+
* pattern we may trust, so the host is reached by the picker alone. */
|
|
58
|
+
ns: readonly RegExp[];
|
|
59
|
+
/** The host's page for a zone's records, only where its own docs link one. */
|
|
60
|
+
link: string | null;
|
|
61
|
+
/** The menu, tab or button that opens the zone's records. */
|
|
62
|
+
open: string | null;
|
|
63
|
+
/** The button that starts a new record. */
|
|
64
|
+
add: string | null;
|
|
65
|
+
/** The button that saves it. */
|
|
66
|
+
save: string | null;
|
|
67
|
+
cname: DnsFields;
|
|
68
|
+
txt: DnsFields;
|
|
69
|
+
/** How the host writes the zone's own name in the name box: `"@"`, empty, or `"."`. `null`
|
|
70
|
+
* when no page of the host says. */
|
|
71
|
+
root: "@" | "" | "." | null;
|
|
72
|
+
traps: readonly DnsTrap[];
|
|
73
|
+
}
|
|
74
|
+
declare const DNS_HOSTS: Record<DnsHostId, DnsHost>;
|
|
75
|
+
/** The first trap of a kind a host has. */
|
|
76
|
+
declare function trapOf<K extends DnsTrapKind>(host: DnsHost, kind: K): Extract<DnsTrap, {
|
|
77
|
+
kind: K;
|
|
78
|
+
}> | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* The hosts a zone's name servers point at. A host fits when every name matches one of its
|
|
81
|
+
* patterns, so a set that mixes two hosts, or holds one name nobody claims, fits none. Names that
|
|
82
|
+
* several hosts share answer with all of them, in `DNS_HOST_IDS` order: the app shows the
|
|
83
|
+
* choice and never guesses. An empty list is a host we don't know.
|
|
84
|
+
*/
|
|
85
|
+
declare function detectDnsHosts(nameservers: readonly string[]): DnsHostId[];
|
|
86
|
+
/** The zone whose name servers answered: the nearest name at or above the hostname that has NS
|
|
87
|
+
* records of its own. Records are added in this zone, named relative to it. */
|
|
88
|
+
interface DnsZone {
|
|
89
|
+
zone: string;
|
|
90
|
+
/** The zone's name servers, lowercase, without the trailing dot, sorted. */
|
|
91
|
+
nameservers: string[];
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* What we read from DNS about where a domain's records are edited. `hosts` says what the names
|
|
95
|
+
* mean:
|
|
96
|
+
* - one id: a host we know;
|
|
97
|
+
* - several: the names fit more than one (Netlify and older Squarespace zones share NS1's
|
|
98
|
+
* names, Google Cloud DNS and Squarespace domains moved from Google Domains share Google's),
|
|
99
|
+
* so we do not guess;
|
|
100
|
+
* - none: names no host we know uses, or a mix of hosts. Show the names and ask.
|
|
101
|
+
*/
|
|
102
|
+
interface DnsHostReading extends DnsZone {
|
|
103
|
+
hosts: DnsHostId[];
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export { type DnsHostId as D, DNS_HOSTS as a, DNS_HOST_IDS as b, type DnsFields as c, type DnsHost as d, type DnsHostReading as e, type DnsTrap as f, type DnsTrapKind as g, type DnsZone as h, detectDnsHosts as i, trapOf as t };
|