@mailmodo/cli 0.0.56-beta.pr58.102 → 0.0.56-beta.pr58.104
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/dist/lib/api-client.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export interface ApiRequestDebugInfo {
|
|
|
8
8
|
causeCode?: string;
|
|
9
9
|
/** Fully resolved request URL (origin, path, and query string). */
|
|
10
10
|
fullUrl: string;
|
|
11
|
+
/** Truncated JSON summary of the request body sent, when present. */
|
|
12
|
+
requestBody?: string;
|
|
11
13
|
/** Truncated JSON summary of a non-empty error response body, when available. */
|
|
12
14
|
responseSummary?: string;
|
|
13
15
|
}
|
package/dist/lib/api-client.js
CHANGED
|
@@ -82,12 +82,12 @@ export class ApiClient {
|
|
|
82
82
|
const data = await response.json().catch(() => ({}));
|
|
83
83
|
if (!response.ok) {
|
|
84
84
|
const errorData = data;
|
|
85
|
-
const summary = summarizeResponseBody(data);
|
|
86
85
|
return {
|
|
87
86
|
data: data,
|
|
88
87
|
debug: {
|
|
89
88
|
...debug,
|
|
90
|
-
|
|
89
|
+
requestBody: summarizeResponseBody(body),
|
|
90
|
+
responseSummary: summarizeResponseBody(data),
|
|
91
91
|
},
|
|
92
92
|
error: errorData?.message ||
|
|
93
93
|
errorData?.error ||
|
package/dist/lib/base-command.js
CHANGED
|
@@ -558,6 +558,9 @@ export class BaseCommand extends Command {
|
|
|
558
558
|
status > 0
|
|
559
559
|
? chalk.dim(` Status: ${String(status)}`)
|
|
560
560
|
: chalk.dim(' Status: (No HTTP response — network or client error)'),
|
|
561
|
+
...(debug.requestBody
|
|
562
|
+
? [chalk.dim(` Payload: ${debug.requestBody}`)]
|
|
563
|
+
: []),
|
|
561
564
|
...(debug.responseSummary
|
|
562
565
|
? [chalk.dim(` Response: ${debug.responseSummary}`)]
|
|
563
566
|
: []),
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
|
+
const TIME_W = 18;
|
|
3
|
+
const EMAIL_W = 24;
|
|
4
|
+
const SEQ_W = 12;
|
|
5
|
+
const STATUS_W = 14;
|
|
6
|
+
const CONTACT_COL = TIME_W + EMAIL_W + SEQ_W + STATUS_W;
|
|
2
7
|
function statusColor(status) {
|
|
3
8
|
switch (status) {
|
|
4
9
|
case 'bounced':
|
|
@@ -19,25 +24,31 @@ function statusColor(status) {
|
|
|
19
24
|
}
|
|
20
25
|
}
|
|
21
26
|
}
|
|
27
|
+
function truncate(s, width) {
|
|
28
|
+
return s.length > width ? s.slice(0, width - 1) + '…' : s;
|
|
29
|
+
}
|
|
30
|
+
function shortSeq(id) {
|
|
31
|
+
return id.length > 8 ? id.slice(0, 8) + '…' : id;
|
|
32
|
+
}
|
|
22
33
|
export function renderEntries(ctx, data) {
|
|
23
34
|
const { entries, limit, page, total } = data;
|
|
24
|
-
ctx.log(`\n ${'Time'.padEnd(
|
|
25
|
-
|
|
35
|
+
ctx.log(`\n ${'Time'.padEnd(TIME_W)}${'Email'.padEnd(EMAIL_W)}` +
|
|
36
|
+
`${'Sequence'.padEnd(SEQ_W)}${'Status'.padEnd(STATUS_W)}Contact`);
|
|
37
|
+
ctx.log(` ${'─'.repeat(CONTACT_COL + 28)}`);
|
|
26
38
|
if (!entries?.length) {
|
|
27
39
|
ctx.log(` ${chalk.dim('No entries found.')}`);
|
|
28
40
|
ctx.log('');
|
|
29
41
|
return;
|
|
30
42
|
}
|
|
31
43
|
for (const entry of entries) {
|
|
32
|
-
const time = (entry.timestamp || '').padEnd(
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
ctx.log(` ${time}${emailId}${seqId}${status}${entry.contact || ''}`);
|
|
44
|
+
const time = (entry.timestamp || '').padEnd(TIME_W);
|
|
45
|
+
const email = truncate(entry.emailId || '', EMAIL_W - 2).padEnd(EMAIL_W);
|
|
46
|
+
const seq = chalk.dim(shortSeq(entry.sequenceId || '').padEnd(SEQ_W));
|
|
47
|
+
const status = statusColor(entry.status)((entry.status || '').padEnd(STATUS_W));
|
|
48
|
+
ctx.log(` ${time}${email}${seq}${status}${entry.contact || ''}`);
|
|
38
49
|
if (entry.reason) {
|
|
39
50
|
const label = entry.status === 'skipped' ? 'condition not met' : 'reason';
|
|
40
|
-
ctx.log(` ${' '.repeat(
|
|
51
|
+
ctx.log(` ${' '.repeat(CONTACT_COL)}${chalk.dim(`└ ${label}: ${entry.reason}`)}`);
|
|
41
52
|
}
|
|
42
53
|
}
|
|
43
54
|
const totalPages = Math.ceil(total / limit);
|
package/oclif.manifest.json
CHANGED
|
@@ -426,12 +426,13 @@
|
|
|
426
426
|
"index.js"
|
|
427
427
|
]
|
|
428
428
|
},
|
|
429
|
-
"
|
|
429
|
+
"login": {
|
|
430
430
|
"aliases": [],
|
|
431
431
|
"args": {},
|
|
432
|
-
"description": "
|
|
432
|
+
"description": "Authenticate with Mailmodo using your API key",
|
|
433
433
|
"examples": [
|
|
434
|
-
"<%= config.bin %>
|
|
434
|
+
"<%= config.bin %> login",
|
|
435
|
+
"MAILMODO_API_KEY=YOUR_API_KEY <%= config.bin %> login"
|
|
435
436
|
],
|
|
436
437
|
"flags": {
|
|
437
438
|
"json": {
|
|
@@ -450,7 +451,7 @@
|
|
|
450
451
|
},
|
|
451
452
|
"hasDynamicHelp": false,
|
|
452
453
|
"hiddenAliases": [],
|
|
453
|
-
"id": "
|
|
454
|
+
"id": "login",
|
|
454
455
|
"pluginAlias": "@mailmodo/cli",
|
|
455
456
|
"pluginName": "@mailmodo/cli",
|
|
456
457
|
"pluginType": "core",
|
|
@@ -460,17 +461,16 @@
|
|
|
460
461
|
"relativePath": [
|
|
461
462
|
"dist",
|
|
462
463
|
"commands",
|
|
463
|
-
"
|
|
464
|
+
"login",
|
|
464
465
|
"index.js"
|
|
465
466
|
]
|
|
466
467
|
},
|
|
467
|
-
"
|
|
468
|
+
"logout": {
|
|
468
469
|
"aliases": [],
|
|
469
470
|
"args": {},
|
|
470
|
-
"description": "
|
|
471
|
+
"description": "Sign out by removing saved credentials from this machine",
|
|
471
472
|
"examples": [
|
|
472
|
-
"<%= config.bin %>
|
|
473
|
-
"MAILMODO_API_KEY=YOUR_API_KEY <%= config.bin %> login"
|
|
473
|
+
"<%= config.bin %> logout"
|
|
474
474
|
],
|
|
475
475
|
"flags": {
|
|
476
476
|
"json": {
|
|
@@ -489,7 +489,7 @@
|
|
|
489
489
|
},
|
|
490
490
|
"hasDynamicHelp": false,
|
|
491
491
|
"hiddenAliases": [],
|
|
492
|
-
"id": "
|
|
492
|
+
"id": "logout",
|
|
493
493
|
"pluginAlias": "@mailmodo/cli",
|
|
494
494
|
"pluginName": "@mailmodo/cli",
|
|
495
495
|
"pluginType": "core",
|
|
@@ -499,7 +499,7 @@
|
|
|
499
499
|
"relativePath": [
|
|
500
500
|
"dist",
|
|
501
501
|
"commands",
|
|
502
|
-
"
|
|
502
|
+
"logout",
|
|
503
503
|
"index.js"
|
|
504
504
|
]
|
|
505
505
|
},
|
|
@@ -845,13 +845,14 @@
|
|
|
845
845
|
"index.js"
|
|
846
846
|
]
|
|
847
847
|
},
|
|
848
|
-
"
|
|
848
|
+
"settings": {
|
|
849
849
|
"aliases": [],
|
|
850
850
|
"args": {},
|
|
851
|
-
"description": "View
|
|
851
|
+
"description": "View and update project settings",
|
|
852
852
|
"examples": [
|
|
853
|
-
"<%= config.bin %>
|
|
854
|
-
"<%= config.bin %>
|
|
853
|
+
"<%= config.bin %> settings",
|
|
854
|
+
"<%= config.bin %> settings --set brand_color=#0F3460",
|
|
855
|
+
"<%= config.bin %> settings --json"
|
|
855
856
|
],
|
|
856
857
|
"flags": {
|
|
857
858
|
"json": {
|
|
@@ -866,11 +867,18 @@
|
|
|
866
867
|
"name": "yes",
|
|
867
868
|
"allowNo": false,
|
|
868
869
|
"type": "boolean"
|
|
870
|
+
},
|
|
871
|
+
"set": {
|
|
872
|
+
"description": "Set a setting (format: key=value)",
|
|
873
|
+
"name": "set",
|
|
874
|
+
"hasDynamicHelp": false,
|
|
875
|
+
"multiple": false,
|
|
876
|
+
"type": "option"
|
|
869
877
|
}
|
|
870
878
|
},
|
|
871
879
|
"hasDynamicHelp": false,
|
|
872
880
|
"hiddenAliases": [],
|
|
873
|
-
"id": "
|
|
881
|
+
"id": "settings",
|
|
874
882
|
"pluginAlias": "@mailmodo/cli",
|
|
875
883
|
"pluginName": "@mailmodo/cli",
|
|
876
884
|
"pluginType": "core",
|
|
@@ -880,18 +888,17 @@
|
|
|
880
888
|
"relativePath": [
|
|
881
889
|
"dist",
|
|
882
890
|
"commands",
|
|
883
|
-
"
|
|
891
|
+
"settings",
|
|
884
892
|
"index.js"
|
|
885
893
|
]
|
|
886
894
|
},
|
|
887
|
-
"
|
|
895
|
+
"status": {
|
|
888
896
|
"aliases": [],
|
|
889
897
|
"args": {},
|
|
890
|
-
"description": "View and
|
|
898
|
+
"description": "View email performance metrics and quota usage",
|
|
891
899
|
"examples": [
|
|
892
|
-
"<%= config.bin %>
|
|
893
|
-
"<%= config.bin %>
|
|
894
|
-
"<%= config.bin %> settings --json"
|
|
900
|
+
"<%= config.bin %> status",
|
|
901
|
+
"<%= config.bin %> status --json"
|
|
895
902
|
],
|
|
896
903
|
"flags": {
|
|
897
904
|
"json": {
|
|
@@ -906,18 +913,11 @@
|
|
|
906
913
|
"name": "yes",
|
|
907
914
|
"allowNo": false,
|
|
908
915
|
"type": "boolean"
|
|
909
|
-
},
|
|
910
|
-
"set": {
|
|
911
|
-
"description": "Set a setting (format: key=value)",
|
|
912
|
-
"name": "set",
|
|
913
|
-
"hasDynamicHelp": false,
|
|
914
|
-
"multiple": false,
|
|
915
|
-
"type": "option"
|
|
916
916
|
}
|
|
917
917
|
},
|
|
918
918
|
"hasDynamicHelp": false,
|
|
919
919
|
"hiddenAliases": [],
|
|
920
|
-
"id": "
|
|
920
|
+
"id": "status",
|
|
921
921
|
"pluginAlias": "@mailmodo/cli",
|
|
922
922
|
"pluginName": "@mailmodo/cli",
|
|
923
923
|
"pluginType": "core",
|
|
@@ -927,10 +927,10 @@
|
|
|
927
927
|
"relativePath": [
|
|
928
928
|
"dist",
|
|
929
929
|
"commands",
|
|
930
|
-
"
|
|
930
|
+
"status",
|
|
931
931
|
"index.js"
|
|
932
932
|
]
|
|
933
933
|
}
|
|
934
934
|
},
|
|
935
|
-
"version": "0.0.56-beta.pr58.
|
|
935
|
+
"version": "0.0.56-beta.pr58.104"
|
|
936
936
|
}
|
package/package.json
CHANGED