groundmail-cli 0.49.0 → 0.50.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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/dist/cli.js +29 -6
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -81,7 +81,7 @@ groundmail batches get batch_… # status counts for a
81
81
  groundmail batches cancel batch_… # cancel the batch's emails that are still scheduled
82
82
  groundmail brand set --logo-url https://cdn.acme.com/logo.png --color '#2f6feb' --company "Acme Inc" # logo, color and footer every template follows
83
83
  groundmail senders list # saved senders; send with --sender billing instead of --from
84
- SENDGRID_API_KEY=… groundmail migrate sendgrid --dry-run # import from SendGrid, Postmark, Mailgun, Resend or Amazon SES (beta)
84
+ SENDGRID_API_KEY=… groundmail migrate sendgrid --dry-run # import from SendGrid, Postmark, Mailgun, Resend, Amazon SES or Azure Communication Services (beta)
85
85
  ```
86
86
 
87
87
  Run `groundmail --help` or `groundmail <command> --help` for flags.
package/dist/cli.js CHANGED
@@ -2103,7 +2103,7 @@ async function runListKeysCommandWithClient(args, env = process.env) {
2103
2103
  }
2104
2104
 
2105
2105
  // package.json
2106
- var version = "0.49.0";
2106
+ var version = "0.50.1";
2107
2107
 
2108
2108
  // src/help.ts
2109
2109
  var USAGE_LINES = [
@@ -2233,6 +2233,7 @@ var USAGE_LINES = [
2233
2233
  " groundmail migrate mailgun [--dry-run] [--only \u2026] [--region eu] import from Mailgun (Beta)",
2234
2234
  " groundmail migrate resend [--dry-run] [--only \u2026] import from Resend (Beta; a Full access key)",
2235
2235
  " groundmail migrate ses --region us-east-1 [--dry-run] [--only \u2026] import one Amazon SES region (Beta)",
2236
+ " groundmail migrate azure --subscription <id> [--dry-run] [--only \u2026] import from Azure Communication Services (Beta; connect Azure first)",
2236
2237
  " groundmail migrate list your recent imports",
2237
2238
  " groundmail migrate report <id> [--csv] an import report (JSON, or CSV to stdout)",
2238
2239
  " groundmail integrations twilio status",
@@ -4751,7 +4752,7 @@ async function switchWorkspace(argv, deps) {
4751
4752
  }
4752
4753
 
4753
4754
  // src/commands/migrate.ts
4754
- var PROVIDERS2 = ["sendgrid", "postmark", "mailgun", "resend", "ses"];
4755
+ var PROVIDERS2 = ["sendgrid", "postmark", "mailgun", "resend", "ses", "azure"];
4755
4756
  var RESOURCES = ["domains", "webhooks", "templates", "suppressions"];
4756
4757
  var KEY_ENV = {
4757
4758
  sendgrid: "SENDGRID_API_KEY",
@@ -4764,7 +4765,8 @@ var LABELS = {
4764
4765
  postmark: "Postmark",
4765
4766
  mailgun: "Mailgun",
4766
4767
  resend: "Resend",
4767
- ses: "Amazon SES"
4768
+ ses: "Amazon SES",
4769
+ azure: "Azure Communication Services"
4768
4770
  };
4769
4771
  var AWS_REGION = /^[a-z]{2}(?:-gov)?-[a-z]+-\d{1,2}$/;
4770
4772
  function sesParams(args, env) {
@@ -4788,7 +4790,22 @@ function sesParams(args, env) {
4788
4790
  aws_region: region
4789
4791
  };
4790
4792
  }
4791
- var VALUE_FLAGS5 = /* @__PURE__ */ new Set(["--api-key", "--base-url"]);
4793
+ var GUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
4794
+ function azureParams(args, env) {
4795
+ const subscription = readFlag25(args, "--subscription") || env.AZURE_SUBSCRIPTION_ID;
4796
+ if (!subscription) {
4797
+ return [
4798
+ "Missing the Azure subscription. Pass --subscription <id> or set AZURE_SUBSCRIPTION_ID (find it with: az account show --query id -o tsv).",
4799
+ "Before the first import, connect your Microsoft Entra tenant in the dashboard (API keys \u2192 New credential \u2192 Azure managed identity \u2192 Connect Azure)",
4800
+ "and give the Groundmail app the Reader role on the resource group that holds your Email Communication Service."
4801
+ ].join(" ");
4802
+ }
4803
+ if (!GUID.test(subscription)) return `--subscription must be an Azure subscription ID (a GUID), not ${subscription}`;
4804
+ const tenant = readFlag25(args, "--tenant") || env.AZURE_TENANT_ID;
4805
+ if (tenant && !GUID.test(tenant)) return `--tenant must be a Microsoft Entra tenant ID (a GUID), not ${tenant}`;
4806
+ return { provider: "azure", azure_subscription_id: subscription, ...tenant ? { azure_tenant_id: tenant } : {} };
4807
+ }
4808
+ var VALUE_FLAGS5 = /* @__PURE__ */ new Set(["--api-key", "--base-url", "--subscription", "--tenant"]);
4792
4809
  function readFlag25(args, flag) {
4793
4810
  const index = args.indexOf(flag);
4794
4811
  if (index === -1) return void 0;
@@ -4810,7 +4827,9 @@ function formatMigrationSummary(m) {
4810
4827
  m.provider === "ses" ? " Webhooks reported, not imported (SES has no webhooks; see the notes)" : ` Webhooks ${n(m.webhooks.totals.imported)} of ${n(m.webhooks.totals.found)} (created disabled)`
4811
4828
  );
4812
4829
  }
4813
- if (m.templates) {
4830
+ if (m.templates && m.provider === "azure") {
4831
+ lines.push(" Templates none (Azure Communication Services has no stored templates)");
4832
+ } else if (m.templates) {
4814
4833
  const t = m.templates.totals;
4815
4834
  lines.push(` Templates ${n(t.imported)} ready, ${n(t.needs_attention)} to review, of ${n(t.found)}`);
4816
4835
  }
@@ -4900,7 +4919,7 @@ async function runMigrateCommand(provider, args, env = process.env) {
4900
4919
  if (!provider || !PROVIDERS2.includes(provider)) {
4901
4920
  return {
4902
4921
  exitCode: 1,
4903
- error: "Usage: groundmail migrate <sendgrid|postmark|mailgun|resend|ses> [--dry-run] [--only templates,suppressions], groundmail migrate list, or groundmail migrate report <id> [--csv]"
4922
+ error: "Usage: groundmail migrate <sendgrid|postmark|mailgun|resend|ses|azure> [--dry-run] [--only templates,suppressions], groundmail migrate list, or groundmail migrate report <id> [--csv]"
4904
4923
  };
4905
4924
  }
4906
4925
  const id = provider;
@@ -4913,6 +4932,10 @@ async function runMigrateCommand(provider, args, env = process.env) {
4913
4932
  const ses = sesParams(args, env);
4914
4933
  if (typeof ses === "string") return { exitCode: 1, error: ses };
4915
4934
  params = ses;
4935
+ } else if (id === "azure") {
4936
+ const azure = azureParams(args, env);
4937
+ if (typeof azure === "string") return { exitCode: 1, error: azure };
4938
+ params = azure;
4916
4939
  } else {
4917
4940
  const providerKey = readFlag25(args, "--key") || env[KEY_ENV[id]];
4918
4941
  if (!providerKey) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "groundmail-cli",
3
- "version": "0.49.0",
3
+ "version": "0.50.1",
4
4
  "description": "Groundmail CLI: send email and manage mailboxes 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.51.0"
41
+ "groundmail": "0.52.1"
42
42
  },
43
43
  "devDependencies": {
44
44
  "tsup": "^9.0.0",