supersendtx-cli 0.3.0 → 0.6.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 +424 -18
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -6,13 +6,39 @@ function readFlag(args, flag) {
6
6
  if (index === -1) return void 0;
7
7
  return args[index + 1];
8
8
  }
9
+ function readFlags(args, flag) {
10
+ const values = [];
11
+ for (let index = 0; index < args.length; index += 1) {
12
+ if (args[index] === flag && args[index + 1]) values.push(args[index + 1]);
13
+ }
14
+ return values;
15
+ }
16
+ function parseTags(values) {
17
+ const tags = values.map((value) => {
18
+ const separator = value.indexOf("=");
19
+ if (separator <= 0) {
20
+ return null;
21
+ }
22
+ const name = value.slice(0, separator).trim();
23
+ const tagValue = value.slice(separator + 1).trim();
24
+ if (!name || !tagValue) return null;
25
+ return { name, value: tagValue };
26
+ });
27
+ if (tags.some((tag) => tag == null)) {
28
+ return { error: "--tag must be in name=value format" };
29
+ }
30
+ return tags;
31
+ }
9
32
  function parseSendCommandArgs(args) {
33
+ const parsedTags = parseTags(readFlags(args, "--tag"));
10
34
  return {
11
35
  from: readFlag(args, "--from"),
12
36
  to: readFlag(args, "--to"),
13
37
  subject: readFlag(args, "--subject"),
14
38
  html: readFlag(args, "--html"),
15
39
  text: readFlag(args, "--text"),
40
+ tags: Array.isArray(parsedTags) ? parsedTags : void 0,
41
+ scheduledAt: readFlag(args, "--schedule"),
16
42
  apiKey: readFlag(args, "--api-key"),
17
43
  baseUrl: readFlag(args, "--base-url")
18
44
  };
@@ -32,7 +58,9 @@ async function runSendCommand(args, deps) {
32
58
  to: options.to,
33
59
  subject: options.subject,
34
60
  html: options.html,
35
- text: options.text
61
+ text: options.text,
62
+ tags: options.tags,
63
+ scheduledAt: options.scheduledAt
36
64
  });
37
65
  stdout(JSON.stringify(result));
38
66
  return 0;
