reply-cli 0.1.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.
- package/dist/commands/accounts.d.ts +6 -0
- package/dist/commands/accounts.js +62 -0
- package/dist/commands/accounts.js.map +1 -0
- package/dist/commands/contacts.d.ts +20 -0
- package/dist/commands/contacts.js +321 -0
- package/dist/commands/contacts.js.map +1 -0
- package/dist/commands/import.d.ts +6 -0
- package/dist/commands/import.js +137 -0
- package/dist/commands/import.js.map +1 -0
- package/dist/commands/schedules.d.ts +9 -0
- package/dist/commands/schedules.js +119 -0
- package/dist/commands/schedules.js.map +1 -0
- package/dist/commands/sequence-contacts.d.ts +8 -0
- package/dist/commands/sequence-contacts.js +141 -0
- package/dist/commands/sequence-contacts.js.map +1 -0
- package/dist/commands/sequences-stats.d.ts +7 -0
- package/dist/commands/sequences-stats.js +183 -0
- package/dist/commands/sequences-stats.js.map +1 -0
- package/dist/commands/sequences.d.ts +12 -0
- package/dist/commands/sequences.js +225 -0
- package/dist/commands/sequences.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +62 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/auth.d.ts +2 -0
- package/dist/utils/auth.js +33 -0
- package/dist/utils/auth.js.map +1 -0
- package/dist/utils/client.d.ts +11 -0
- package/dist/utils/client.js +119 -0
- package/dist/utils/client.js.map +1 -0
- package/dist/utils/command.d.ts +11 -0
- package/dist/utils/command.js +20 -0
- package/dist/utils/command.js.map +1 -0
- package/dist/utils/output.d.ts +20 -0
- package/dist/utils/output.js +93 -0
- package/dist/utils/output.js.map +1 -0
- package/package.json +36 -0
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handle_archive = exports.handle_pause = exports.handle_start = exports.handle_clone = exports.handle_update = exports.handle_create = exports.handle_get = exports.handle_list = exports.sequences_command = void 0;
|
|
4
|
+
const commander_1 = require("commander");
|
|
5
|
+
const client_1 = require("../utils/client");
|
|
6
|
+
const auth_1 = require("../utils/auth");
|
|
7
|
+
const output_1 = require("../utils/output");
|
|
8
|
+
const handle_list = async (api_key, print_opts) => {
|
|
9
|
+
const campaigns = await (0, client_1.get)(api_key, '/v1/campaigns');
|
|
10
|
+
if (!campaigns || campaigns.length === 0) {
|
|
11
|
+
(0, output_1.info)('No sequences found.');
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
if (print_opts.json || print_opts.pretty) {
|
|
15
|
+
(0, output_1.print)(campaigns, print_opts);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
(0, output_1.print_table)(campaigns.map(c => ({
|
|
19
|
+
ID: String(c.id),
|
|
20
|
+
Name: (0, output_1.truncate)(c.name || '—', 30),
|
|
21
|
+
Status: (0, output_1.status_label)(c.status),
|
|
22
|
+
People: String(c.peopleCount || 0),
|
|
23
|
+
Active: String(c.peopleActive || 0),
|
|
24
|
+
Delivered: String(c.deliveriesCount || 0),
|
|
25
|
+
Opens: String(c.opensCount || 0),
|
|
26
|
+
Replies: String(c.repliesCount || 0),
|
|
27
|
+
Created: (0, output_1.format_date)(c.created),
|
|
28
|
+
})), ['ID', 'Name', 'Status', 'People', 'Active', 'Delivered', 'Opens', 'Replies', 'Created']);
|
|
29
|
+
(0, output_1.info)(`\nTotal: ${campaigns.length} sequences`);
|
|
30
|
+
};
|
|
31
|
+
exports.handle_list = handle_list;
|
|
32
|
+
const handle_get = async (api_key, id, print_opts) => {
|
|
33
|
+
const campaigns = await (0, client_1.get)(api_key, `/v1/campaigns?id=${id}`);
|
|
34
|
+
if (!campaigns || campaigns.length === 0) {
|
|
35
|
+
(0, output_1.info)('Sequence not found.');
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const c = campaigns[0];
|
|
39
|
+
if (print_opts.json || print_opts.pretty) {
|
|
40
|
+
// Also fetch steps
|
|
41
|
+
const steps = await (0, client_1.get)(api_key, `/v2/campaigns/${id}/steps`);
|
|
42
|
+
(0, output_1.print)({ ...c, steps }, print_opts);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
console.log(`Sequence: ${output_1.pc.bold(c.name)}`);
|
|
46
|
+
console.log(` ID: ${c.id}`);
|
|
47
|
+
console.log(` Status: ${(0, output_1.status_label)(c.status)}`);
|
|
48
|
+
console.log(` People: ${c.peopleCount || 0} total, ${c.peopleActive || 0} active, ${c.peopleFinished || 0} finished, ${c.peoplePaused || 0} paused`);
|
|
49
|
+
console.log(` Delivered: ${c.deliveriesCount || 0}`);
|
|
50
|
+
console.log(` Opens: ${c.opensCount || 0}`);
|
|
51
|
+
console.log(` Replies: ${output_1.pc.green(String(c.repliesCount || 0))}`);
|
|
52
|
+
console.log(` Bounces: ${c.bouncesCount || 0}`);
|
|
53
|
+
console.log(` Accounts: ${(c.emailAccounts || []).join(', ') || '—'}`);
|
|
54
|
+
console.log(` Created: ${(0, output_1.format_date)(c.created)}`);
|
|
55
|
+
// Show steps
|
|
56
|
+
const steps = await (0, client_1.get)(api_key, `/v2/campaigns/${id}/steps`);
|
|
57
|
+
if (steps?.length) {
|
|
58
|
+
console.log(`\n Steps:`);
|
|
59
|
+
for (const step of steps) {
|
|
60
|
+
console.log(`\n Step ${step.number} (ID: ${step.id}) — Delay: ${step.inMinutesCount} min`);
|
|
61
|
+
for (let i = 0; i < (step.templates || []).length; i++) {
|
|
62
|
+
const t = step.templates[i];
|
|
63
|
+
const variant = step.templates.length > 1 ? ` [Variant ${i + 1}]` : '';
|
|
64
|
+
console.log(` Subject${variant}: ${t.subject || '(no subject)'}`);
|
|
65
|
+
console.log(` Body${variant}: ${(0, output_1.truncate)(t.body?.replace(/<[^>]*>/g, '') || '', 100)}`);
|
|
66
|
+
if (t.ccList)
|
|
67
|
+
console.log(` CC: ${t.ccList}`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
exports.handle_get = handle_get;
|
|
73
|
+
const handle_create = async (api_key, print_opts) => {
|
|
74
|
+
const chunks = [];
|
|
75
|
+
for await (const chunk of process.stdin)
|
|
76
|
+
chunks.push(chunk);
|
|
77
|
+
const config = JSON.parse(Buffer.concat(chunks).toString('utf-8'));
|
|
78
|
+
if (!config.name)
|
|
79
|
+
(0, output_1.fail)('Sequence config must include "name".');
|
|
80
|
+
if (!config.emailAccounts || config.emailAccounts.length === 0)
|
|
81
|
+
(0, output_1.fail)('Sequence config must include "emailAccounts" array.');
|
|
82
|
+
const result = await (0, client_1.post)(api_key, '/v2/campaigns', config);
|
|
83
|
+
(0, output_1.success)(`Sequence created: "${result.name}" (ID: ${result.id})`);
|
|
84
|
+
(0, output_1.print)(result, print_opts);
|
|
85
|
+
};
|
|
86
|
+
exports.handle_create = handle_create;
|
|
87
|
+
const handle_update = async (api_key, id, print_opts) => {
|
|
88
|
+
const chunks = [];
|
|
89
|
+
for await (const chunk of process.stdin)
|
|
90
|
+
chunks.push(chunk);
|
|
91
|
+
const config = JSON.parse(Buffer.concat(chunks).toString('utf-8'));
|
|
92
|
+
const result = await (0, client_1.patch)(api_key, `/v2/campaigns/${id}`, config);
|
|
93
|
+
(0, output_1.success)(`Sequence ${id} updated.`);
|
|
94
|
+
(0, output_1.print)(result, print_opts);
|
|
95
|
+
};
|
|
96
|
+
exports.handle_update = handle_update;
|
|
97
|
+
const handle_clone = async (api_key, id, new_name, print_opts) => {
|
|
98
|
+
// 1. Get source campaign
|
|
99
|
+
const campaigns = await (0, client_1.get)(api_key, `/v1/campaigns?id=${id}`);
|
|
100
|
+
if (!campaigns || campaigns.length === 0)
|
|
101
|
+
(0, output_1.fail)(`Sequence ${id} not found.`);
|
|
102
|
+
const source = campaigns[0];
|
|
103
|
+
// 2. Get source steps
|
|
104
|
+
const source_steps = await (0, client_1.get)(api_key, `/v2/campaigns/${id}/steps`);
|
|
105
|
+
// 3. Build new campaign payload
|
|
106
|
+
const new_campaign = {
|
|
107
|
+
name: new_name,
|
|
108
|
+
emailAccounts: source.emailAccounts || [],
|
|
109
|
+
};
|
|
110
|
+
if (source_steps?.length) {
|
|
111
|
+
new_campaign.steps = source_steps.map(step => ({
|
|
112
|
+
number: String(step.number),
|
|
113
|
+
InMinutesCount: String(step.inMinutesCount),
|
|
114
|
+
templates: (step.templates || []).map(t => ({
|
|
115
|
+
subject: t.subject || '',
|
|
116
|
+
body: t.body || '',
|
|
117
|
+
...(t.ccList ? { CcList: t.ccList } : {}),
|
|
118
|
+
})),
|
|
119
|
+
}));
|
|
120
|
+
}
|
|
121
|
+
// 4. Create new campaign
|
|
122
|
+
const result = await (0, client_1.post)(api_key, '/v2/campaigns', new_campaign);
|
|
123
|
+
(0, output_1.success)(`Sequence cloned: "${result.name}" (ID: ${result.id})`);
|
|
124
|
+
(0, output_1.info)(`Source: ${source.name} (${id}) → New: ${result.name} (${result.id})`);
|
|
125
|
+
(0, output_1.print)(result, print_opts);
|
|
126
|
+
};
|
|
127
|
+
exports.handle_clone = handle_clone;
|
|
128
|
+
const handle_start = async (api_key, id) => {
|
|
129
|
+
const result = await (0, client_1.post)(api_key, `/v2/campaigns/${id}/start`);
|
|
130
|
+
(0, output_1.success)(`Sequence ${id} started. Status: ${result.status}`);
|
|
131
|
+
};
|
|
132
|
+
exports.handle_start = handle_start;
|
|
133
|
+
const handle_pause = async (api_key, id) => {
|
|
134
|
+
const result = await (0, client_1.post)(api_key, `/v2/campaigns/${id}/pause`);
|
|
135
|
+
(0, output_1.success)(`Sequence ${id} paused. Status: ${result.status}`);
|
|
136
|
+
};
|
|
137
|
+
exports.handle_pause = handle_pause;
|
|
138
|
+
const handle_archive = async (api_key, id) => {
|
|
139
|
+
await (0, client_1.post)(api_key, `/v2/campaigns/${id}/archive`);
|
|
140
|
+
(0, output_1.success)(`Sequence ${id} archived.`);
|
|
141
|
+
};
|
|
142
|
+
exports.handle_archive = handle_archive;
|
|
143
|
+
const sequences_command = new commander_1.Command('sequences')
|
|
144
|
+
.description('Manage outreach sequences (campaigns)');
|
|
145
|
+
exports.sequences_command = sequences_command;
|
|
146
|
+
sequences_command
|
|
147
|
+
.command('list')
|
|
148
|
+
.description('List all sequences with stats')
|
|
149
|
+
.addHelpText('after', '\nShows all sequences with people counts, deliveries, opens, and replies.\n\nExamples:\n reply sequences list\n reply sequences list --json')
|
|
150
|
+
.action(async function () {
|
|
151
|
+
const opts = this.optsWithGlobals();
|
|
152
|
+
const key = (0, auth_1.resolve_api_key)(opts.apiKey);
|
|
153
|
+
await handle_list(key, { json: opts.json, pretty: opts.pretty });
|
|
154
|
+
});
|
|
155
|
+
sequences_command
|
|
156
|
+
.command('get')
|
|
157
|
+
.description('Get sequence details and email steps')
|
|
158
|
+
.argument('<id>', 'Sequence ID')
|
|
159
|
+
.addHelpText('after', '\nShows sequence details including all email steps and their templates.\n\nExamples:\n reply sequences get 12345\n reply sequences get 12345 --json')
|
|
160
|
+
.action(async function (id) {
|
|
161
|
+
const opts = this.optsWithGlobals();
|
|
162
|
+
const key = (0, auth_1.resolve_api_key)(opts.apiKey);
|
|
163
|
+
await handle_get(key, id, { json: opts.json, pretty: opts.pretty });
|
|
164
|
+
});
|
|
165
|
+
sequences_command
|
|
166
|
+
.command('create')
|
|
167
|
+
.description('Create a new sequence from stdin JSON')
|
|
168
|
+
.addHelpText('after', '\nReads JSON config from stdin with name, emailAccounts, steps, and settings.\n\nExamples:\n echo \'{"name":"My Sequence","emailAccounts":["me@co.com"],"steps":[...]}\' | reply sequences create')
|
|
169
|
+
.action(async function () {
|
|
170
|
+
const opts = this.optsWithGlobals();
|
|
171
|
+
const key = (0, auth_1.resolve_api_key)(opts.apiKey);
|
|
172
|
+
await handle_create(key, { json: opts.json, pretty: opts.pretty });
|
|
173
|
+
});
|
|
174
|
+
sequences_command
|
|
175
|
+
.command('update')
|
|
176
|
+
.description('Update sequence settings from stdin JSON')
|
|
177
|
+
.argument('<id>', 'Sequence ID')
|
|
178
|
+
.addHelpText('after', '\nReads JSON with updated settings from stdin.\n\nExamples:\n echo \'{"name":"New Name","settings":{"emailsCountPerDay":100}}\' | reply sequences update 12345')
|
|
179
|
+
.action(async function (id) {
|
|
180
|
+
const opts = this.optsWithGlobals();
|
|
181
|
+
const key = (0, auth_1.resolve_api_key)(opts.apiKey);
|
|
182
|
+
await handle_update(key, id, { json: opts.json, pretty: opts.pretty });
|
|
183
|
+
});
|
|
184
|
+
sequences_command
|
|
185
|
+
.command('clone')
|
|
186
|
+
.description('Clone a sequence with all its steps')
|
|
187
|
+
.argument('<id>', 'Source sequence ID')
|
|
188
|
+
.requiredOption('--name <name>', 'Name for the new sequence')
|
|
189
|
+
.addHelpText('after', '\nDuplicates a sequence including all email steps and templates.\n\nExamples:\n reply sequences clone 12345 --name "My Clone"')
|
|
190
|
+
.action(async function (id) {
|
|
191
|
+
const opts = this.optsWithGlobals();
|
|
192
|
+
const key = (0, auth_1.resolve_api_key)(opts.apiKey);
|
|
193
|
+
await handle_clone(key, id, opts.name, { json: opts.json, pretty: opts.pretty });
|
|
194
|
+
});
|
|
195
|
+
sequences_command
|
|
196
|
+
.command('start')
|
|
197
|
+
.description('Start a sequence (begin sending emails)')
|
|
198
|
+
.argument('<id>', 'Sequence ID')
|
|
199
|
+
.addHelpText('after', '\nExamples:\n reply sequences start 12345')
|
|
200
|
+
.action(async function (id) {
|
|
201
|
+
const opts = this.optsWithGlobals();
|
|
202
|
+
const key = (0, auth_1.resolve_api_key)(opts.apiKey);
|
|
203
|
+
await handle_start(key, id);
|
|
204
|
+
});
|
|
205
|
+
sequences_command
|
|
206
|
+
.command('pause')
|
|
207
|
+
.description('Pause a sequence (stop sending emails)')
|
|
208
|
+
.argument('<id>', 'Sequence ID')
|
|
209
|
+
.addHelpText('after', '\nExamples:\n reply sequences pause 12345')
|
|
210
|
+
.action(async function (id) {
|
|
211
|
+
const opts = this.optsWithGlobals();
|
|
212
|
+
const key = (0, auth_1.resolve_api_key)(opts.apiKey);
|
|
213
|
+
await handle_pause(key, id);
|
|
214
|
+
});
|
|
215
|
+
sequences_command
|
|
216
|
+
.command('archive')
|
|
217
|
+
.description('Archive a sequence (cannot be undone)')
|
|
218
|
+
.argument('<id>', 'Sequence ID')
|
|
219
|
+
.addHelpText('after', '\nExamples:\n reply sequences archive 12345')
|
|
220
|
+
.action(async function (id) {
|
|
221
|
+
const opts = this.optsWithGlobals();
|
|
222
|
+
const key = (0, auth_1.resolve_api_key)(opts.apiKey);
|
|
223
|
+
await handle_archive(key, id);
|
|
224
|
+
});
|
|
225
|
+
//# sourceMappingURL=sequences.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sequences.js","sourceRoot":"","sources":["../../src/commands/sequences.ts"],"names":[],"mappings":";;;AAAA,yCAAkC;AAClC,4CAAiD;AACjD,wCAA8C;AAC9C,4CAAiH;AAmCjH,MAAM,WAAW,GAAG,KAAK,EAAC,OAAe,EAAE,UAAsB,EAAC,EAAE;IAChE,MAAM,SAAS,GAAG,MAAM,IAAA,YAAG,EAAa,OAAO,EAAE,eAAe,CAAC,CAAC;IAClE,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EACxC,CAAC;QACG,IAAA,aAAI,EAAC,qBAAqB,CAAC,CAAC;QAC5B,OAAO;IACX,CAAC;IACD,IAAI,UAAU,CAAC,IAAI,IAAI,UAAU,CAAC,MAAM,EACxC,CAAC;QACG,IAAA,cAAK,EAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QAC7B,OAAO;IACX,CAAC;IACD,IAAA,oBAAW,EACP,SAAS,CAAC,GAAG,CAAC,CAAC,CAAA,EAAE,CAAA,CAAC;QACd,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;QAChB,IAAI,EAAE,IAAA,iBAAQ,EAAC,CAAC,CAAC,IAAI,IAAI,GAAG,EAAE,EAAE,CAAC;QACjC,MAAM,EAAE,IAAA,qBAAY,EAAC,CAAC,CAAC,MAAM,CAAC;QAC9B,MAAM,EAAE,MAAM,CAA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C,MAAM,cAAc,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AAClC,CAAC,CAAC,CAAC"}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.build_program = void 0;
|
|
5
|
+
const commander_1 = require("commander");
|
|
6
|
+
const sequences_1 = require("./commands/sequences");
|
|
7
|
+
const sequences_stats_1 = require("./commands/sequences-stats");
|
|
8
|
+
const sequence_contacts_1 = require("./commands/sequence-contacts");
|
|
9
|
+
const contacts_1 = require("./commands/contacts");
|
|
10
|
+
const accounts_1 = require("./commands/accounts");
|
|
11
|
+
const schedules_1 = require("./commands/schedules");
|
|
12
|
+
const import_1 = require("./commands/import");
|
|
13
|
+
const build_program = () => {
|
|
14
|
+
const program = new commander_1.Command();
|
|
15
|
+
program
|
|
16
|
+
.name('reply')
|
|
17
|
+
.description('Command-line interface for Reply.io. Manage sequences, contacts,\n'
|
|
18
|
+
+ 'email accounts, and schedules from your terminal.')
|
|
19
|
+
.version('0.1.0', '-v, --version')
|
|
20
|
+
.option('-k, --api-key <key>', 'Reply.io API key (overrides env/config)')
|
|
21
|
+
.option('--timing', 'Show request timing')
|
|
22
|
+
.option('--json', 'Output as compact JSON')
|
|
23
|
+
.option('--pretty', 'Output as formatted JSON');
|
|
24
|
+
// Add stats as a subcommand of sequences
|
|
25
|
+
sequences_1.sequences_command.addCommand(sequences_stats_1.sequences_stats_command);
|
|
26
|
+
program.addCommand(sequences_1.sequences_command);
|
|
27
|
+
program.addCommand(sequence_contacts_1.sequence_contacts_command);
|
|
28
|
+
program.addCommand(contacts_1.contacts_command);
|
|
29
|
+
program.addCommand(accounts_1.accounts_command);
|
|
30
|
+
program.addCommand(schedules_1.schedules_command);
|
|
31
|
+
program.addCommand(import_1.import_command);
|
|
32
|
+
program.addHelpText('after', `
|
|
33
|
+
Command Groups:
|
|
34
|
+
sequences Manage outreach sequences (list, get, create, clone, start, pause, archive)
|
|
35
|
+
sequences stats View sequence performance (per-step stats, top performers, summary)
|
|
36
|
+
sequence-contacts Add/remove contacts from sequences (add, add-new, add-bulk, remove)
|
|
37
|
+
contacts Manage contacts (list, get, create, update, delete, search, lifecycle)
|
|
38
|
+
accounts Manage email accounts (list, check)
|
|
39
|
+
schedules Manage sending schedules (list, get, create, delete, set-default)
|
|
40
|
+
import Import contacts from CSV (preview, upload)
|
|
41
|
+
|
|
42
|
+
Authentication:
|
|
43
|
+
Set REPLY_API_KEY in your .env file, environment, or pass --api-key flag.
|
|
44
|
+
|
|
45
|
+
Examples:
|
|
46
|
+
reply sequences list
|
|
47
|
+
reply contacts create --email john@co.com --first-name John
|
|
48
|
+
reply sequence-contacts add --contact john@co.com --sequence 12345
|
|
49
|
+
reply sequences stats 12345
|
|
50
|
+
reply sequences stats --summary
|
|
51
|
+
`);
|
|
52
|
+
return program;
|
|
53
|
+
};
|
|
54
|
+
exports.build_program = build_program;
|
|
55
|
+
const main = async () => {
|
|
56
|
+
build_program().parse(process.argv);
|
|
57
|
+
};
|
|
58
|
+
void main().catch(error => {
|
|
59
|
+
console.error(error);
|
|
60
|
+
process.exit(1);
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AACA,yCAAkC;AAClC,oDAAuD;AACvD,gEAAmE;AACnE,oEAAuE;AACvE,kDAAqD;AACrD,kDAAqD;AACrD,oDAAuD;AACvD,8CAAiD;AAEjD,MAAM,aAAa,GAAG,GAAE,EAAE;IACtB,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;IAC9B,OAAO;SACF,IAAI,CAAC,OAAO,CAAC;SACb,WAAW,CACR,oEAAoE;UACnE,mDAAmD,CACvD;SACA,OAAO,CAAC,OAAO,EAAE,eAAe,CAAC;SACjC,MAAM,CAAC,qBAAqB,EAAE,yCAAyC,CAAC;SACxE,MAAM,CAAC,UAAU,EAAE,qBAAqB,CAAC;SACzC,MAAM,CAAC,QAAQ,EAAE,wBAAwB,CAAC;SAC1C,MAAM,CAAC,UAAU,EAAE,0BAA0B,CAAC,CAAC;IAEpD,yCAAyC;IACzC,6BAAiB,CAAC,UAAU,CAAC,yCAAuB,CAAC,CAAC;IAEtD,OAAO,CAAC,UAAU,CAAC,6BAAiB,CAAC,CAAC;IACtC,OAAO,CAAC,UAAU,CAAC,6CAAyB,CAAC,CAAC;IAC9C,OAAO,CAAC,UAAU,CAAC,2BAAgB,CAAC,CAAC;IACrC,OAAO,CAAC,UAAU,CAAC,2BAAgB,CAAC,CAAC;IACrC,OAAO,CAAC,UAAU,CAAC,6BAAiB,CAAC,CAAC;IACtC,OAAO,CAAC,UAAU,CAAC,uBAAc,CAAC,CAAC;IAEnC,OAAO,CAAC,WAAW,CAAC,OAAO,EAAE;;;;;;;;;;;;;;;;;;;CAmBhC,CAAC,CAAC;IAEC,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC;AAWM,sCAAa;AATrB,MAAM,IAAI,GAAG,KAAK,IAAE,EAAE;IAClB,aAAa,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AACxC,CAAC,CAAC;AAEF,KAAK,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAA,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.resolve_api_key = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const resolve_api_key = (cli_key) => {
|
|
10
|
+
if (cli_key)
|
|
11
|
+
return cli_key;
|
|
12
|
+
if (process.env.REPLY_API_KEY)
|
|
13
|
+
return process.env.REPLY_API_KEY;
|
|
14
|
+
// Walk up from cwd to find .env
|
|
15
|
+
let dir = process.cwd();
|
|
16
|
+
for (let i = 0; i < 5; i++) {
|
|
17
|
+
const env_path = path_1.default.join(dir, '.env');
|
|
18
|
+
if (fs_1.default.existsSync(env_path)) {
|
|
19
|
+
const content = fs_1.default.readFileSync(env_path, 'utf-8');
|
|
20
|
+
const match = content.match(/REPLY_API_KEY=(.+)/);
|
|
21
|
+
if (match)
|
|
22
|
+
return match[1].trim();
|
|
23
|
+
}
|
|
24
|
+
const parent = path_1.default.dirname(dir);
|
|
25
|
+
if (parent === dir)
|
|
26
|
+
break;
|
|
27
|
+
dir = parent;
|
|
28
|
+
}
|
|
29
|
+
throw new Error('REPLY_API_KEY not found.\n'
|
|
30
|
+
+ ' Set it via: --api-key flag, REPLY_API_KEY env var, or .env file.');
|
|
31
|
+
};
|
|
32
|
+
exports.resolve_api_key = resolve_api_key;
|
|
33
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/utils/auth.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAExB,MAAM,eAAe,GAAG,CAAC,OAAgB,EAAS,EAAE;IAChD,IAAI,OAAO;QACP,OAAO,OAAO,CAAC;IACnB,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa;QACzB,OAAO,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;IACrC,gCAAgC;IAChC,IAAI,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IACxB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAC1B,CAAC;QACG,MAAM,QAAQ,GAAG,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QACxC,IAAI,YAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAC3B,CAAC;YACG,MAAM,OAAO,GAAG,YAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YACnD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;YAClD,IAAI,KAAK;gBACL,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAC/B,CAAC;QACD,MAAM,MAAM,GAAG,cAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACjC,IAAI,MAAM,KAAK,GAAG;YACd,MAAM;QACV,GAAG,GAAG,MAAM,CAAC;IACjB,CAAC;IACD,MAAM,IAAI,KAAK,CACX,4BAA4B;UAC3B,oEAAoE,CACxE,CAAC;AACN,CAAC,CAAC;AAEM,0CAAe"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type Request_opts = {
|
|
2
|
+
timing?: boolean;
|
|
3
|
+
};
|
|
4
|
+
declare const request: <T = unknown>(api_key: string, method: string, endpoint: string, body?: unknown, opts?: Request_opts) => Promise<T>;
|
|
5
|
+
declare const get: <T = unknown>(api_key: string, endpoint: string, opts?: Request_opts) => Promise<T>;
|
|
6
|
+
declare const post: <T = unknown>(api_key: string, endpoint: string, body?: unknown, opts?: Request_opts) => Promise<T>;
|
|
7
|
+
declare const patch: <T = unknown>(api_key: string, endpoint: string, body: unknown, opts?: Request_opts) => Promise<T>;
|
|
8
|
+
declare const del: <T = unknown>(api_key: string, endpoint: string, body?: unknown, opts?: Request_opts) => Promise<T>;
|
|
9
|
+
declare const post_form_data: <T = unknown>(api_key: string, endpoint: string, form_data: FormData, opts?: Request_opts) => Promise<T>;
|
|
10
|
+
export { get, post, patch, del, post_form_data, request };
|
|
11
|
+
export type { Request_opts };
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.request = exports.post_form_data = exports.del = exports.patch = exports.post = exports.get = void 0;
|
|
4
|
+
const BASE_URL = 'https://api.reply.io';
|
|
5
|
+
const TRANSIENT_STATUSES = [429, 500, 502, 503, 504];
|
|
6
|
+
const MAX_RETRIES = 3;
|
|
7
|
+
const RETRY_BASE_MS = 500;
|
|
8
|
+
const ERROR_HINTS = {
|
|
9
|
+
400: 'Bad request. Check the request body and parameters.',
|
|
10
|
+
401: 'Invalid API key. Check REPLY_API_KEY or pass --api-key.',
|
|
11
|
+
403: 'Access denied. May require owner/master API key.',
|
|
12
|
+
404: 'Resource not found. It may have been deleted.',
|
|
13
|
+
429: 'Rate limit exceeded. Wait a moment and try again.',
|
|
14
|
+
};
|
|
15
|
+
const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
|
|
16
|
+
const request = async (api_key, method, endpoint, body, opts = {}) => {
|
|
17
|
+
const url = `${BASE_URL}${endpoint}`;
|
|
18
|
+
const headers = {
|
|
19
|
+
'x-api-key': api_key,
|
|
20
|
+
'Content-Type': 'application/json',
|
|
21
|
+
};
|
|
22
|
+
const fetch_opts = { method, headers };
|
|
23
|
+
if (body !== undefined)
|
|
24
|
+
fetch_opts.body = JSON.stringify(body);
|
|
25
|
+
let attempt = 0;
|
|
26
|
+
const start = opts.timing ? Date.now() : 0;
|
|
27
|
+
while (attempt <= MAX_RETRIES) {
|
|
28
|
+
try {
|
|
29
|
+
const res = await fetch(url, fetch_opts);
|
|
30
|
+
if (opts.timing)
|
|
31
|
+
console.error(`Timing: ${Date.now() - start}ms (attempt ${attempt + 1})`);
|
|
32
|
+
if (res.ok) {
|
|
33
|
+
const text = await res.text();
|
|
34
|
+
if (!text)
|
|
35
|
+
return null;
|
|
36
|
+
try {
|
|
37
|
+
return JSON.parse(text);
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return text;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (TRANSIENT_STATUSES.includes(res.status) && attempt < MAX_RETRIES) {
|
|
44
|
+
await sleep(RETRY_BASE_MS * 2 ** attempt);
|
|
45
|
+
attempt++;
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
let detail = `HTTP ${res.status}`;
|
|
49
|
+
try {
|
|
50
|
+
const err_body = await res.text();
|
|
51
|
+
if (err_body)
|
|
52
|
+
detail = err_body;
|
|
53
|
+
}
|
|
54
|
+
catch { }
|
|
55
|
+
const hint = ERROR_HINTS[res.status];
|
|
56
|
+
const msg = [`Error: ${detail}`, ` Status: ${res.status}`];
|
|
57
|
+
if (hint)
|
|
58
|
+
msg.push(` Hint: ${hint}`);
|
|
59
|
+
throw new Error(msg.join('\n'));
|
|
60
|
+
}
|
|
61
|
+
catch (e) {
|
|
62
|
+
if (e instanceof Error && e.message.startsWith('Error:'))
|
|
63
|
+
throw e;
|
|
64
|
+
if (attempt < MAX_RETRIES) {
|
|
65
|
+
await sleep(RETRY_BASE_MS * 2 ** attempt);
|
|
66
|
+
attempt++;
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
const err = e;
|
|
70
|
+
throw new Error(`Error: Network request failed — ${err.message}\n`
|
|
71
|
+
+ ' Check your internet connection and try again.');
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
throw new Error('Error: Max retries exceeded.');
|
|
75
|
+
};
|
|
76
|
+
exports.request = request;
|
|
77
|
+
const get = (api_key, endpoint, opts) => request(api_key, 'GET', endpoint, undefined, opts);
|
|
78
|
+
exports.get = get;
|
|
79
|
+
const post = (api_key, endpoint, body, opts) => request(api_key, 'POST', endpoint, body, opts);
|
|
80
|
+
exports.post = post;
|
|
81
|
+
const patch = (api_key, endpoint, body, opts) => request(api_key, 'PATCH', endpoint, body, opts);
|
|
82
|
+
exports.patch = patch;
|
|
83
|
+
const del = (api_key, endpoint, body, opts) => request(api_key, 'DELETE', endpoint, body, opts);
|
|
84
|
+
exports.del = del;
|
|
85
|
+
const post_form_data = async (api_key, endpoint, form_data, opts = {}) => {
|
|
86
|
+
const url = `${BASE_URL}${endpoint}`;
|
|
87
|
+
const res = await fetch(url, {
|
|
88
|
+
method: 'POST',
|
|
89
|
+
headers: { 'x-api-key': api_key },
|
|
90
|
+
body: form_data,
|
|
91
|
+
});
|
|
92
|
+
if (opts.timing)
|
|
93
|
+
console.error(`Timing: form upload complete`);
|
|
94
|
+
if (res.ok) {
|
|
95
|
+
const text = await res.text();
|
|
96
|
+
if (!text)
|
|
97
|
+
return null;
|
|
98
|
+
try {
|
|
99
|
+
return JSON.parse(text);
|
|
100
|
+
}
|
|
101
|
+
catch {
|
|
102
|
+
return text;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
let detail = `HTTP ${res.status}`;
|
|
106
|
+
try {
|
|
107
|
+
const err_body = await res.text();
|
|
108
|
+
if (err_body)
|
|
109
|
+
detail = err_body;
|
|
110
|
+
}
|
|
111
|
+
catch { }
|
|
112
|
+
const hint = ERROR_HINTS[res.status];
|
|
113
|
+
const msg = [`Error: ${detail}`, ` Status: ${res.status}`];
|
|
114
|
+
if (hint)
|
|
115
|
+
msg.push(` Hint: ${hint}`);
|
|
116
|
+
throw new Error(msg.join('\n'));
|
|
117
|
+
};
|
|
118
|
+
exports.post_form_data = post_form_data;
|
|
119
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/utils/client.ts"],"names":[],"mappings":";;;AAAA,MAAM,QAAQ,GAAG,sBAAsB,CAAC;AACxC,MAAM,kBAAkB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AACrD,MAAM,WAAW,GAAG,CAAC,CAAC;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
|
|
3
|
+
apiKey?: string;
|
|
4
|
+
timing?: boolean;
|
|
5
|
+
json?: boolean;
|
|
6
|
+
pretty?: boolean;
|
|
7
|
+
};
|
|
8
|
+
declare const get_global_opts: (cmd: Command) => Global_opts;
|
|
9
|
+
declare const get_key: (cmd: Command) => string;
|
|
10
|
+
export { get_global_opts, get_key };
|
|
11
|
+
export type { Global_opts };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.get_key = exports.get_global_opts = void 0;
|
|
4
|
+
const auth_1 = require("./auth");
|
|
5
|
+
const get_global_opts = (cmd) => {
|
|
6
|
+
const root = cmd.optsWithGlobals();
|
|
7
|
+
return {
|
|
8
|
+
apiKey: root.apiKey,
|
|
9
|
+
timing: root.timing,
|
|
10
|
+
json: root.json,
|
|
11
|
+
pretty: root.pretty,
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
exports.get_global_opts = get_global_opts;
|
|
15
|
+
const get_key = (cmd) => {
|
|
16
|
+
const opts = get_global_opts(cmd);
|
|
17
|
+
return (0, auth_1.resolve_api_key)(opts.apiKey);
|
|
18
|
+
};
|
|
19
|
+
exports.get_key = get_key;
|
|
20
|
+
//# sourceMappingURL=command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.js","sourceRoot":"","sources":["../../src/utils/command.ts"],"names":[],"mappings":";;;AACA,iCAAuC;AASvC,MAAM,eAAe,GAAG,CAAC,GAAY,EAAc,EAAE;IACjD,MAAM,IAAI,GAAG,GAAG,CAAC,eAAe,EAAE,CAAC;IACnC,OAAO;QACH,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,MAAM,EAAE,IAAI,CAAC,MAAM;KACtB,CAAC;AACN,CAAC,CAAC;AAOM,0CAAe;AALvB,MAAM,OAAO,GAAG,CAAC,GAAY,EAAS,EAAE;IACpC,MAAM,IAAI,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC;IAClC,OAAO,IAAA,sBAAe,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACxC,CAAC,CAAC;AAEuB,0BAAO"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import pc from 'picocolors';
|
|
2
|
+
declare const is_tty: boolean;
|
|
3
|
+
declare const success: (msg: string) => void;
|
|
4
|
+
declare const warn: (msg: string) => void;
|
|
5
|
+
declare const info: (msg: string) => void;
|
|
6
|
+
declare const fail: (msg: string) => never;
|
|
7
|
+
type Output_format = 'json' | 'pretty' | 'raw';
|
|
8
|
+
type Print_opts = {
|
|
9
|
+
json?: boolean;
|
|
10
|
+
pretty?: boolean;
|
|
11
|
+
output?: string;
|
|
12
|
+
};
|
|
13
|
+
declare const print: (data: unknown, opts?: Print_opts) => void;
|
|
14
|
+
declare const print_table: (rows: Record<string, unknown>[], cols: string[]) => void;
|
|
15
|
+
declare const status_label: (code: number) => string;
|
|
16
|
+
declare const pct: (num: number, den: number) => string;
|
|
17
|
+
declare const truncate: (str: string, max_len: number) => string;
|
|
18
|
+
declare const format_date: (iso: string) => string;
|
|
19
|
+
export { is_tty, pc, success, warn, info, fail, print, print_table, status_label, pct, truncate, format_date, };
|
|
20
|
+
export type { Print_opts, Output_format };
|