shipmail-cli 0.4.13 → 0.4.15

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 +67 -22
  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.13";
17
+ var VERSION = "0.4.15";
18
18
 
19
19
  // src/cli.ts
20
20
  var DEFAULT_BASE_URL = "https://shipmail.to/api/v1";
@@ -369,14 +369,15 @@ Usage:
369
369
  shipmail mailboxes identities <id>
370
370
  shipmail mailboxes rules <id>
371
371
  shipmail mailboxes forwarding <id>
372
- shipmail mailboxes forwarding-add <id> --destination owner@example.com
372
+ shipmail mailboxes forwarding-add <id> --destination owner@example.com [--sender newsletter@example.com]
373
373
  shipmail mailboxes forwarding-remove <id> <forwarding-id>
374
+ shipmail mailboxes delivery-routing <id>
375
+ shipmail mailboxes delivery-routing-set <id> --mode keep|fixed|round-robin [--destination-mailbox-id mbx_...] [--fallback-mailbox-id mbx_...]
374
376
  shipmail mailboxes prepare-attachment-upload <id> <file> [--filename name] [--content-type type]
375
377
  shipmail mailboxes stage-attachment <id> <file> [--filename name] [--content-type type]
376
378
  shipmail mailboxes sandbox-inbound <id> --from sender@example.com --subject "Test" (--text "Hello" | --html "<p>Hello</p>") [--to support@example.com]
377
379
  shipmail members list [--limit 25] [--cursor cur]
378
380
  shipmail members get <id>
379
- shipmail members update <id> --away-from ISO|null --away-until ISO|null
380
381
  shipmail inbox list <mailbox-id> [--folder-role inbox] [--search text] [--after ISO] [--before ISO] [--limit 25] [--cursor cur]
381
382
  shipmail inbox message <mailbox-id> <message-id>
382
383
  shipmail inbox threads <mailbox-id> [--attention-state needs_reply] [--after ISO] [--before ISO] [--limit 25] [--cursor cur]
@@ -384,15 +385,15 @@ Usage:
384
385
  shipmail inbox thread-attention <mailbox-id> <thread-id> --done true --expected-version 3
385
386
  shipmail inbox draft <mailbox-id> <thread-id> --expected-version 3 (--text "Hello" | --html "<p>Hello</p>") [--reply-mode reply_all]
386
387
  shipmail inbox send-draft <mailbox-id> <thread-id> <draft-id>
387
- shipmail inbox reply-message <mailbox-id> <message-id> --to user@example.com (--text "Hello" | --html "<p>Hello</p>") [--track-reply]
388
- shipmail inbox reply-thread <mailbox-id> <thread-id> --to user@example.com (--text "Hello" | --html "<p>Hello</p>") [--track-reply]
388
+ shipmail inbox reply-message <mailbox-id> <message-id> --to user@example.com (--text "Hello" | --html "<p>Hello</p>") [--track-reply true|false]
389
+ shipmail inbox reply-thread <mailbox-id> <thread-id> --to user@example.com (--text "Hello" | --html "<p>Hello</p>") [--track-reply true|false]
389
390
  shipmail inbox update <mailbox-id> <message-id> [--read true] [--starred false]
390
391
  shipmail inbox move <mailbox-id> <message-id> (--target-role archive | --target-folder-id fld)
391
- shipmail messages send --mailbox-id mbx --to user@example.com --subject "Hi" --text "Hello" [--track-reply] [--sandbox-outcome delivered|bounced|complained] [--client-reference crm-123] [--metadata JSON|@file] [--source-rfc-message-id '<crm-123@example.com>'] [--header 'X-CRM-ID: 123']
392
+ shipmail messages send --mailbox-id mbx --to user@example.com --subject "Hi" --text "Hello" [--track-reply true|false] [--sandbox-outcome delivered|bounced|complained] [--client-reference crm-123] [--metadata JSON|@file] [--source-rfc-message-id '<crm-123@example.com>'] [--header 'X-CRM-ID: 123']
392
393
  shipmail messages list (--mailbox-id mbx | --client-reference crm-123) [--limit 25] [--cursor cur]
393
394
  shipmail messages analytics [--updated-after ISO] [--updated-before ISO] [--limit 100] [--cursor cur]
394
395
  shipmail messages get <message-id>
395
- shipmail messages reply <message-id> --to user@example.com (--text "Hello" | --html "<p>Hello</p>") [--track-reply] [--client-reference crm-reply-123]
396
+ shipmail messages reply <message-id> --to user@example.com (--text "Hello" | --html "<p>Hello</p>") [--track-reply true|false] [--client-reference crm-reply-123]
396
397
  shipmail scheduled-messages list [--include-held] [--search text] [--limit 100]
397
398
  shipmail scheduled-messages get <message-id>
398
399
  shipmail scheduled-messages update <message-id> --to user@example.com --subject "Hi" --scheduled-at ISO (--text "Hello" | --html "<p>Hello</p>") [--staged-attachment-id sat_...]
