@startanaicompany/dns 1.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 +435 -0
- package/bin/saac_dns.js +1340 -0
- package/index.js +675 -0
- package/lib/client.js +134 -0
- package/lib/namesilo.js +754 -0
- package/package.json +27 -0
package/README.md
ADDED
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
# @startanaicompany/saac_dns
|
|
2
|
+
|
|
3
|
+
Programmatic Domain Registration, DNS Management & CLI Toolkit by [Start An AI Company (SAAC)](https://start-an-ai-company-3l1xzm.adam.startanaicompany.com).
|
|
4
|
+
|
|
5
|
+
Powered by the SAAC backend at `https://start-an-ai-company-3l1xzm.adam.startanaicompany.com`.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @startanaicompany/saac_dns
|
|
13
|
+
# or
|
|
14
|
+
pnpm add @startanaicompany/saac_dns
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Install the CLI globally:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install -g @startanaicompany/saac_dns
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Quick Start
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm install @startanaicompany/saac_dns
|
|
29
|
+
export SAAC_USER_API_KEY=your_api_key
|
|
30
|
+
export SAAC_USER_EMAIL=your@email.com
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```js
|
|
34
|
+
const dns = require('@startanaicompany/saac_dns');
|
|
35
|
+
|
|
36
|
+
const results = await dns.search(['mycompany.com', 'mycompany.io']);
|
|
37
|
+
await dns.buy('mycompany.io', { years: 1, privacy: true, autoRenew: true });
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Environment Variables
|
|
43
|
+
|
|
44
|
+
| Variable | Description | Required |
|
|
45
|
+
|---|---|---|
|
|
46
|
+
| `SAAC_USER_API_KEY` | Your SAAC API key | Yes |
|
|
47
|
+
| `SAAC_USER_EMAIL` | Your SAAC account email | Yes |
|
|
48
|
+
| `SAAC_API_URL` | Override backend URL (default: production) | No |
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## SDK API Reference
|
|
53
|
+
|
|
54
|
+
### Domain Search & Registration
|
|
55
|
+
|
|
56
|
+
#### `dns.search(domains)`
|
|
57
|
+
|
|
58
|
+
Search availability and pricing for one or more domains.
|
|
59
|
+
|
|
60
|
+
```js
|
|
61
|
+
const results = await dns.search(['mycompany.com', 'mycompany.io']);
|
|
62
|
+
// [{ fqdn, available, price, currency, tld }, ...]
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
#### `dns.buy(domain, opts?)`
|
|
66
|
+
|
|
67
|
+
Register a domain.
|
|
68
|
+
|
|
69
|
+
```js
|
|
70
|
+
await dns.buy('mycompany.io', {
|
|
71
|
+
years: 1, // default: 1
|
|
72
|
+
privacy: true, // WHOIS privacy, default: false
|
|
73
|
+
autoRenew: true // default: true
|
|
74
|
+
});
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
#### `dns.list()`
|
|
78
|
+
|
|
79
|
+
List all domains on your account.
|
|
80
|
+
|
|
81
|
+
```js
|
|
82
|
+
const domains = await dns.list();
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
#### `dns.info(domain)`
|
|
86
|
+
|
|
87
|
+
Get full details for a domain.
|
|
88
|
+
|
|
89
|
+
```js
|
|
90
|
+
const domain = await dns.info('mycompany.io');
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
#### `dns.prices(tlds?)`
|
|
94
|
+
|
|
95
|
+
Get registration prices, optionally filtered by TLD.
|
|
96
|
+
|
|
97
|
+
```js
|
|
98
|
+
const all = await dns.prices();
|
|
99
|
+
const filtered = await dns.prices(['.com', '.io']);
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
#### `dns.renew(domain, years?)`
|
|
103
|
+
|
|
104
|
+
Renew a domain registration.
|
|
105
|
+
|
|
106
|
+
```js
|
|
107
|
+
await dns.renew('mycompany.io', 1);
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
#### `dns.quickBuy(domain, opts?)`
|
|
111
|
+
|
|
112
|
+
Search and buy in a single call — only registers if available.
|
|
113
|
+
|
|
114
|
+
```js
|
|
115
|
+
await dns.quickBuy('mycompany.io', { privacy: true });
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
#### `dns.setupWeb(domain, ip)`
|
|
119
|
+
|
|
120
|
+
Create an A record for `@` and a CNAME for `www` in one call.
|
|
121
|
+
|
|
122
|
+
```js
|
|
123
|
+
await dns.setupWeb('mycompany.io', '1.2.3.4');
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
#### `dns.exportRecords(domain)`
|
|
127
|
+
|
|
128
|
+
Export all DNS records for a domain as an array.
|
|
129
|
+
|
|
130
|
+
```js
|
|
131
|
+
const records = await dns.exportRecords('mycompany.io');
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
#### `dns.importRecords(domain, records)`
|
|
135
|
+
|
|
136
|
+
Bulk-import DNS records from an array.
|
|
137
|
+
|
|
138
|
+
```js
|
|
139
|
+
await dns.importRecords('mycompany.io', [
|
|
140
|
+
{ type: 'A', name: '@', value: '1.2.3.4', ttl: 300 },
|
|
141
|
+
{ type: 'MX', name: '@', value: 'mail.mycompany.io', priority: 10 }
|
|
142
|
+
]);
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
### DNS Records — `dns.records`
|
|
148
|
+
|
|
149
|
+
#### `dns.records.list(domain)`
|
|
150
|
+
|
|
151
|
+
```js
|
|
152
|
+
const recs = await dns.records.list('mycompany.io');
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
#### `dns.records.add(domain, record)`
|
|
156
|
+
|
|
157
|
+
```js
|
|
158
|
+
const rec = await dns.records.add('mycompany.io', {
|
|
159
|
+
type: 'A',
|
|
160
|
+
host: '@', // or name
|
|
161
|
+
value: '1.2.3.4',
|
|
162
|
+
ttl: 300
|
|
163
|
+
});
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Supported `type` values: `A`, `AAAA`, `CNAME`, `MX`, `TXT`, `NS`, `SRV`, `CAA`.
|
|
167
|
+
|
|
168
|
+
#### `dns.records.update(domain, id, record)`
|
|
169
|
+
|
|
170
|
+
```js
|
|
171
|
+
await dns.records.update('mycompany.io', 'record-id', { value: '5.6.7.8' });
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
#### `dns.records.delete(domain, id)`
|
|
175
|
+
|
|
176
|
+
```js
|
|
177
|
+
await dns.records.delete('mycompany.io', 'record-id');
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
### Nameservers — `dns.nameservers`
|
|
183
|
+
|
|
184
|
+
#### `dns.nameservers.set(domain, ns[])`
|
|
185
|
+
|
|
186
|
+
```js
|
|
187
|
+
await dns.nameservers.set('mycompany.io', ['ns1.cloudflare.com', 'ns2.cloudflare.com']);
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
#### `dns.nameservers.list(domain)`
|
|
191
|
+
|
|
192
|
+
```js
|
|
193
|
+
const ns = await dns.nameservers.list('mycompany.io');
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
### Contacts — `dns.contacts`
|
|
199
|
+
|
|
200
|
+
#### `dns.contacts.list()`
|
|
201
|
+
|
|
202
|
+
```js
|
|
203
|
+
const contacts = await dns.contacts.list();
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
#### `dns.contacts.add(contact)`
|
|
207
|
+
|
|
208
|
+
```js
|
|
209
|
+
const contact = await dns.contacts.add({
|
|
210
|
+
first_name: 'Jane', last_name: 'Doe',
|
|
211
|
+
email: 'jane@example.com',
|
|
212
|
+
address: '123 Main St', city: 'Austin',
|
|
213
|
+
state: 'TX', zip: '78701', country: 'US',
|
|
214
|
+
phone: '+15125550100'
|
|
215
|
+
});
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
#### `dns.contacts.update(id, contact)`
|
|
219
|
+
|
|
220
|
+
```js
|
|
221
|
+
await dns.contacts.update('contact-id', { email: 'new@example.com' });
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
#### `dns.contacts.delete(id)`
|
|
225
|
+
|
|
226
|
+
```js
|
|
227
|
+
await dns.contacts.delete('contact-id');
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
#### `dns.contacts.associate(id, domain)`
|
|
231
|
+
|
|
232
|
+
```js
|
|
233
|
+
await dns.contacts.associate('contact-id', 'mycompany.io');
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
### Account — `dns.account`
|
|
239
|
+
|
|
240
|
+
#### `dns.account.me()`
|
|
241
|
+
|
|
242
|
+
```js
|
|
243
|
+
const user = await dns.account.me();
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
#### `dns.account.preferences(prefs)`
|
|
247
|
+
|
|
248
|
+
```js
|
|
249
|
+
await dns.account.preferences({ default_privacy: true, default_auto_renew: true });
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
#### `dns.account.balance()`
|
|
253
|
+
|
|
254
|
+
```js
|
|
255
|
+
const { balance } = await dns.account.balance();
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
#### `dns.account.audit(page?, limit?)`
|
|
259
|
+
|
|
260
|
+
```js
|
|
261
|
+
const log = await dns.account.audit(1, 50);
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
---
|
|
265
|
+
|
|
266
|
+
## CLI Reference
|
|
267
|
+
|
|
268
|
+
Set environment variables before using the CLI:
|
|
269
|
+
|
|
270
|
+
```bash
|
|
271
|
+
export SAAC_USER_API_KEY=your_api_key
|
|
272
|
+
export SAAC_USER_EMAIL=your@email.com
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### Global Options
|
|
276
|
+
|
|
277
|
+
| Flag | Description |
|
|
278
|
+
|---|---|
|
|
279
|
+
| `--json` | Output raw JSON |
|
|
280
|
+
| `--quiet` | Minimal output |
|
|
281
|
+
| `--verbose` | Verbose output |
|
|
282
|
+
|
|
283
|
+
### Domain Commands
|
|
284
|
+
|
|
285
|
+
```bash
|
|
286
|
+
# Search domain availability
|
|
287
|
+
saac_dns search mycompany.com mycompany.io
|
|
288
|
+
|
|
289
|
+
# Register a domain
|
|
290
|
+
saac_dns buy mycompany.io --years 1 --privacy --auto-renew
|
|
291
|
+
|
|
292
|
+
# List all your domains
|
|
293
|
+
saac_dns list
|
|
294
|
+
|
|
295
|
+
# Get domain details
|
|
296
|
+
saac_dns info mycompany.io
|
|
297
|
+
|
|
298
|
+
# WHOIS lookup
|
|
299
|
+
saac_dns whois mycompany.io
|
|
300
|
+
|
|
301
|
+
# Renew a domain
|
|
302
|
+
saac_dns renew mycompany.io --years 1
|
|
303
|
+
|
|
304
|
+
# Show registration prices
|
|
305
|
+
saac_dns prices
|
|
306
|
+
saac_dns prices --tld com,io,dev
|
|
307
|
+
|
|
308
|
+
# Toggle auto-renewal
|
|
309
|
+
saac_dns auto-renew mycompany.io on
|
|
310
|
+
saac_dns auto-renew mycompany.io off
|
|
311
|
+
|
|
312
|
+
# Toggle WHOIS privacy
|
|
313
|
+
saac_dns privacy mycompany.io on
|
|
314
|
+
|
|
315
|
+
# Set up domain forwarding
|
|
316
|
+
saac_dns forward mycompany.io https://myapp.com
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
### DNS Record Commands
|
|
320
|
+
|
|
321
|
+
```bash
|
|
322
|
+
# List DNS records
|
|
323
|
+
saac_dns records list mycompany.io
|
|
324
|
+
saac_dns records list mycompany.io --type A
|
|
325
|
+
|
|
326
|
+
# Add a record
|
|
327
|
+
saac_dns records add mycompany.io A @ 1.2.3.4 --ttl 300
|
|
328
|
+
saac_dns records add mycompany.io MX @ mail.mycompany.io --priority 10
|
|
329
|
+
saac_dns records add mycompany.io TXT @ "v=spf1 include:sendgrid.net ~all"
|
|
330
|
+
|
|
331
|
+
# Bulk import from JSON file
|
|
332
|
+
saac_dns records add mycompany.io A @ 0.0.0.0 --file ./records.json
|
|
333
|
+
|
|
334
|
+
# Update a record
|
|
335
|
+
saac_dns records update mycompany.io <record-id> --value 5.6.7.8
|
|
336
|
+
|
|
337
|
+
# Delete a record
|
|
338
|
+
saac_dns records delete mycompany.io <record-id>
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
### Nameserver Commands
|
|
342
|
+
|
|
343
|
+
```bash
|
|
344
|
+
# List nameservers
|
|
345
|
+
saac_dns ns list mycompany.io
|
|
346
|
+
|
|
347
|
+
# Set nameservers
|
|
348
|
+
saac_dns ns set mycompany.io ns1.cloudflare.com ns2.cloudflare.com
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
### Contact Commands
|
|
352
|
+
|
|
353
|
+
```bash
|
|
354
|
+
# List contacts
|
|
355
|
+
saac_dns contacts list
|
|
356
|
+
|
|
357
|
+
# Add a contact
|
|
358
|
+
saac_dns contacts add --first-name Jane --last-name Doe \
|
|
359
|
+
--email jane@example.com --country US --phone +15125550100
|
|
360
|
+
|
|
361
|
+
# Assign contact to domain
|
|
362
|
+
saac_dns contacts set mycompany.io --contact <contact-id>
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
### Account Commands
|
|
366
|
+
|
|
367
|
+
```bash
|
|
368
|
+
# Check account balance
|
|
369
|
+
saac_dns account balance
|
|
370
|
+
|
|
371
|
+
# View/set config and preferences
|
|
372
|
+
saac_dns config
|
|
373
|
+
saac_dns config --privacy on --auto-renew on --ttl 300
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
---
|
|
377
|
+
|
|
378
|
+
## Error Handling
|
|
379
|
+
|
|
380
|
+
The SDK throws typed errors you can catch and distinguish:
|
|
381
|
+
|
|
382
|
+
```js
|
|
383
|
+
const {
|
|
384
|
+
AuthenticationError,
|
|
385
|
+
DomainNotFoundError,
|
|
386
|
+
DomainUnavailableError,
|
|
387
|
+
ValidationError,
|
|
388
|
+
InsufficientFundsError,
|
|
389
|
+
SaacDnsError
|
|
390
|
+
} = require('@startanaicompany/saac_dns');
|
|
391
|
+
|
|
392
|
+
try {
|
|
393
|
+
await dns.buy('taken.com');
|
|
394
|
+
} catch (err) {
|
|
395
|
+
if (err instanceof DomainUnavailableError) {
|
|
396
|
+
console.error('Domain is not available:', err.message);
|
|
397
|
+
} else if (err instanceof InsufficientFundsError) {
|
|
398
|
+
console.error('Top up your account balance:', err.message);
|
|
399
|
+
} else if (err instanceof AuthenticationError) {
|
|
400
|
+
console.error('Check SAAC_USER_API_KEY and SAAC_USER_EMAIL:', err.message);
|
|
401
|
+
} else if (err instanceof SaacDnsError) {
|
|
402
|
+
console.error(`Error (code ${err.code}):`, err.message);
|
|
403
|
+
} else {
|
|
404
|
+
throw err;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
| Error Class | Code | Trigger |
|
|
410
|
+
|---|---|---|
|
|
411
|
+
| `AuthenticationError` | 110 | Invalid or missing API key / email |
|
|
412
|
+
| `DomainNotFoundError` | 200 | Domain does not exist on the account |
|
|
413
|
+
| `DomainUnavailableError` | 261 | Domain is already registered |
|
|
414
|
+
| `ValidationError` | 108 | Bad request parameters |
|
|
415
|
+
| `InsufficientFundsError` | 280 | Insufficient account balance |
|
|
416
|
+
| `SaacDnsError` | varies | Other API errors |
|
|
417
|
+
|
|
418
|
+
---
|
|
419
|
+
|
|
420
|
+
## TypeScript
|
|
421
|
+
|
|
422
|
+
The package ships with full TypeScript definitions:
|
|
423
|
+
|
|
424
|
+
```ts
|
|
425
|
+
import * as dns from '@startanaicompany/saac_dns';
|
|
426
|
+
import type { SearchResult, Domain, DnsRecord } from '@startanaicompany/saac_dns';
|
|
427
|
+
|
|
428
|
+
const results: SearchResult[] = await dns.search(['mycompany.io']);
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
---
|
|
432
|
+
|
|
433
|
+
## License
|
|
434
|
+
|
|
435
|
+
MIT — Copyright (c) 2026 Start An AI Company (SAAC)
|