groundmail-cli 0.27.0 → 0.28.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 +2 -1
- package/dist/cli.js +30 -18
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -81,7 +81,8 @@ groundmail test-inbox list --to "$TO"
|
|
|
81
81
|
## Tenants
|
|
82
82
|
|
|
83
83
|
If you send email for your own customers, give each one a tenant: its own domains,
|
|
84
|
-
suppression list, stats, pause switch and daily limit
|
|
84
|
+
suppression list, stats, pause switch and daily limit. Tenants are included on pay as you
|
|
85
|
+
go and the Dedicated plan.
|
|
85
86
|
|
|
86
87
|
```bash
|
|
87
88
|
groundmail tenants create cus_123 --name Acme --daily-limit 5000
|
package/dist/cli.js
CHANGED
|
@@ -790,6 +790,15 @@ async function runAddCommand(args, env = process.env) {
|
|
|
790
790
|
}
|
|
791
791
|
|
|
792
792
|
// src/commands/domains/apply.ts
|
|
793
|
+
var PROVIDERS = ["cloudflare", "vercel", "godaddy", "netlify", "digitalocean", "dnsimple"];
|
|
794
|
+
function hasLocalCredentials(provider, env) {
|
|
795
|
+
if (provider === "cloudflare") return Boolean(env.CLOUDFLARE_API_TOKEN || env.CLOUDFLARE_API_KEY);
|
|
796
|
+
if (provider === "vercel") return Boolean(env.VERCEL_API_TOKEN);
|
|
797
|
+
if (provider === "netlify") return Boolean(env.NETLIFY_AUTH_TOKEN);
|
|
798
|
+
if (provider === "digitalocean") return Boolean(env.DIGITALOCEAN_TOKEN || env.DIGITALOCEAN_ACCESS_TOKEN);
|
|
799
|
+
if (provider === "dnsimple") return Boolean(env.DNSIMPLE_TOKEN && env.DNSIMPLE_ACCOUNT_ID);
|
|
800
|
+
return true;
|
|
801
|
+
}
|
|
793
802
|
async function runApplyCommand(args, env = process.env) {
|
|
794
803
|
const options = parseDomainsCommonArgs(args);
|
|
795
804
|
const apiKey = resolveApiKey3(options, env);
|
|
@@ -798,10 +807,10 @@ async function runApplyCommand(args, env = process.env) {
|
|
|
798
807
|
}
|
|
799
808
|
const providerFlag = args.includes("--provider") ? args[args.indexOf("--provider") + 1] : void 0;
|
|
800
809
|
const provider = (providerFlag || "").toLowerCase();
|
|
801
|
-
if (provider
|
|
810
|
+
if (!PROVIDERS.includes(provider)) {
|
|
802
811
|
return {
|
|
803
812
|
exitCode: 1,
|
|
804
|
-
error:
|
|
813
|
+
error: `Missing or invalid --provider. Use one of: ${PROVIDERS.join(", ")}.`
|
|
805
814
|
};
|
|
806
815
|
}
|
|
807
816
|
const idOrName = options.id || options.name || args.find((arg, i) => {
|
|
@@ -820,23 +829,25 @@ async function runApplyCommand(args, env = process.env) {
|
|
|
820
829
|
}
|
|
821
830
|
try {
|
|
822
831
|
const client2 = await createDomainsClient(apiKey, options.baseUrl);
|
|
823
|
-
const
|
|
824
|
-
const
|
|
825
|
-
const
|
|
826
|
-
const useStoredVercel = provider === "vercel" && !localVercel;
|
|
827
|
-
const result = useStoredCloudflare || useStoredVercel ? await client2.domains.apply(idOrName, { provider }) : await client2.domains.applyDns({
|
|
832
|
+
const dnsProvider = provider;
|
|
833
|
+
const useStored = !hasLocalCredentials(dnsProvider, env);
|
|
834
|
+
const result = useStored ? await client2.domains.apply(idOrName, { provider: dnsProvider }) : await client2.domains.applyDns({
|
|
828
835
|
idOrName,
|
|
829
|
-
provider,
|
|
830
|
-
cloudflareApiToken:
|
|
836
|
+
provider: dnsProvider,
|
|
837
|
+
cloudflareApiToken: env.CLOUDFLARE_API_TOKEN || env.CLOUDFLARE_API_KEY,
|
|
831
838
|
cloudflareZoneId: env.CLOUDFLARE_ZONE_ID,
|
|
832
839
|
godaddyApiKey: env.GODADDY_API_KEY,
|
|
833
840
|
godaddyApiSecret: env.GODADDY_API_SECRET,
|
|
834
|
-
vercelApiToken:
|
|
835
|
-
vercelTeamId: env.VERCEL_TEAM_ID
|
|
841
|
+
vercelApiToken: env.VERCEL_API_TOKEN,
|
|
842
|
+
vercelTeamId: env.VERCEL_TEAM_ID,
|
|
843
|
+
netlifyApiToken: env.NETLIFY_AUTH_TOKEN,
|
|
844
|
+
digitaloceanApiToken: env.DIGITALOCEAN_TOKEN || env.DIGITALOCEAN_ACCESS_TOKEN,
|
|
845
|
+
dnsimpleApiToken: env.DNSIMPLE_TOKEN,
|
|
846
|
+
dnsimpleAccountId: env.DNSIMPLE_ACCOUNT_ID
|
|
836
847
|
});
|
|
837
848
|
console.log(JSON.stringify(result));
|
|
838
849
|
console.error(
|
|
839
|
-
|
|
850
|
+
useStored ? `Applied ${result.results.length} DNS change(s) via your connected ${provider} account for ${result.domain}.` : `Applied ${result.results.length} DNS change(s) via ${result.provider} for ${result.domain}.`
|
|
840
851
|
);
|
|
841
852
|
for (const row of result.results) {
|
|
842
853
|
console.error(` ${row.action.padEnd(10)} ${row.purpose} \u2192 ${row.host}`);
|
|
@@ -1452,7 +1463,7 @@ function trimUrl(value) {
|
|
|
1452
1463
|
}
|
|
1453
1464
|
|
|
1454
1465
|
// package.json
|
|
1455
|
-
var version = "0.
|
|
1466
|
+
var version = "0.28.0";
|
|
1456
1467
|
|
|
1457
1468
|
// src/user-agent.ts
|
|
1458
1469
|
function buildUserAgent(own) {
|
|
@@ -3450,7 +3461,7 @@ async function switchWorkspace(argv, deps) {
|
|
|
3450
3461
|
}
|
|
3451
3462
|
|
|
3452
3463
|
// src/commands/migrate.ts
|
|
3453
|
-
var
|
|
3464
|
+
var PROVIDERS2 = ["sendgrid", "postmark", "mailgun"];
|
|
3454
3465
|
var RESOURCES = ["domains", "webhooks", "templates", "suppressions"];
|
|
3455
3466
|
var KEY_ENV = {
|
|
3456
3467
|
sendgrid: "SENDGRID_API_KEY",
|
|
@@ -3561,7 +3572,7 @@ async function runStoredCommand(sub, args, env) {
|
|
|
3561
3572
|
}
|
|
3562
3573
|
async function runMigrateCommand(provider, args, env = process.env) {
|
|
3563
3574
|
if (provider === "list" || provider === "report") return runStoredCommand(provider, args, env);
|
|
3564
|
-
if (!provider || !
|
|
3575
|
+
if (!provider || !PROVIDERS2.includes(provider)) {
|
|
3565
3576
|
return {
|
|
3566
3577
|
exitCode: 1,
|
|
3567
3578
|
error: "Usage: groundmail migrate <sendgrid|postmark|mailgun> [--dry-run] [--only templates,suppressions], groundmail migrate list, or groundmail migrate report <id> [--csv]"
|
|
@@ -3643,6 +3654,7 @@ async function runValidateCommand(args, env = process.env) {
|
|
|
3643
3654
|
}
|
|
3644
3655
|
|
|
3645
3656
|
// src/commands/dmarc/dmarc.ts
|
|
3657
|
+
var DMARC_APPLY_PROVIDERS = ["cloudflare", "vercel", "godaddy", "netlify", "digitalocean", "dnsimple"];
|
|
3646
3658
|
function readFlag23(args, flag) {
|
|
3647
3659
|
const index = args.indexOf(flag);
|
|
3648
3660
|
if (index === -1) return void 0;
|
|
@@ -3717,8 +3729,8 @@ async function runDmarcCommand(subcommand, args, env = process.env) {
|
|
|
3717
3729
|
}
|
|
3718
3730
|
if (subcommand === "enable") {
|
|
3719
3731
|
const apply = readFlag23(args, "--apply");
|
|
3720
|
-
if (apply && apply
|
|
3721
|
-
return { exitCode: 1, error:
|
|
3732
|
+
if (apply && !DMARC_APPLY_PROVIDERS.includes(apply)) {
|
|
3733
|
+
return { exitCode: 1, error: `--apply must be one of: ${DMARC_APPLY_PROVIDERS.join(", ")}` };
|
|
3722
3734
|
}
|
|
3723
3735
|
const result2 = await client2.dmarc.enable(domain, apply ? { apply } : {});
|
|
3724
3736
|
if (json) console.log(JSON.stringify(result2));
|
|
@@ -3837,7 +3849,7 @@ var USAGE_LINES = [
|
|
|
3837
3849
|
" groundmail domains verify example.com",
|
|
3838
3850
|
" groundmail domains delete example.com",
|
|
3839
3851
|
" groundmail dmarc status example.com [--json] DMARC monitoring: sources, pass rates, readiness",
|
|
3840
|
-
" groundmail dmarc enable example.com [--apply cloudflare|vercel|godaddy] report address and the record to publish",
|
|
3852
|
+
" groundmail dmarc enable example.com [--apply cloudflare|vercel|godaddy|netlify|digitalocean|dnsimple] report address and the record to publish",
|
|
3841
3853
|
" groundmail dmarc digest example.com --on|--off weekly digest email",
|
|
3842
3854
|
" groundmail dmarc disable example.com",
|
|
3843
3855
|
" groundmail received-emails list [--domain inbound.example.com]",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "groundmail-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.0",
|
|
4
4
|
"description": "Groundmail CLI — send transactional email from the terminal",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"prepublishOnly": "npm run build"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"groundmail": "0.
|
|
41
|
+
"groundmail": "0.27.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"tsup": "^8.5.0",
|