@@ -586,7 +587,10 @@ async function sendMessageParams(options) {
586
587
  ...headers.length > 0 ? { headers } : {},
587
588
  ...getStringList(options, "staged-attachment-id").length > 0 ? { staged_attachment_ids: getStringList(options, "staged-attachment-id") } : {},
588
589
  ...getString(options, "scheduled-at") ? { scheduled_at: getString(options, "scheduled-at") } : {},
589
- ...getBoolean(options, "track-reply") ? { track_reply: true } : {},
590
+ ...(() => {
591
+ const trackReply = getBoolean(options, "track-reply");
592
+ return trackReply === void 0 ? {} : { track_reply: trackReply };
593
+ })(),
590
594
  ...getString(options, "sandbox-outcome") ? {
591
595
  sandbox_outcome: getEnum(options, "sandbox-outcome", [
592
596
  "delivered",
@@ -615,7 +619,10 @@ async function replyToMessageParams(options) {
615
619
  ...getString(options, "source-rfc-message-id") ? { source_rfc_message_id: getString(options, "source-rfc-message-id") } : {},
616
620
  ...headers.length > 0 ? { headers } : {},
617
621
  ...getString(options, "scheduled-at") ? { scheduled_at: getString(options, "scheduled-at") } : {},
618
- ...getBoolean(options, "track-reply") ? { track_reply: true } : {},
622
+ ...(() => {
623
+ const trackReply = getBoolean(options, "track-reply");
624
+ return trackReply === void 0 ? {} : { track_reply: trackReply };
625
+ })(),
619
626
  ...getString(options, "sandbox-outcome") ? {
620
627
  sandbox_outcome: getEnum(options, "sandbox-outcome", [
621
628
  "delivered",
@@ -837,7 +844,10 @@ async function runMailboxes(client, parsed, out) {
837
844
  out,
838
845
  await client.mailboxes.createForwarding(
839
846
  requirePositional(parsed.positional, 2, "mailbox id"),
840
- { destination: getRequiredString(parsed.options, "destination") }
847
+ {
848
+ destination: getRequiredString(parsed.options, "destination"),
849
+ sender: getString(parsed.options, "sender") ?? null
850
+ }
841
851
  )
842
852
  );
843
853
  return;
@@ -849,6 +859,53 @@ async function runMailboxes(client, parsed, out) {
849
859
  writeJson(out, { ok: true, id: forwardingId });
850
860
  return;
851
861
  }
862
+ if (subcommand === "delivery-routing") {
863
+ writeJson(
864
+ out,
865
+ await client.mailboxes.getDeliveryRouting(
866
+ requirePositional(parsed.positional, 2, "mailbox id")
867
+ )
868
+ );
869
+ return;
870
+ }
871
+ if (subcommand === "delivery-routing-set") {
872
+ const mailboxId = requirePositional(parsed.positional, 2, "mailbox id");
873
+ const mode = getRequiredString(parsed.options, "mode");
874
+ const destinationMailboxIds = getStringList(parsed.options, "destination-mailbox-id");
875
+ let params;
876
+ if (mode === "keep") {
877
+ if (destinationMailboxIds.length > 0 || getString(parsed.options, "fallback-mailbox-id")) {
878
+ throw new CliUsageError(
879
+ "--destination-mailbox-id and --fallback-mailbox-id cannot be used with --mode keep."
880
+ );
881
+ }
882
+ params = { mode: "keep" };
883
+ } else if (mode === "fixed") {
884
+ if (destinationMailboxIds.length !== 1) {
885
+ throw new CliUsageError("--mode fixed requires exactly one --destination-mailbox-id.");
886
+ }
887
+ params = {
888
+ mode: "fixed",
889
+ destination_mailbox_id: destinationMailboxIds[0],
890
+ fallback_mailbox_id: getRequiredString(parsed.options, "fallback-mailbox-id")
891
+ };
892
+ } else if (mode === "round-robin") {
893
+ if (destinationMailboxIds.length < 2) {
894
+ throw new CliUsageError(
895
+ "--mode round-robin requires at least two --destination-mailbox-id values."
896
+ );
897
+ }
898
+ params = {
899
+ mode: "round_robin",
900
+ destination_mailbox_ids: destinationMailboxIds,
901
+ fallback_mailbox_id: getRequiredString(parsed.options, "fallback-mailbox-id")
902
+ };
903
+ } else {
904
+ throw new CliUsageError("--mode must be keep, fixed, or round-robin.");
905
+ }
906
+ writeJson(out, await client.mailboxes.updateDeliveryRouting(mailboxId, params));
907
+ return;
908
+ }
852
909
  if (subcommand === "stage-attachment") {
853
910
  const mailboxId = requirePositional(parsed.positional, 2, "mailbox id");
854
911
  const filePath = requirePositional(parsed.positional, 3, "file");
@@ -1288,18 +1345,6 @@ async function runMembers(client, parsed, out) {
1288
1345
  writeJson(out, await client.members.get(memberId));
1289
1346
  return;
1290
1347
  }
1291
- if (subcommand === "update") {
1292
- const awayFrom = getRequiredString(parsed.options, "away-from");
1293
- const awayUntil = getRequiredString(parsed.options, "away-until");
1294
- writeJson(
1295
- out,
1296
- await client.members.update(memberId, {
1297
- away_from: awayFrom === "null" ? null : awayFrom,
1298
- away_until: awayUntil === "null" ? null : awayUntil
1299
- })
1300
- );
1301
- return;
1302
- }
1303
1348
  throw new CliUsageError("Unknown members command.");
1304
1349
  }
1305
1350
  async function runSuppressions(client, parsed, out) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shipmail-cli",
3
- "version": "0.4.13",
3
+ "version": "0.4.15",
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.22"
44
+ "shipmail": "0.4.24"
45
45
  },
46
46
  "devDependencies": {
47
47
  "tsup": "^8.4.0",