shipmail-cli 0.4.6 → 0.4.8

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 +82 -6
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -14,7 +14,7 @@ import {
14
14
  } from "shipmail";
15
15
 
16
16
  // src/version.ts
17
- var VERSION = "0.4.6";
17
+ var VERSION = "0.4.8";
18
18
 
19
19
  // src/cli.ts
20
20
  var DEFAULT_BASE_URL = "https://shipmail.to/api/v1";
@@ -185,6 +185,19 @@ function parseStylingMode(options) {
185
185
  if (value === "styled" || value === "plain") return value;
186
186
  throw new CliUsageError("--styling-mode must be styled or plain.");
187
187
  }
188
+ async function automationDefinition(value) {
189
+ const parsed = await readJsonInput(value);
190
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
191
+ throw new CliUsageError("--definition must be a JSON automation definition object.");
192
+ }
193
+ return parsed;
194
+ }
195
+ function automationStatus(options) {
196
+ const value = getString(options, "status");
197
+ if (value === void 0) return void 0;
198
+ if (value === "active" || value === "paused" || value === "disabled") return value;
199
+ throw new CliUsageError("--status must be active, paused, or disabled.");
200
+ }
188
201
  async function newsletterCreateParams(options) {
189
202
  const audience_id = getRequiredString(options, "audience-id");
190
203
  const sender_identity_id = getRequiredString(options, "sender-identity-id");
@@ -201,6 +214,7 @@ async function newsletterCreateParams(options) {
201
214
  }
202
215
  const send_window_hours = getNumber(options, "send-window-hours");
203
216
  const archive_visibility = parseArchiveVisibility(options);
217
+ const feed_entry_url = getString(options, "feed-entry-url");
204
218
  const styling_mode = parseStylingMode(options);
205
219
  const preview_text = getString(options, "preview-text");
206
220
  return {
@@ -214,6 +228,7 @@ async function newsletterCreateParams(options) {
214
228
  ...body_text !== void 0 ? { body_text } : {},
215
229
  ...send_window_hours !== void 0 ? { send_window_hours } : {},
216
230
  ...archive_visibility !== void 0 ? { archive_visibility } : {},
231
+ ...feed_entry_url !== void 0 ? { feed_entry_url } : {},
217
232
  ...styling_mode !== void 0 ? { styling_mode } : {}
218
233
  };
219
234
  }
@@ -225,6 +240,7 @@ async function newsletterUpdateParams(options) {
225
240
  const preview_text = getString(options, "preview-text");
226
241
  const send_window_hours = getNumber(options, "send-window-hours");
227
242
  const archive_visibility = parseArchiveVisibility(options);
243
+ const feed_entry_url = getString(options, "feed-entry-url");
228
244
  const styling_mode = parseStylingMode(options);
229
245
  const blocksInput = getString(options, "blocks");
230
246
  const bodyHtmlInput = getString(options, "body-html");
@@ -243,6 +259,7 @@ async function newsletterUpdateParams(options) {
243
259
  ...body_text !== void 0 ? { body_text } : {},
244
260
  ...send_window_hours !== void 0 ? { send_window_hours } : {},
245
261
  ...archive_visibility !== void 0 ? { archive_visibility } : {},
262
+ ...feed_entry_url !== void 0 ? { feed_entry_url } : {},
246
263
  ...styling_mode !== void 0 ? { styling_mode } : {}
247
264
  };
248
265
  if (Object.keys(params).length === 0) {
@@ -324,6 +341,11 @@ Usage:
324
341
  shipmail status
325
342
  shipmail capabilities
326
343
  shipmail api <METHOD> <PATH> [--data JSON|@file] [--output file]
344
+ shipmail automations list
345
+ shipmail automations create --name "Daily brief" --definition JSON|@file [--idempotency-key key]
346
+ shipmail automations get <id>
347
+ shipmail automations update <id> [--name "..."] [--definition JSON|@file] [--status active|paused|disabled] [--idempotency-key key]
348
+ shipmail automations run <id> [--idempotency-key key]
327
349
  shipmail domains list [--limit 25] [--cursor cur]
328
350
  shipmail domains search <keyword>
329
351
  shipmail domains create <name>
@@ -384,8 +406,8 @@ Usage:
384
406
  --name "July changelog" \\
385
407
  --subject "What shipped in July" \\
386
408
  --blocks @blocks.json \\
387
- [--styling-mode styled|plain]
388
- shipmail newsletters update nws_789 --subject "Updated subject" --blocks @blocks-v2.json [--styling-mode styled|plain]
409
+ [--feed-entry-url https://example.com/post] [--styling-mode styled|plain]
410
+ shipmail newsletters update nws_789 --subject "Updated subject" --blocks @blocks-v2.json [--feed-entry-url https://example.com/post] [--styling-mode styled|plain]
389
411
  shipmail newsletters preview <id>
390
412
  shipmail newsletters preflight <id>
391
413
  shipmail newsletters test-send <id> --recipient-email owner@example.com
@@ -415,9 +437,9 @@ Usage:
415
437
  shipmail audiences subscribers resubscribe <audience-id> <subscriber-id> --consent-source "Signup form"
416
438
  shipmail audiences subscribers remove <audience-id> <subscriber-id>
417
439
  shipmail calendar events list --mailbox hello@example.com --from 2026-08-01T00:00:00Z --to 2026-08-08T00:00:00Z [--expand true] [--limit 100]
418
- shipmail calendar events create --mailbox hello@example.com --title "Sync" --start 2026-08-01T14:00:00 [--timezone Europe/Paris] [--duration PT30M] [--attendees JSON|@file] [--reminders JSON|@file]
440
+ shipmail calendar events create --mailbox hello@example.com --title "Sync" --start 2026-08-01T14:00:00 [--timezone Europe/Paris] [--duration PT30M] [--invitation-language en|fr|es] [--attendees JSON|@file] [--reminders JSON|@file]
419
441
  shipmail calendar events get <event-id> --mailbox hello@example.com
420
- shipmail calendar events update <event-id> --mailbox hello@example.com [--title "..."] [--start ...]
442
+ shipmail calendar events update <event-id> --mailbox hello@example.com [--title "..."] [--start ...] [--invitation-language en|fr|es]
421
443
  shipmail calendar events delete <event-id> --mailbox hello@example.com
422
444
  shipmail calendar availability --mailbox hello@example.com --from 2026-08-03T00:00:00Z --to 2026-08-04T00:00:00Z [--duration 30] [--days 1,2,3,4,5] [--window-start 540] [--window-end 1020]
423
445
  shipmail booking-pages list [--limit 25] [--cursor cur]
@@ -444,6 +466,9 @@ Booking page conferencing:
444
466
  Newsletter styling:
445
467
  --styling-mode <styled|plain> styled applies Shipmail's email theme. plain sends your HTML without injected styles, width, or centering, so the reader's email client styles it.
446
468
 
469
+ Newsletter feeds:
470
+ --feed-entry-url <url> Link this issue's Atom feed title to an http(s) URL instead of its Shipmail archive.
471
+
447
472
  Global options:
448
473
  --api-key <key> API key. Defaults to SHIPMAIL_API_KEY.
449
474
  --base-url <url> API base URL. Defaults to SHIPMAIL_BASE_URL or ${DEFAULT_BASE_URL}.
@@ -1597,6 +1622,7 @@ var CALENDAR_EVENT_STATUSES = [
1597
1622
  ];
1598
1623
  var CALENDAR_FREE_BUSY_STATUSES = ["free", "busy"];
1599
1624
  var CALENDAR_PRIVACIES = ["public", "private", "secret"];
1625
+ var CALENDAR_INVITATION_LANGUAGES = ["en", "fr", "es"];
1600
1626
  function requireNumber(options, key) {
1601
1627
  const value = getNumber(options, key);
1602
1628
  if (value === void 0) throw new CliUsageError(`Missing --${key}.`);
@@ -1671,6 +1697,7 @@ async function calendarEventFields(options) {
1671
1697
  const status = getEnum(options, "status", CALENDAR_EVENT_STATUSES);
1672
1698
  const freeBusyStatus = getEnum(options, "free-busy-status", CALENDAR_FREE_BUSY_STATUSES);
1673
1699
  const privacy = getEnum(options, "privacy", CALENDAR_PRIVACIES);
1700
+ const invitationLanguage = getEnum(options, "invitation-language", CALENDAR_INVITATION_LANGUAGES);
1674
1701
  const reminders = await readRemindersInput(getString(options, "reminders"));
1675
1702
  const attendees = await readAttendeesInput(getString(options, "attendees"));
1676
1703
  return {
@@ -1684,6 +1711,7 @@ async function calendarEventFields(options) {
1684
1711
  ...status !== void 0 ? { status } : {},
1685
1712
  ...freeBusyStatus !== void 0 ? { free_busy_status: freeBusyStatus } : {},
1686
1713
  ...privacy !== void 0 ? { privacy } : {},
1714
+ ...invitationLanguage !== void 0 ? { invitation_language: invitationLanguage } : {},
1687
1715
  ...reminders !== void 0 ? { reminders } : {},
1688
1716
  ...attendees !== void 0 ? { attendees } : {}
1689
1717
  };
@@ -1839,6 +1867,53 @@ async function runBookingPages(client, parsed, out) {
1839
1867
  }
1840
1868
  throw new CliUsageError("Unknown booking-pages command.");
1841
1869
  }
1870
+ async function runAutomations(client, parsed, out) {
1871
+ const subcommand = parsed.positional[1];
1872
+ const idempotencyKey = getString(parsed.options, "idempotency-key");
1873
+ const options = idempotencyKey ? { idempotencyKey } : void 0;
1874
+ if (subcommand === "list") {
1875
+ writeJson(out, await client.automations.list());
1876
+ return;
1877
+ }
1878
+ if (subcommand === "create") {
1879
+ writeJson(
1880
+ out,
1881
+ await client.automations.create(
1882
+ {
1883
+ name: getRequiredString(parsed.options, "name"),
1884
+ definition: await automationDefinition(getRequiredString(parsed.options, "definition"))
1885
+ },
1886
+ options
1887
+ )
1888
+ );
1889
+ return;
1890
+ }
1891
+ const id = requirePositional(parsed.positional, 2, "automation id");
1892
+ if (subcommand === "get") {
1893
+ writeJson(out, await client.automations.get(id));
1894
+ return;
1895
+ }
1896
+ if (subcommand === "update") {
1897
+ const name = getString(parsed.options, "name");
1898
+ const definitionInput = getString(parsed.options, "definition");
1899
+ const status = automationStatus(parsed.options);
1900
+ const params = {
1901
+ ...name !== void 0 ? { name } : {},
1902
+ ...definitionInput !== void 0 ? { definition: await automationDefinition(definitionInput) } : {},
1903
+ ...status !== void 0 ? { status } : {}
1904
+ };
1905
+ if (Object.keys(params).length === 0) {
1906
+ throw new CliUsageError("Provide --name, --definition, or --status.");
1907
+ }
1908
+ writeJson(out, await client.automations.update(id, params, options));
1909
+ return;
1910
+ }
1911
+ if (subcommand === "run") {
1912
+ writeJson(out, await client.automations.run(id, options));
1913
+ return;
1914
+ }
1915
+ throw new CliUsageError("Unknown automations command.");
1916
+ }
1842
1917
  async function runPartner(client, parsed, out) {
1843
1918
  const group = parsed.positional[1];
1844
1919
  if (group === "usage") {
@@ -1994,7 +2069,8 @@ async function runCli(argv, options = {}) {
1994
2069
  return 0;
1995
2070
  }
1996
2071
  const client = createClient(parsed, options);
1997
- if (command === "domains") await runDomains(client, parsed, out);
2072
+ if (command === "automations") await runAutomations(client, parsed, out);
2073
+ else if (command === "domains") await runDomains(client, parsed, out);
1998
2074
  else if (command === "mailboxes") await runMailboxes(client, parsed, out);
1999
2075
  else if (command === "inbox") await runInbox(client, parsed, out);
2000
2076
  else if (command === "messages") await runMessages(client, parsed, out);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shipmail-cli",
3
- "version": "0.4.6",
3
+ "version": "0.4.8",
4
4
  "description": "Official CLI for the Shipmail API",
5
5
  "type": "module",
6
6
  "bin": {
@@ -41,7 +41,7 @@
41
41
  "access": "public"
42
42
  },
43
43
  "dependencies": {
44
- "shipmail": "0.4.13"
44
+ "shipmail": "0.4.15"
45
45
  },
46
46
  "devDependencies": {
47
47
  "tsup": "^8.4.0",