@@ -44,9 +72,13 @@ async function runSendCommand(args, deps) {
44
72
  function parseSendCommandOptions(args, env) {
45
73
  const parsed = parseSendCommandArgs(args);
46
74
  const apiKey = parsed.apiKey || env.SUPERSENDTX_API_KEY || env.SUPERTX_API_KEY;
75
+ const parsedTags = parseTags(readFlags(args, "--tag"));
47
76
  if (!apiKey) {
48
77
  return { error: "Missing API key. Set SUPERSENDTX_API_KEY or pass --api-key." };
49
78
  }
79
+ if ("error" in parsedTags) {
80
+ return { error: parsedTags.error };
81
+ }
50
82
  if (!parsed.from || !parsed.to || !parsed.subject) {
51
83
  return { error: "Required flags: --from --to --subject (and --html or --text)" };
52
84
  }
@@ -59,6 +91,8 @@ function parseSendCommandOptions(args, env) {
59
91
  subject: parsed.subject,
60
92
  html: parsed.html,
61
93
  text: parsed.text,
94
+ tags: parsedTags.length ? parsedTags : void 0,
95
+ scheduledAt: parsed.scheduledAt,
62
96
  apiKey,
63
97
  baseUrl: parsed.baseUrl
64
98
  };
@@ -82,18 +116,148 @@ async function runSendCommandWithClient(args, env = process.env) {
82
116
  return { exitCode };
83
117
  }
84
118
 
85
- // src/commands/domains/shared.ts
119
+ // src/commands/emails/cancel.ts
86
120
  function readFlag2(args, flag) {
87
121
  const index = args.indexOf(flag);
88
122
  if (index === -1) return void 0;
89
123
  return args[index + 1];
90
124
  }
125
+ async function runCancelCommand(args, deps) {
126
+ const env = deps.env ?? process.env;
127
+ const stdout = deps.stdout ?? ((line) => console.log(line));
128
+ const stderr = deps.stderr ?? ((line) => console.error(line));
129
+ const apiKey = readFlag2(args, "--api-key") || env.SUPERSENDTX_API_KEY || env.SUPERTX_API_KEY;
130
+ const id = readFlag2(args, "--id") || args.find((arg) => !arg.startsWith("--"));
131
+ if (!apiKey) {
132
+ stderr("Missing API key. Set SUPERSENDTX_API_KEY or pass --api-key.");
133
+ return { exitCode: 1, error: "missing key" };
134
+ }
135
+ if (!id) {
136
+ stderr("Required: --id <msg_\u2026>");
137
+ return { exitCode: 1, error: "missing id" };
138
+ }
139
+ try {
140
+ const result = await deps.cancelEmail(id);
141
+ stdout(JSON.stringify(result));
142
+ return { exitCode: 0 };
143
+ } catch (error) {
144
+ stderr(error instanceof Error ? error.message : String(error));
145
+ return { exitCode: 1, error: String(error) };
146
+ }
147
+ }
148
+ async function runCancelCommandWithClient(args, env = process.env) {
149
+ const apiKey = readFlag2(args, "--api-key") || env.SUPERSENDTX_API_KEY || env.SUPERTX_API_KEY;
150
+ const baseUrl = readFlag2(args, "--base-url");
151
+ if (!apiKey) {
152
+ return { exitCode: 1, error: "Missing API key. Set SUPERSENDTX_API_KEY or pass --api-key." };
153
+ }
154
+ const { SuperSendTX } = await import("supersendtx");
155
+ const client = new SuperSendTX(apiKey, baseUrl ? { baseUrl } : void 0);
156
+ return runCancelCommand(args, {
157
+ env,
158
+ cancelEmail: (id) => client.emails.cancel(id)
159
+ });
160
+ }
161
+
162
+ // src/commands/emails/get.ts
163
+ function readFlag3(args, flag) {
164
+ const index = args.indexOf(flag);
165
+ if (index === -1) return void 0;
166
+ return args[index + 1];
167
+ }
168
+ async function runGetCommand(args, deps) {
169
+ const env = deps.env ?? process.env;
170
+ const stdout = deps.stdout ?? ((line) => console.log(line));
171
+ const stderr = deps.stderr ?? ((line) => console.error(line));
172
+ const id = readFlag3(args, "--id") || args.find((a) => !a.startsWith("--"));
173
+ const apiKey = readFlag3(args, "--api-key") || env.SUPERSENDTX_API_KEY || env.SUPERTX_API_KEY;
174
+ if (!apiKey) {
175
+ stderr("Missing API key. Set SUPERSENDTX_API_KEY or pass --api-key.");
176
+ return { exitCode: 1, error: "missing key" };
177
+ }
178
+ if (!id) {
179
+ stderr("Required: --id <msg_\u2026>");
180
+ return { exitCode: 1, error: "missing id" };
181
+ }
182
+ try {
183
+ const result = await deps.getEmail(id);
184
+ stdout(JSON.stringify(result));
185
+ return { exitCode: 0 };
186
+ } catch (error) {
187
+ stderr(error instanceof Error ? error.message : String(error));
188
+ return { exitCode: 1, error: String(error) };
189
+ }
190
+ }
191
+ async function runGetCommandWithClient(args, env = process.env) {
192
+ const apiKey = readFlag3(args, "--api-key") || env.SUPERSENDTX_API_KEY || env.SUPERTX_API_KEY;
193
+ const baseUrl = readFlag3(args, "--base-url");
194
+ if (!apiKey) {
195
+ return { exitCode: 1, error: "Missing API key. Set SUPERSENDTX_API_KEY or pass --api-key." };
196
+ }
197
+ const { SuperSendTX } = await import("supersendtx");
198
+ const client = new SuperSendTX(apiKey, baseUrl ? { baseUrl } : void 0);
199
+ return runGetCommand(args, {
200
+ env,
201
+ getEmail: (id) => client.emails.get(id)
202
+ });
203
+ }
204
+
205
+ // src/commands/emails/list.ts
206
+ function readFlag4(args, flag) {
207
+ const index = args.indexOf(flag);
208
+ if (index === -1) return void 0;
209
+ return args[index + 1];
210
+ }
211
+ async function runListCommand(args, deps) {
212
+ const env = deps.env ?? process.env;
213
+ const stdout = deps.stdout ?? ((line) => console.log(line));
214
+ const stderr = deps.stderr ?? ((line) => console.error(line));
215
+ const apiKey = readFlag4(args, "--api-key") || env.SUPERSENDTX_API_KEY || env.SUPERTX_API_KEY;
216
+ if (!apiKey) {
217
+ stderr("Missing API key. Set SUPERSENDTX_API_KEY or pass --api-key.");
218
+ return { exitCode: 1, error: "missing key" };
219
+ }
220
+ const limitRaw = readFlag4(args, "--limit");
221
+ const cursor = readFlag4(args, "--cursor");
222
+ const limit = limitRaw ? Number(limitRaw) : void 0;
223
+ try {
224
+ const result = await deps.listEmails({
225
+ ...limit != null && Number.isFinite(limit) ? { limit } : {},
226
+ ...cursor ? { cursor } : {}
227
+ });
228
+ stdout(JSON.stringify(result));
229
+ return { exitCode: 0 };
230
+ } catch (error) {
231
+ stderr(error instanceof Error ? error.message : String(error));
232
+ return { exitCode: 1, error: String(error) };
233
+ }
234
+ }
235
+ async function runListCommandWithClient(args, env = process.env) {
236
+ const apiKey = readFlag4(args, "--api-key") || env.SUPERSENDTX_API_KEY || env.SUPERTX_API_KEY;
237
+ const baseUrl = readFlag4(args, "--base-url");
238
+ if (!apiKey) {
239
+ return { exitCode: 1, error: "Missing API key. Set SUPERSENDTX_API_KEY or pass --api-key." };
240
+ }
241
+ const { SuperSendTX } = await import("supersendtx");
242
+ const client = new SuperSendTX(apiKey, baseUrl ? { baseUrl } : void 0);
243
+ return runListCommand(args, {
244
+ env,
245
+ listEmails: (params) => client.emails.list(params)
246
+ });
247
+ }
248
+
249
+ // src/commands/domains/shared.ts
250
+ function readFlag5(args, flag) {
251
+ const index = args.indexOf(flag);
252
+ if (index === -1) return void 0;
253
+ return args[index + 1];
254
+ }
91
255
  function parseDomainsCommonArgs(args) {
92
256
  return {
93
- apiKey: readFlag2(args, "--api-key"),
94
- baseUrl: readFlag2(args, "--base-url"),
95
- name: readFlag2(args, "--name") || readFlag2(args, "--domain"),
96
- id: readFlag2(args, "--id")
257
+ apiKey: readFlag5(args, "--api-key"),
258
+ baseUrl: readFlag5(args, "--base-url"),
259
+ name: readFlag5(args, "--name") || readFlag5(args, "--domain"),
260
+ id: readFlag5(args, "--id")
97
261
  };
98
262
  }
99
263
  function resolveApiKey(options, env) {
@@ -200,7 +364,7 @@ async function runApplyCommand(args, env = process.env) {
200
364
  }
201
365
 
202
366
  // src/commands/domains/list.ts
203
- async function runListCommand(args, env = process.env) {
367
+ async function runListCommand2(args, env = process.env) {
204
368
  const options = parseDomainsCommonArgs(args);
205
369
  const apiKey = resolveApiKey(options, env);
206
370
  if (!apiKey) {
@@ -244,15 +408,15 @@ async function runVerifyCommand(args, env = process.env) {
244
408
  }
245
409
 
246
410
  // src/commands/webhooks/shared.ts
247
- function readFlag3(args, flag) {
411
+ function readFlag6(args, flag) {
248
412
  const index = args.indexOf(flag);
249
413
  if (index === -1) return void 0;
250
414
  return args[index + 1];
251
415
  }
252
416
  function parseWebhooksCommonArgs(args) {
253
417
  return {
254
- apiKey: readFlag3(args, "--api-key"),
255
- baseUrl: readFlag3(args, "--base-url")
418
+ apiKey: readFlag6(args, "--api-key"),
419
+ baseUrl: readFlag6(args, "--base-url")
256
420
  };
257
421
  }
258
422
  function resolveApiKey2(options, env) {
@@ -270,7 +434,7 @@ async function runCreateCommand(args, env = process.env) {
270
434
  if (!apiKey) {
271
435
  return { exitCode: 1, error: "Missing API key. Set SUPERSENDTX_API_KEY or pass --api-key." };
272
436
  }
273
- const url = readFlag3(args, "--url");
437
+ const url = readFlag6(args, "--url");
274
438
  if (!url) {
275
439
  return { exitCode: 1, error: "Required flag: --url" };
276
440
  }
@@ -291,7 +455,7 @@ async function runDeleteCommand(args, env = process.env) {
291
455
  if (!apiKey) {
292
456
  return { exitCode: 1, error: "Missing API key. Set SUPERSENDTX_API_KEY or pass --api-key." };
293
457
  }
294
- const id = readFlag3(args, "--id");
458
+ const id = readFlag6(args, "--id");
295
459
  if (!id) {
296
460
  return { exitCode: 1, error: "Required flag: --id" };
297
461
  }
@@ -306,7 +470,7 @@ async function runDeleteCommand(args, env = process.env) {
306
470
  }
307
471
 
308
472
  // src/commands/webhooks/list.ts
309
- async function runListCommand2(args, env = process.env) {
473
+ async function runListCommand3(args, env = process.env) {
310
474
  const options = parseWebhooksCommonArgs(args);
311
475
  const apiKey = resolveApiKey2(options, env);
312
476
  if (!apiKey) {
@@ -322,6 +486,188 @@ async function runListCommand2(args, env = process.env) {
322
486
  }
323
487
  }
324
488
 
489
+ // src/commands/keys/list.ts
490
+ function readFlag7(args, flag) {
491
+ const index = args.indexOf(flag);
492
+ if (index === -1) return void 0;
493
+ return args[index + 1];
494
+ }
495
+ async function runListKeysCommandWithClient(args, env = process.env) {
496
+ const apiKey = readFlag7(args, "--api-key") || env.SUPERSENDTX_API_KEY || env.SUPERTX_API_KEY;
497
+ const baseUrl = readFlag7(args, "--base-url");
498
+ if (!apiKey) {
499
+ return { exitCode: 1, error: "Missing API key. Set SUPERSENDTX_API_KEY or pass --api-key." };
500
+ }
501
+ const { SuperSendTX } = await import("supersendtx");
502
+ const client = new SuperSendTX(apiKey, baseUrl ? { baseUrl } : void 0);
503
+ try {
504
+ const limitRaw = readFlag7(args, "--limit");
505
+ const cursor = readFlag7(args, "--cursor");
506
+ const result = await client.apiKeys.list({
507
+ ...limitRaw ? { limit: Number(limitRaw) } : {},
508
+ ...cursor ? { cursor } : {}
509
+ });
510
+ console.log(JSON.stringify(result));
511
+ return { exitCode: 0 };
512
+ } catch (error) {
513
+ const message = error instanceof Error ? error.message : String(error);
514
+ console.error(message);
515
+ return { exitCode: 1, error: message };
516
+ }
517
+ }
518
+
519
+ // src/commands/keys/create.ts
520
+ function readFlag8(args, flag) {
521
+ const index = args.indexOf(flag);
522
+ if (index === -1) return void 0;
523
+ return args[index + 1];
524
+ }
525
+ async function runCreateKeyCommandWithClient(args, env = process.env) {
526
+ const apiKey = readFlag8(args, "--api-key") || env.SUPERSENDTX_API_KEY || env.SUPERTX_API_KEY;
527
+ const baseUrl = readFlag8(args, "--base-url");
528
+ if (!apiKey) {
529
+ return { exitCode: 1, error: "Missing API key. Set SUPERSENDTX_API_KEY or pass --api-key." };
530
+ }
531
+ const name = readFlag8(args, "--name");
532
+ const scope = readFlag8(args, "--scope");
533
+ if (scope && scope !== "full" && scope !== "sending") {
534
+ return { exitCode: 1, error: "--scope must be full or sending" };
535
+ }
536
+ const { SuperSendTX } = await import("supersendtx");
537
+ const client = new SuperSendTX(apiKey, baseUrl ? { baseUrl } : void 0);
538
+ try {
539
+ const result = await client.apiKeys.create({
540
+ ...name ? { name } : {},
541
+ ...scope ? { scope } : {}
542
+ });
543
+ console.log(JSON.stringify(result));
544
+ return { exitCode: 0 };
545
+ } catch (error) {
546
+ const message = error instanceof Error ? error.message : String(error);
547
+ console.error(message);
548
+ return { exitCode: 1, error: message };
549
+ }
550
+ }
551
+
552
+ // src/commands/keys/delete.ts
553
+ function readFlag9(args, flag) {
554
+ const index = args.indexOf(flag);
555
+ if (index === -1) return void 0;
556
+ return args[index + 1];
557
+ }
558
+ async function runDeleteKeyCommandWithClient(args, env = process.env) {
559
+ const apiKey = readFlag9(args, "--api-key") || env.SUPERSENDTX_API_KEY || env.SUPERTX_API_KEY;
560
+ const baseUrl = readFlag9(args, "--base-url");
561
+ const id = readFlag9(args, "--id");
562
+ if (!apiKey) {
563
+ return { exitCode: 1, error: "Missing API key. Set SUPERSENDTX_API_KEY or pass --api-key." };
564
+ }
565
+ if (!id) {
566
+ return { exitCode: 1, error: "Required: --id <api-key-id>" };
567
+ }
568
+ const { SuperSendTX } = await import("supersendtx");
569
+ const client = new SuperSendTX(apiKey, baseUrl ? { baseUrl } : void 0);
570
+ try {
571
+ const result = await client.apiKeys.remove(id);
572
+ console.log(JSON.stringify(result));
573
+ return { exitCode: 0 };
574
+ } catch (error) {
575
+ const message = error instanceof Error ? error.message : String(error);
576
+ console.error(message);
577
+ return { exitCode: 1, error: message };
578
+ }
579
+ }
580
+
581
+ // src/commands/suppressions/shared.ts
582
+ function readFlag10(args, flag) {
583
+ const index = args.indexOf(flag);
584
+ if (index === -1) return void 0;
585
+ return args[index + 1];
586
+ }
587
+ function parseSuppressionsCommonArgs(args) {
588
+ return {
589
+ apiKey: readFlag10(args, "--api-key"),
590
+ baseUrl: readFlag10(args, "--base-url")
591
+ };
592
+ }
593
+ function resolveApiKey3(options, env) {
594
+ return options.apiKey || env.SUPERSENDTX_API_KEY || env.SUPERTX_API_KEY || null;
595
+ }
596
+ async function createSuppressionsClient(apiKey, baseUrl) {
597
+ const { SuperSendTX } = await import("supersendtx");
598
+ return new SuperSendTX(apiKey, baseUrl ? { baseUrl } : void 0);
599
+ }
600
+
601
+ // src/commands/suppressions/list.ts
602
+ async function runListCommand4(args, env = process.env) {
603
+ const options = parseSuppressionsCommonArgs(args);
604
+ const apiKey = resolveApiKey3(options, env);
605
+ if (!apiKey) {
606
+ return { exitCode: 1, error: "Missing API key. Set SUPERSENDTX_API_KEY or pass --api-key." };
607
+ }
608
+ try {
609
+ const client = await createSuppressionsClient(apiKey, options.baseUrl);
610
+ const limitRaw = readFlag10(args, "--limit");
611
+ const cursor = readFlag10(args, "--cursor");
612
+ const email = readFlag10(args, "--email");
613
+ const result = await client.suppressions.list({
614
+ ...limitRaw ? { limit: Number(limitRaw) } : {},
615
+ ...cursor ? { cursor } : {},
616
+ ...email ? { email } : {}
617
+ });
618
+ console.log(JSON.stringify(result));
619
+ return { exitCode: 0 };
620
+ } catch (error) {
621
+ return { exitCode: 1, error: error instanceof Error ? error.message : String(error) };
622
+ }
623
+ }
624
+
625
+ // src/commands/suppressions/add.ts
626
+ async function runAddCommand2(args, env = process.env) {
627
+ const options = parseSuppressionsCommonArgs(args);
628
+ const apiKey = resolveApiKey3(options, env);
629
+ if (!apiKey) {
630
+ return { exitCode: 1, error: "Missing API key. Set SUPERSENDTX_API_KEY or pass --api-key." };
631
+ }
632
+ const email = readFlag10(args, "--email") || args.find((a) => a.includes("@") && !a.startsWith("-"));
633
+ if (!email) {
634
+ return { exitCode: 1, error: "Missing email. Pass --email user@example.com" };
635
+ }
636
+ try {
637
+ const client = await createSuppressionsClient(apiKey, options.baseUrl);
638
+ const reason = readFlag10(args, "--reason");
639
+ const result = await client.suppressions.create({
640
+ email,
641
+ ...reason ? { reason } : {}
642
+ });
643
+ console.log(JSON.stringify(result));
644
+ return { exitCode: 0 };
645
+ } catch (error) {
646
+ return { exitCode: 1, error: error instanceof Error ? error.message : String(error) };
647
+ }
648
+ }
649
+
650
+ // src/commands/suppressions/remove.ts
651
+ async function runRemoveCommand(args, env = process.env) {
652
+ const options = parseSuppressionsCommonArgs(args);
653
+ const apiKey = resolveApiKey3(options, env);
654
+ if (!apiKey) {
655
+ return { exitCode: 1, error: "Missing API key. Set SUPERSENDTX_API_KEY or pass --api-key." };
656
+ }
657
+ const idOrEmail = readFlag10(args, "--id") || readFlag10(args, "--email") || args.find((a) => !a.startsWith("-") && a !== "remove" && a !== "delete");
658
+ if (!idOrEmail) {
659
+ return { exitCode: 1, error: "Missing id or email. Pass --id <uuid> or --email user@example.com" };
660
+ }
661
+ try {
662
+ const client = await createSuppressionsClient(apiKey, options.baseUrl);
663
+ const result = await client.suppressions.remove(idOrEmail);
664
+ console.log(JSON.stringify(result));
665
+ return { exitCode: 0 };
666
+ } catch (error) {
667
+ return { exitCode: 1, error: error instanceof Error ? error.message : String(error) };
668
+ }
669
+ }
670
+
325
671
  // src/cli.ts
326
672
  function printUsage() {
327
673
  console.error("Usage:");
@@ -333,9 +679,18 @@ function printUsage() {
333
679
  console.error(
334
680
  ' supersendtx emails send --from you@domain.com --to user@example.com --subject "Hello" --html "<p>Hi</p>"'
335
681
  );
682
+ console.error(" supersendtx emails list [--limit 25] [--cursor \u2026]");
683
+ console.error(" supersendtx emails get --id msg_\u2026");
684
+ console.error(" supersendtx emails cancel --id msg_\u2026");
336
685
  console.error(" supersendtx webhooks list");
337
686
  console.error(" supersendtx webhooks create --url https://yourapp.com/hooks");
338
687
  console.error(" supersendtx webhooks delete --id <webhook-id>");
688
+ console.error(" supersendtx suppressions list");
689
+ console.error(" supersendtx suppressions add --email user@example.com [--reason \u2026]");
690
+ console.error(" supersendtx suppressions remove --id <id> | --email user@example.com");
691
+ console.error(" supersendtx keys list");
692
+ console.error(" supersendtx keys create [--name Default] [--scope full|sending]");
693
+ console.error(" supersendtx keys delete --id <api-key-id>");
339
694
  console.error("");
340
695
  console.error("Environment:");
341
696
  console.error(" SUPERSENDTX_API_KEY=stx_\u2026");
@@ -356,7 +711,7 @@ async function main() {
356
711
  process.exit(result.exitCode);
357
712
  }
358
713
  if (subcommand === "list") {
359
- const result = await runListCommand(rest);
714
+ const result = await runListCommand2(rest);
360
715
  if (result.error) console.error(result.error);
361
716
  process.exit(result.exitCode);
362
717
  }
@@ -366,13 +721,30 @@ async function main() {
366
721
  process.exit(result.exitCode);
367
722
  }
368
723
  }
369
- if (command === "emails" && subcommand === "send") {
370
- const result = await runSendCommandWithClient(rest);
371
- process.exit(result.exitCode);
724
+ if (command === "emails") {
725
+ if (subcommand === "send") {
726
+ const result = await runSendCommandWithClient(rest);
727
+ process.exit(result.exitCode);
728
+ }
729
+ if (subcommand === "cancel") {
730
+ const result = await runCancelCommandWithClient(rest);
731
+ if (result.error) console.error(result.error);
732
+ process.exit(result.exitCode);
733
+ }
734
+ if (subcommand === "list") {
735
+ const result = await runListCommandWithClient(rest);
736
+ if (result.error) console.error(result.error);
737
+ process.exit(result.exitCode);
738
+ }
739
+ if (subcommand === "get") {
740
+ const result = await runGetCommandWithClient(rest);
741
+ if (result.error) console.error(result.error);
742
+ process.exit(result.exitCode);
743
+ }
372
744
  }
373
745
  if (command === "webhooks") {
374
746
  if (subcommand === "list") {
375
- const result = await runListCommand2(rest);
747
+ const result = await runListCommand3(rest);
376
748
  if (result.error) console.error(result.error);
377
749
  process.exit(result.exitCode);
378
750
  }
@@ -387,6 +759,40 @@ async function main() {
387
759
  process.exit(result.exitCode);
388
760
  }
389
761
  }
762
+ if (command === "suppressions") {
763
+ if (subcommand === "list") {
764
+ const result = await runListCommand4(rest);
765
+ if (result.error) console.error(result.error);
766
+ process.exit(result.exitCode);
767
+ }
768
+ if (subcommand === "add" || subcommand === "create") {
769
+ const result = await runAddCommand2(rest);
770
+ if (result.error) console.error(result.error);
771
+ process.exit(result.exitCode);
772
+ }
773
+ if (subcommand === "remove" || subcommand === "delete") {
774
+ const result = await runRemoveCommand(rest);
775
+ if (result.error) console.error(result.error);
776
+ process.exit(result.exitCode);
777
+ }
778
+ }
779
+ if (command === "keys") {
780
+ if (subcommand === "list") {
781
+ const result = await runListKeysCommandWithClient(rest);
782
+ if (result.error) console.error(result.error);
783
+ process.exit(result.exitCode);
784
+ }
785
+ if (subcommand === "create") {
786
+ const result = await runCreateKeyCommandWithClient(rest);
787
+ if (result.error) console.error(result.error);
788
+ process.exit(result.exitCode);
789
+ }
790
+ if (subcommand === "delete") {
791
+ const result = await runDeleteKeyCommandWithClient(rest);
792
+ if (result.error) console.error(result.error);
793
+ process.exit(result.exitCode);
794
+ }
795
+ }
390
796
  printUsage();
391
797
  process.exit(1);
392
798
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "supersendtx-cli",
3
- "version": "0.3.0",
3
+ "version": "0.6.0",
4
4
  "description": "SuperSend TX CLI — send transactional email from the terminal",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -39,7 +39,7 @@
39
39
  "prepublishOnly": "npm run build"
40
40
  },
41
41
  "dependencies": {
42
- "supersendtx": "^0.3.0"
42
+ "supersendtx": "0.6.0"
43
43
  },
44
44
  "devDependencies": {
45
45
  "tsup": "^8.5.0",