@sesender/cli 1.0.3 → 1.0.5

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.
package/bin/ses-cli.mjs CHANGED
@@ -10,11 +10,11 @@ import { providersList } from "../src/commands/providers.mjs";
10
10
  import { webhooksList, webhooksCreate, webhooksDelete, webhooksTest } from "../src/commands/webhooks.mjs";
11
11
  import { seedCheck, seedBalance } from "../src/commands/seedcheck.mjs";
12
12
  import { templatesList, templatesGet } from "../src/commands/templates.mjs";
13
- import { accountInfo, accountRateLimit } from "../src/commands/account.mjs";
13
+ import { accountInfo, accountRateLimit, accountBalance } from "../src/commands/account.mjs";
14
14
  import { trackingDomainsList, trackingStats } from "../src/commands/tracking.mjs";
15
15
  import { scheduleList, scheduleCancel } from "../src/commands/schedule.mjs";
16
16
 
17
- const VERSION = "1.0.1";
17
+ const VERSION = "1.0.5";
18
18
 
19
19
  function parseArgs(argv) {
20
20
  const args = { _positional: [] };
@@ -98,6 +98,7 @@ VALIDATION
98
98
  validate phone Validate a phone number
99
99
  validate email Validate an email address
100
100
  validate bulk Bulk validate from file
101
+ validate balance Check validation credit balance
101
102
 
102
103
  SEED CHECK
103
104
  seed-check Check emails against seed database
@@ -109,6 +110,7 @@ ANALYTICS
109
110
  ACCOUNT
110
111
  account info View account information
111
112
  account rate View API rate limit status
113
+ account balance View all credit balances
112
114
 
113
115
  GLOBAL OPTIONS
114
116
  --json Output in JSON format (machine-readable)
@@ -291,8 +293,9 @@ async function main() {
291
293
  case "phone": await validatePhone(args, jsonMode); break;
292
294
  case "email": await validateEmail(args, jsonMode); break;
293
295
  case "bulk": await validateBulk(args, jsonMode); break;
296
+ case "balance": await accountBalance(args, jsonMode); break;
294
297
  default:
295
- console.error("Usage: ses-cli validate <phone|email|bulk>");
298
+ console.error("Usage: ses-cli validate <phone|email|bulk|balance>");
296
299
  process.exit(1);
297
300
  }
298
301
  break;
@@ -309,8 +312,9 @@ async function main() {
309
312
  switch (subcommand) {
310
313
  case "info": await accountInfo(args, jsonMode); break;
311
314
  case "rate": await accountRateLimit(args, jsonMode); break;
315
+ case "balance": await accountBalance(args, jsonMode); break;
312
316
  default:
313
- console.error("Usage: ses-cli account <info|rate>");
317
+ console.error("Usage: ses-cli account <info|rate|balance>");
314
318
  process.exit(1);
315
319
  }
316
320
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sesender/cli",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "SESender CLI - Send SMS/emails, manage contacts, and view analytics from your terminal",
5
5
  "type": "module",
6
6
  "bin": {
@@ -11,15 +11,7 @@
11
11
  "src/",
12
12
  "README.md"
13
13
  ],
14
- "keywords": [
15
- "sesender",
16
- "sms",
17
- "email",
18
- "marketing",
19
- "cli",
20
- "bulk-sms",
21
- "bulk-email"
22
- ],
14
+ "keywords": ["sesender", "sms", "email", "marketing", "cli", "bulk-sms", "bulk-email"],
23
15
  "author": "SESender Team",
24
16
  "license": "MIT",
25
17
  "repository": {
@@ -13,6 +13,28 @@ export async function accountInfo(args, jsonMode) {
13
13
  console.log(` Name: ${data.name || "N/A"}`);
14
14
  console.log(` Email: ${data.email || "N/A"}`);
15
15
  console.log(` User ID: ${data.id || "N/A"}`);
16
+
17
+ if (data.balances) {
18
+ console.log(`\n Balances`);
19
+ console.log(` ─────────────────────────`);
20
+ if (data.balances.validation) {
21
+ const v = data.balances.validation;
22
+ console.log(` Validation: ${v.balanceFormatted} (${v.rateFormatted})`);
23
+ if (v.balance > 0 && v.rate > 0) {
24
+ const remaining = Math.floor(v.balance / v.rate);
25
+ console.log(` ~${remaining} checks remaining`);
26
+ }
27
+ }
28
+ if (data.balances.seedCheck) {
29
+ const s = data.balances.seedCheck;
30
+ console.log(` Seed Check: ${s.balanceFormatted} (${s.rateFormatted})`);
31
+ if (s.balance > 0 && s.rate > 0) {
32
+ const remaining = Math.floor(s.balance / s.rate);
33
+ console.log(` ~${remaining} checks remaining`);
34
+ }
35
+ }
36
+ }
37
+
16
38
  if (data.apiKey) {
17
39
  console.log(`\n API Key Details`);
18
40
  console.log(` ─────────────────────────`);
@@ -46,3 +68,33 @@ export async function accountRateLimit(args, jsonMode) {
46
68
  console.log("");
47
69
  }
48
70
  }
71
+
72
+ export async function accountBalance(args, jsonMode) {
73
+ const result = await apiRequest("GET", "/validate/balance");
74
+ const seedResult = await apiRequest("GET", "/seed-check/balance");
75
+
76
+ if (jsonMode) {
77
+ outputResult({
78
+ validation: result.data || result,
79
+ seedCheck: seedResult.data || seedResult,
80
+ }, true);
81
+ } else {
82
+ const vData = result.data || result;
83
+ const sData = seedResult.data || seedResult;
84
+ console.log(`\n Account Balances`);
85
+ console.log(` ═══════════════════════════`);
86
+ console.log(`\n Phone & Email Validation`);
87
+ console.log(` ─────────────────────────`);
88
+ console.log(` Balance: ${vData.balanceFormatted || `€${((vData.balance || 0) / 100).toFixed(2)}`}`);
89
+ console.log(` Rate: ${vData.rateFormatted || `${vData.rate || 0.7} cents/check`}`);
90
+ console.log(` Remaining: ~${vData.checksRemaining || 0} checks`);
91
+ console.log(`\n Seed Check`);
92
+ console.log(` ─────────────────────────`);
93
+ console.log(` Balance: €${(sData.balance || 0).toFixed(2)}`);
94
+ console.log(` Rate: €${(sData.rate || 0.01).toFixed(4)}/email`);
95
+ if (sData.balance > 0 && sData.rate > 0) {
96
+ console.log(` Remaining: ~${Math.floor(sData.balance / sData.rate)} checks`);
97
+ }
98
+ console.log("");
99
+ }
100
+ }