shipmail-cli 0.4.13 → 0.4.14

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 +50 -14
  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.14";
18
18
 
19
19
  // src/cli.ts
20
20
  var DEFAULT_BASE_URL = "https://shipmail.to/api/v1";
@@ -371,12 +371,13 @@ Usage:
371
371
  shipmail mailboxes forwarding <id>
372
372
  shipmail mailboxes forwarding-add <id> --destination owner@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]
@@ -849,6 +850,53 @@ async function runMailboxes(client, parsed, out) {
849
850
  writeJson(out, { ok: true, id: forwardingId });
850
851
  return;
851
852
  }
853
+ if (subcommand === "delivery-routing") {
854
+ writeJson(
855
+ out,
856
+ await client.mailboxes.getDeliveryRouting(
857
+ requirePositional(parsed.positional, 2, "mailbox id")
858
+ )
859
+ );
860
+ return;
861
+ }
862
+ if (subcommand === "delivery-routing-set") {
863
+ const mailboxId = requirePositional(parsed.positional, 2, "mailbox id");
864
+ const mode = getRequiredString(parsed.options, "mode");
865
+ const destinationMailboxIds = getStringList(parsed.options, "destination-mailbox-id");
866
+ let params;
867
+ if (mode === "keep") {
868
+ if (destinationMailboxIds.length > 0 || getString(parsed.options, "fallback-mailbox-id")) {
869
+ throw new CliUsageError(
870
+ "--destination-mailbox-id and --fallback-mailbox-id cannot be used with --mode keep."
871
+ );
872
+ }
873
+ params = { mode: "keep" };
874
+ } else if (mode === "fixed") {
875
+ if (destinationMailboxIds.length !== 1) {
876
+ throw new CliUsageError("--mode fixed requires exactly one --destination-mailbox-id.");
877
+ }
878
+ params = {
879
+ mode: "fixed",
880
+ destination_mailbox_id: destinationMailboxIds[0],
881
+ fallback_mailbox_id: getRequiredString(parsed.options, "fallback-mailbox-id")
882
+ };
883
+ } else if (mode === "round-robin") {
884
+ if (destinationMailboxIds.length < 2) {
885
+ throw new CliUsageError(
886
+ "--mode round-robin requires at least two --destination-mailbox-id values."
887
+ );
888
+ }
889
+ params = {
890
+ mode: "round_robin",
891
+ destination_mailbox_ids: destinationMailboxIds,
892
+ fallback_mailbox_id: getRequiredString(parsed.options, "fallback-mailbox-id")
893
+ };
894
+ } else {
895
+ throw new CliUsageError("--mode must be keep, fixed, or round-robin.");
896
+ }
897
+ writeJson(out, await client.mailboxes.updateDeliveryRouting(mailboxId, params));
898
+ return;
899
+ }
852
900
  if (subcommand === "stage-attachment") {
853
901
  const mailboxId = requirePositional(parsed.positional, 2, "mailbox id");
854
902
  const filePath = requirePositional(parsed.positional, 3, "file");
@@ -1288,18 +1336,6 @@ async function runMembers(client, parsed, out) {
1288
1336
  writeJson(out, await client.members.get(memberId));
1289
1337
  return;
1290
1338
  }
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
1339
  throw new CliUsageError("Unknown members command.");
1304
1340
  }
1305
1341
  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.14",
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.23"
45
45
  },
46
46
  "devDependencies": {
47
47
  "tsup": "^8.4.0",