groundmail-cli 0.55.7 → 0.56.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.
Files changed (2) hide show
  1. package/dist/cli.js +24 -5
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -2109,7 +2109,7 @@ async function runListKeysCommandWithClient(args, env = process.env) {
2109
2109
  }
2110
2110
 
2111
2111
  // package.json
2112
- var version = "0.55.7";
2112
+ var version = "0.56.0";
2113
2113
 
2114
2114
  // src/help.ts
2115
2115
  var USAGE_LINES = [
@@ -2248,7 +2248,7 @@ var USAGE_LINES = [
2248
2248
  " groundmail lists add <list> (--emails a@example.com,b@example.com | --ids <contact id>,\u2026) existing contacts; unknown ones come back in not_found",
2249
2249
  " groundmail lists remove <list> <contact id> the contact stays",
2250
2250
  " groundmail broadcasts list [--limit 25] [--cursor \u2026]",
2251
- ' groundmail broadcasts create --name "December" --lists newsletter --from "Acme <news@mail.acme.dev>" (--template <template> | --subject \u2026 (--html \u2026 | --html-file email.html) [--text \u2026|--text-file \u2026]) [--reply-to \u2026] [--preheader \u2026] a draft; nothing is sent',
2251
+ ' groundmail broadcasts create --name "December" --lists newsletter --from "Acme <news@mail.acme.dev>" --subject \u2026 (--design-file layout.json | --html \u2026 | --html-file email.html | --template <template>) [--text \u2026|--text-file \u2026] [--reply-to \u2026] [--preheader \u2026] a draft; nothing is sent. A layout renders with your brand',
2252
2252
  " groundmail broadcasts get <id>",
2253
2253
  " groundmail broadcasts update <id> [the create flags; none clears one] drafts only",
2254
2254
  " groundmail broadcasts delete <id> --yes drafts only",
@@ -5964,9 +5964,14 @@ async function draftFields(args, read = readText) {
5964
5964
  if (html !== void 0 && htmlFile !== void 0) return { error: "Pass --html or --html-file, not both" };
5965
5965
  if (text !== void 0 && textFile !== void 0) return { error: "Pass --text or --text-file, not both" };
5966
5966
  const template = clearable2(readFlag28(args, "--template"));
5967
- if (template && (html !== void 0 || htmlFile !== void 0 || text !== void 0 || textFile !== void 0)) {
5967
+ const inline = html !== void 0 || htmlFile !== void 0 || text !== void 0 || textFile !== void 0;
5968
+ if (template && inline) {
5968
5969
  return { error: "Use --template or --html/--text, not both" };
5969
5970
  }
5971
+ const designFile = readFlag28(args, "--design-file");
5972
+ const designFlag = readFlag28(args, "--design");
5973
+ if (designFlag !== void 0 && designFlag !== "none") return { error: "Pass the layout with --design-file layout.json (--design none clears it)" };
5974
+ if (designFile !== void 0 && (template || inline)) return { error: "Use one of --design-file, --template or --html/--text" };
5970
5975
  const out = {};
5971
5976
  const name = readFlag28(args, "--name");
5972
5977
  if (name !== void 0) out.name = name;
@@ -5979,6 +5984,20 @@ async function draftFields(args, read = readText) {
5979
5984
  if (value !== void 0) out[key] = value;
5980
5985
  }
5981
5986
  if (template !== void 0) out.template = template;
5987
+ if (designFlag === "none") out.design = null;
5988
+ if (designFile !== void 0) {
5989
+ let raw;
5990
+ try {
5991
+ raw = await read(designFile);
5992
+ } catch (error) {
5993
+ return { error: `Can't read ${designFile}: ${error instanceof Error ? error.message : String(error)}` };
5994
+ }
5995
+ try {
5996
+ out.design = JSON.parse(raw);
5997
+ } catch {
5998
+ return { error: `${designFile} is not JSON. It should hold a layout such as {"blocks":[{"type":"text","content":"Hi {{contact.first_name}}"}]}` };
5999
+ }
6000
+ }
5982
6001
  try {
5983
6002
  if (htmlFile !== void 0) out.html = await read(htmlFile);
5984
6003
  else if (html !== void 0) out.html = clearable2(html);
@@ -5989,7 +6008,7 @@ async function draftFields(args, read = readText) {
5989
6008
  }
5990
6009
  return { value: out };
5991
6010
  }
5992
- var CREATE_USAGE = 'groundmail broadcasts create --name "December" --lists newsletter --from "Acme <news@mail.acme.dev>" (--template <template> | --subject \u2026 (--html \u2026 | --html-file email.html) [--text \u2026])';
6011
+ var CREATE_USAGE = 'groundmail broadcasts create --name "December" --lists newsletter --from "Acme <news@mail.acme.dev>" --subject \u2026 (--design-file layout.json | --html \u2026 | --html-file email.html | --template <template>) [--text \u2026]';
5993
6012
  async function runBroadcastsList(args, env = process.env) {
5994
6013
  const page = pageFlags(args);
5995
6014
  if ("error" in page) return { exitCode: 1, error: page.error };
@@ -6008,7 +6027,7 @@ async function runBroadcastsGet(args, env = process.env) {
6008
6027
  return withClient5(args, env, (client3) => client3.broadcasts.get(id));
6009
6028
  }
6010
6029
  async function runBroadcastsUpdate(args, env = process.env, read = readText) {
6011
- const usage = "groundmail broadcasts update <id> [--name \u2026] [--lists \u2026] [--from \u2026] [--subject \u2026] [--html \u2026|--html-file \u2026] [--template \u2026|none]";
6030
+ const usage = "groundmail broadcasts update <id> [--name \u2026] [--lists \u2026] [--from \u2026] [--subject \u2026] [--design-file \u2026|--design none] [--html \u2026|--html-file \u2026] [--template \u2026|none]";
6012
6031
  const id = positionals4(args)[0];
6013
6032
  if (!id) return usageError("Missing the broadcast id", usage);
6014
6033
  const fields = await draftFields(args, read);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "groundmail-cli",
3
- "version": "0.55.7",
3
+ "version": "0.56.0",
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.61.6"
41
+ "groundmail": "0.62.0"
42
42
  },
43
43
  "devDependencies": {
44
44
  "tsup": "^9.0.0",