insta 0.0.70 → 0.0.71
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 -1
- package/dist/commands/domain.js +1 -52
- package/dist/index.js +0 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -222,7 +222,7 @@ build never reaches a production installer.
|
|
|
222
222
|
| `insta run <cmd>` | Run a command with the branch bundle injected, nothing written to disk |
|
|
223
223
|
| `insta deploy [dir]` | Deploy a source directory (built remotely) or `--image <url>` |
|
|
224
224
|
| `insta compute` | `start` · `stop` · `suspend` · `status` · `set-domain` · `check-domain` · `remove-domain` |
|
|
225
|
-
| `insta domain` | Buy a domain through InstaCloud: `search` · `buy` · `attach` · `list` · `status`
|
|
225
|
+
| `insta domain` | Buy a domain through InstaCloud: `search` · `buy` · `attach` · `list` · `status` |
|
|
226
226
|
| `insta db` | `url` (print the postgres DSN) · `connect` (psql session) · `limits` · `stats` · `always-on` · `volume` |
|
|
227
227
|
| `insta regions` | Regions available for postgres and compute |
|
|
228
228
|
| `insta manifest` | Agent-legible view of every branch and its URLs |
|
package/dist/commands/domain.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { readFile } from 'node:fs/promises';
|
|
2
1
|
import { ApiClient } from '../api.js';
|
|
3
2
|
import { info, printJson, handleApproval, die } from '../util.js';
|
|
4
3
|
import { presentUrl, resolveOrgId } from './billing.js';
|
|
@@ -32,60 +31,10 @@ export async function domainSearch(keyword, opts, deps) {
|
|
|
32
31
|
if (buyable)
|
|
33
32
|
info(`buy one: insta domain buy ${buyable.domainName}`);
|
|
34
33
|
}
|
|
35
|
-
const CONTACT_KEYS = ['firstName', 'lastName', 'companyName', 'address1', 'address2', 'city', 'state', 'zip', 'country', 'email', 'phone'];
|
|
36
|
-
export function contactFromOpts(opts, file) {
|
|
37
|
-
if (file !== undefined)
|
|
38
|
-
return file;
|
|
39
|
-
const out = {};
|
|
40
|
-
for (const k of CONTACT_KEYS)
|
|
41
|
-
if (opts[k] !== undefined)
|
|
42
|
-
out[k] = opts[k];
|
|
43
|
-
return Object.keys(out).length ? out : undefined;
|
|
44
|
-
}
|
|
45
|
-
async function readContactFile(path) {
|
|
46
|
-
if (!path)
|
|
47
|
-
return undefined;
|
|
48
|
-
try {
|
|
49
|
-
return JSON.parse(await readFile(path, 'utf8'));
|
|
50
|
-
}
|
|
51
|
-
catch (e) {
|
|
52
|
-
throw new Error(`cannot read ${path} as JSON: ${e.message}`);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
function contactLines(c) {
|
|
56
|
-
if (!c)
|
|
57
|
-
return ['no registrant contact set — set one with: insta domain contact set --first-name … (or --contact-file contact.json)'];
|
|
58
|
-
return [
|
|
59
|
-
`${c.firstName} ${c.lastName}${c.companyName ? ` (${c.companyName} — the organization is the legal registrant)` : ''}`,
|
|
60
|
-
`${c.address1}${c.address2 ? `, ${c.address2}` : ''}, ${c.city}, ${c.state} ${c.zip}, ${c.country}`,
|
|
61
|
-
`${c.email} ${c.phone}`,
|
|
62
|
-
];
|
|
63
|
-
}
|
|
64
|
-
export async function domainContactShow(opts, deps) {
|
|
65
|
-
const { api, orgId } = await orgDeps(opts, deps);
|
|
66
|
-
const r = await api.request('GET', `/orgs/${orgId}/domains/contact`);
|
|
67
|
-
if (opts.json)
|
|
68
|
-
return printJson(r);
|
|
69
|
-
for (const line of contactLines(r.contact))
|
|
70
|
-
info(line);
|
|
71
|
-
}
|
|
72
|
-
export async function domainContactSet(opts, deps) {
|
|
73
|
-
const { api, orgId } = await orgDeps(opts, deps);
|
|
74
|
-
const contact = contactFromOpts(opts, await readContactFile(opts.contactFile));
|
|
75
|
-
if (!contact)
|
|
76
|
-
die('pass the contact as flags (--first-name … --phone) or as --contact-file <contact.json>');
|
|
77
|
-
const r = await api.request('PUT', `/orgs/${orgId}/domains/contact`, contact);
|
|
78
|
-
if (opts.json)
|
|
79
|
-
return printJson(r);
|
|
80
|
-
info('registrant contact saved:');
|
|
81
|
-
for (const line of contactLines(r.contact))
|
|
82
|
-
info(` ${line}`);
|
|
83
|
-
}
|
|
84
34
|
export async function domainBuy(name, opts, deps) {
|
|
85
35
|
const { api, project: p } = await domainDeps(deps);
|
|
86
36
|
const branch = opts.branch ?? p.branch;
|
|
87
37
|
const { target } = await domainTarget(api, p.projectId, branch, name, opts.group);
|
|
88
|
-
const contact = await readContactFile(opts.contactFile);
|
|
89
38
|
// JSON.stringify drops undefined but keeps NaN as null, which the platform rejects as a type
|
|
90
39
|
// error rather than a bad term — so a malformed --years is refused here, with the reason.
|
|
91
40
|
let years;
|
|
@@ -94,7 +43,7 @@ export async function domainBuy(name, opts, deps) {
|
|
|
94
43
|
if (!Number.isInteger(years))
|
|
95
44
|
die(`--years must be a whole number of years, not ${opts.years}`);
|
|
96
45
|
}
|
|
97
|
-
const res = await api.rawRequest('POST', `/projects/${p.projectId}/domains/orders`, { domainName: name, years, branch, group: target.name
|
|
46
|
+
const res = await api.rawRequest('POST', `/projects/${p.projectId}/domains/orders`, { domainName: name, years, branch, group: target.name });
|
|
98
47
|
if (handleApproval(res, opts.json))
|
|
99
48
|
return;
|
|
100
49
|
if (opts.json)
|
package/dist/index.js
CHANGED
|
@@ -355,7 +355,6 @@ dom.command('search <keyword>').description('Search purchasable names with price
|
|
|
355
355
|
.action(guard((keyword, o) => domainCmd.domainSearch(keyword, o)));
|
|
356
356
|
dom.command('buy <name>').description('Buy a domain and attach it to a branch compute service — pay at the printed Stripe Checkout link (gated: domain.purchase)')
|
|
357
357
|
.option('--years <n>', 'registration term in years (default 1)').option('--branch <b>').option('--group <g>', "compute service (default: the branch's sole compute service)")
|
|
358
|
-
.option('--contact-file <path>', 'registrant contact as JSON (default: the org contact from `insta domain contact set`)')
|
|
359
358
|
.option('--no-open', 'print the checkout URL instead of opening a browser').option('--json')
|
|
360
359
|
.action(guard((name, o) => domainCmd.domainBuy(name, o)));
|
|
361
360
|
dom.command('attach <name>').description('Attach a bought domain whose service was deleted (or whose attach failed) to a compute service (gated: deploy)')
|
|
@@ -365,15 +364,6 @@ dom.command('list').description('Domains bought through InstaCloud in this proje
|
|
|
365
364
|
.action(guard((o) => domainCmd.domainList(o)));
|
|
366
365
|
dom.command('status <name>').description("A bought domain's order and attach state").option('--json')
|
|
367
366
|
.action(guard((name, o) => domainCmd.domainStatus(name, o)));
|
|
368
|
-
const domContact = dom.command('contact').description("Show the org's default registrant contact (the legal registrant of every domain bought with it)")
|
|
369
|
-
.option('--org <id>').option('--json').action(guard((o) => domainCmd.domainContactShow(o)));
|
|
370
|
-
domContact.command('set').description('Set the org default registrant contact (admin) from flags or --contact-file <path>; --company-name makes that organization the legal registrant')
|
|
371
|
-
.option('--first-name <s>').option('--last-name <s>').option('--company-name <s>').option('--address1 <s>').option('--address2 <s>').option('--city <s>').option('--state <s>').option('--zip <s>')
|
|
372
|
-
.option('--country <cc>', 'ISO 3166-1 alpha-2, e.g. US').option('--email <s>').option('--phone <e164>', 'E.164, e.g. +14155550100')
|
|
373
|
-
.option('--contact-file <path>', 'JSON file with the contact fields').option('--org <id>').option('--json')
|
|
374
|
-
// `contact --org X set` parks --org on the GROUP (enablePositionalOptions); without this merge the
|
|
375
|
-
// wrong org's registrant contact is written, and that field is legal ownership.
|
|
376
|
-
.action(guard((o) => domainCmd.domainContactSet({ ...domContact.opts(), ...o })));
|
|
377
367
|
const bill = program.command('billing').description('Current billing cycle overview (tier / used / included / overage / credits / forecast + per-dimension & per-project breakdown)')
|
|
378
368
|
.option('--org <id>', 'target org (default: linked project\'s org)').option('--json')
|
|
379
369
|
.action(guard((o) => billing(o)));
|