reply-cli 0.20.0 → 0.21.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/README.md CHANGED
@@ -226,6 +226,13 @@ prints JSON (indented; compact with `--json`) and says what happened in a stable
226
226
  | `reply inbox mark-read <thread-id>` · `reply inbox mark-unread <thread-id>` | → `read` / `unread` |
227
227
  | `reply account list [--channel email\|linkedin]` | the email and LinkedIn accounts a send can go from, whose each is, and the state of each |
228
228
  | `reply schedule list` | the sending schedules the account can use, each with its time zone and its windows by weekday |
229
+ | `reply account connect --channel email --provider gmail\|office365 [--name N]` · `--channel linkedin --name N` | a link that connects one new account, for the person who signs in to open → `link`, `expires_at`, `pending_id` |
230
+ | `reply account reconnect <id> --channel email\|linkedin` | a link that reconnects an account that lost its connection → `link` |
231
+ | `reply account pending [--channel email\|linkedin]` | the connection links made and not used yet, without the links |
232
+ | `reply account limits <id> --channel email\|linkedin [--daily N] [--set …]` | read an account's sending limits, or change some of them |
233
+ | `reply account pause <id> --channel linkedin` · `resume <id> --channel linkedin` | → `inactive` / `active`, toggled only when it is not already so |
234
+ | `reply account unblock <id>` | let a mailbox its provider stopped from sending pick its sequences back up → `unblocked` |
235
+ | `reply account delete <id> --channel email\|linkedin --yes [--force]` | → `deleted`; without `--yes` nothing is sent |
229
236
 
230
237
  `<contact>` is exactly one of `--contact <json>|@file|-`, `--email <address>` (with `--first-name`,
231
238
  `--last-name`, `--company`, `--title`), or `--contact-id <id>`. The JSON takes the same fields
@@ -512,6 +519,49 @@ For `inbox reply`, read the thread with `reply inbox get` before trying again. F
512
519
  `sequence list --name -` first. Every other work command can simply be run again; a `contact delete`
513
520
  repeated after its first one took effect answers `contact.not_found`.
514
521
 
522
+ **Connecting accounts.** `account connect` and `account reconnect` print a link for the person who
523
+ signs in to the account: they open it in a browser and sign in on Google's, Microsoft's or LinkedIn's
524
+ own page, so no password passes through the CLI. The link is a credential for whoever holds it. It is
525
+ printed once, in the stdout field `link`, and never on stderr, in a `--verbose` trace (where it reads
526
+ `<link redacted>`), in an error or in a log. A connection link connects one account, works once and
527
+ expires, and the attempt is listed by `account pending` until the person finishes; then the account
528
+ is in `account list`. An email link needs `--provider`; a reconnect takes the provider from the
529
+ mailbox, and the person must sign in with the same address. A LinkedIn connect needs `--name`, which
530
+ Reply lists the pending account under.
531
+
532
+ A Reply without one-mailbox email links answers that route with a 404 and no code. The email
533
+ commands then refuse with `email_link.not_available` (exit 1) and print nothing, unless
534
+ `--allow-shared-page` is given: then they print the account user's hosted mailbox page, the
535
+ provider's connect on it with `--provider` and its index without, with `"link_kind":"shared_page"`,
536
+ `"expires_at":null` and a `warning`. That address does not expire and lets its holder manage all of
537
+ this user's mailboxes, deletion included, so ask for it only when that is acceptable. For
538
+ `account reconnect` the provider's connect is marked as a reconnect, so a user with no free mailbox
539
+ slot reconnects the mailbox rather than being refused a new one; on the index, the person opens the
540
+ mailbox and reconnects it from there.
541
+ `shared_page.not_enabled` means the plan does not include hosted pages. `account pending` then lists
542
+ no email entries and answers `"supported":false` with `"unsupported_channels":["email"]`.
543
+
544
+ ```sh
545
+ reply account connect --channel email --provider gmail --name "Sales mailbox"
546
+ reply account connect --channel linkedin --name "Dana Example"
547
+ reply account reconnect 34 --channel linkedin
548
+ reply account pending
549
+ ```
550
+
551
+ `account limits` prints the limits in Reply's names: an email account's `safety` section, which
552
+ `--daily` and `--set '{"minSendingDelaySeconds":90}'` change, and a LinkedIn account's `limits`,
553
+ which `--set` changes as Reply's limits update does. `account pause` and `account resume` act on a
554
+ LinkedIn account; Reply's only call flips the state, so it is read first and left alone when it is
555
+ already the one asked for. The flip turns an enabled account off and any other on, so `pause` flips
556
+ only an enabled account and `resume` only a disabled one. An account at its daily limit is active:
557
+ `resume` leaves it alone, and `pause` refuses it with `account.pause_unavailable` before any write. A
558
+ state the CLI does not know is refused with `account.status_unknown`, also before any write. Reply
559
+ has no way to pause a mailbox through its API. `account delete`
560
+ needs `--yes`, and `--force` deletes a LinkedIn account sequences still use. Reply's refusals come
561
+ under the CLI's codes, as every work command's do (`linkedin.account_in_use`, `email_account.not_found`,
562
+ `linkedin.invalid_cookie`), with Reply's own code in `reply_code`. After exit 3 from `account connect` or `account reconnect`, read
563
+ `account pending` before running it again: a link may already have been made.
564
+
515
565
  **Errors.** With `--json`, a failure is one line on stderr:
516
566
  `{"error":{"code":"contact.opted_out","title":…,"status":…,"reply_code":…,"ids":{…}}}`. `ids` is
517
567
  whatever the command learned before failing, for example the id of a contact it created before
package/dist/index.js CHANGED
@@ -36,7 +36,7 @@ const build_program = () => {
36
36
  .option('--user-email <email>', 'Act as this user email — organization API keys only (needs a team id)')
37
37
  .option('--json', 'Output compact JSON to stdout')
38
38
  .option('--pretty', 'Output indented JSON to stdout')
39
- .option('--verbose', 'Print the full request/response to stderr, credentials redacted (api)')
39
+ .option('--verbose', 'Print the full request/response to stderr, credentials and links redacted (api, account)')
40
40
  .option('-q, --quiet', 'Suppress progress messages on stderr (warnings and errors still shown)')
41
41
  .showHelpAfterError();
42
42
  // Apply --quiet before any command action runs, so progress output is
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AACA,yCAAkD;AAClD,qCAAmD;AACnD,0CAA6C;AAC7C,gDAAmD;AACnD,0CAA6C;AAC7C,wCAA2C;AAC3C,8CAAiD;AACjD,gDAAmD;AACnD,oDAG+B;AAC/B,gDAAkD;AAClD,2CAAqD;AACrD,2CAA+C;AAE/C,8EAA8E;AAC9E,sEAAsE;AACtE,MAAM,iBAAiB,GAAG,CAAC,GAAY,EAAO,EAAE;IAC5C,GAAG,CAAC,YAAY,EAAE,CAAC;IACnB,KAAK,MAAM,GAAG,IAAI,GAAG,CAAC,QAAQ,EAC9B,CAAC;QACG,iBAAiB,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,aAAa,GAAG,GAAW,EAAE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CAAC,CAAC;YAC7B,IAAI,KAAK,CAAC,IAAI,EACd,CAAC;gBACG,OAAO,CAAC,KAAK,CAAC,IAAA,oBAAW,EAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;YAC3C,CAAC;QACL,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAClC,CAAC;IACD,OAAO,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACtE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { Operation_error } from '../utils/errors';
2
+ import { type Answer, type Op_session } from './call';
3
+ import type { Call_kind } from '../utils/client';
4
+ import type { Op_globals } from './options';
5
+ declare const LINK_REDACTED = "<link redacted>";
6
+ declare const add_link: (link: string, found: Set<string>) => void;
7
+ declare const links_in: (data: unknown, found?: Set<string>) => Set<string>;
8
+ declare const redact_links: (text: string, secrets: Iterable<string>) => string;
9
+ declare const account_call: (s: Op_session, g: Op_globals, method: string, path: string, kind: Call_kind, body?: unknown, opts?: {
10
+ secret_body?: boolean;
11
+ }) => Promise<Answer>;
12
+ declare const without_secrets: (a: Answer) => Answer;
13
+ declare const ACCOUNT_REFUSALS: Record<string, {
14
+ status: number;
15
+ code: string;
16
+ title: string;
17
+ }>;
18
+ declare const account_refusal: (a: Answer, kind: Call_kind) => Operation_error;
19
+ declare const route_missing: (a: Answer) => boolean;
20
+ export { LINK_REDACTED, ACCOUNT_REFUSALS, account_call, account_refusal, route_missing, links_in, redact_links, add_link, without_secrets };
@@ -0,0 +1,197 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.without_secrets = exports.add_link = exports.redact_links = exports.links_in = exports.route_missing = exports.account_refusal = exports.account_call = exports.ACCOUNT_REFUSALS = exports.LINK_REDACTED = void 0;
4
+ const output_1 = require("../utils/output");
5
+ const errors_1 = require("../utils/errors");
6
+ const call_1 = require("./call");
7
+ // The calls of the account commands, and what they write to stderr under --verbose. A connection link,
8
+ // the shared page's address and any token in them are handed over once, in the stdout field `link`: in a
9
+ // trace each is replaced by LINK_REDACTED, wherever it appears.
10
+ const LINK_REDACTED = '<link redacted>';
11
+ exports.LINK_REDACTED = LINK_REDACTED;
12
+ // The fields Reply hands a link in: v3's connectionLink and the v1 shared page's url.
13
+ const LINK_FIELDS = ['connectionlink', 'url'];
14
+ // Too short to be a token, and short enough to be an ordinary word of a URL.
15
+ const SHORTEST_TOKEN = 8;
16
+ const SHORTEST_INNER_TOKEN = 16;
17
+ const URL_IN_TEXT = /https?:\/\/[^\s"'<>]+/gi;
18
+ const safe_decode = (part) => {
19
+ try {
20
+ return decodeURIComponent(part);
21
+ }
22
+ catch {
23
+ return part;
24
+ }
25
+ };
26
+ // A link, and every token it carries: its last path segment, every query value, and any inner path
27
+ // segment that looks generated (long, with a digit in it), each as written and decoded.
28
+ const add_link = (link, found) => {
29
+ found.add(link);
30
+ let url;
31
+ try {
32
+ url = new URL(link);
33
+ }
34
+ catch {
35
+ return;
36
+ }
37
+ const segments = url.pathname.split('/').filter(Boolean);
38
+ const parts = [
39
+ ...segments.slice(0, -1).filter(p => p.length >= SHORTEST_INNER_TOKEN && /[0-9]/.test(p)),
40
+ ...segments.slice(-1),
41
+ ...[...url.searchParams.values()],
42
+ ];
43
+ for (const part of parts) {
44
+ for (const form of [part, safe_decode(part), encodeURIComponent(safe_decode(part))]) {
45
+ if (form.length >= SHORTEST_TOKEN) {
46
+ found.add(form);
47
+ }
48
+ }
49
+ }
50
+ };
51
+ exports.add_link = add_link;
52
+ const is_address = (text) => /^https?:\/\//i.test(text.trim());
53
+ // Every link in an answer's body, with its tokens: in a link field at any depth, or the body itself when
54
+ // it is nothing but an address.
55
+ const links_in = (data, found = new Set()) => {
56
+ if (typeof data === 'string' && is_address(data)) {
57
+ add_link(data.trim(), found);
58
+ }
59
+ else if (Array.isArray(data)) {
60
+ data.forEach(d => links_in(d, found));
61
+ }
62
+ else if ((0, call_1.is_object)(data)) {
63
+ for (const [k, v] of Object.entries(data)) {
64
+ if (typeof v === 'string' && LINK_FIELDS.includes(k.toLowerCase())) {
65
+ add_link(v, found);
66
+ }
67
+ else {
68
+ links_in(v, found);
69
+ }
70
+ }
71
+ }
72
+ return found;
73
+ };
74
+ exports.links_in = links_in;
75
+ // Every string of a body at any depth, the body itself when it is one.
76
+ const strings_of = (data, found = []) => {
77
+ if (typeof data === 'string') {
78
+ found.push(data);
79
+ }
80
+ else if (Array.isArray(data)) {
81
+ data.forEach(d => strings_of(d, found));
82
+ }
83
+ else if ((0, call_1.is_object)(data)) {
84
+ Object.values(data).forEach(v => strings_of(v, found));
85
+ }
86
+ return found;
87
+ };
88
+ // The secrets of a body that is secret whatever its shape: every address inside any of its strings,
89
+ // with its tokens, and every string that is wholly one value, such as a bare token.
90
+ const body_secrets = (data) => {
91
+ const found = links_in(data);
92
+ for (const text of strings_of(data)) {
93
+ for (const url of text.match(URL_IN_TEXT) ?? []) {
94
+ add_link(url, found);
95
+ }
96
+ if (!/\s/.test(text.trim()) && text.trim().length >= SHORTEST_TOKEN) {
97
+ add_link(text.trim(), found);
98
+ }
99
+ }
100
+ return found;
101
+ };
102
+ const redact_links = (text, secrets) => [...secrets].sort((a, b) => b.length - a.length).reduce((t, s) => t.split(s).join(LINK_REDACTED), text);
103
+ exports.redact_links = redact_links;
104
+ // curl -v style, as `reply api --verbose` writes it, with the answer's body after its headers. A secret
105
+ // body is never shown, only that there was one.
106
+ const trace_lines = (a, secret_body) => {
107
+ const lines = [];
108
+ if (a.request) {
109
+ lines.push(`> ${a.request.method} ${a.request.url}`);
110
+ for (const [k, v] of Object.entries(a.request.headers)) {
111
+ lines.push(`> ${k}: ${v}`);
112
+ }
113
+ if (a.request.body) {
114
+ lines.push('>', `> ${a.request.body}`);
115
+ }
116
+ }
117
+ lines.push(`< ${a.status}`);
118
+ for (const [k, v] of Object.entries(a.headers)) {
119
+ lines.push(`< ${k}: ${/cookie/i.test(k) ? output_1.REDACTED : v}`);
120
+ }
121
+ if (a.data !== null && a.data !== '') {
122
+ const shown = secret_body ? LINK_REDACTED : typeof a.data === 'string' ? a.data : JSON.stringify(a.data);
123
+ lines.push('<', `< ${shown}`);
124
+ }
125
+ return lines;
126
+ };
127
+ const secrets_of = (a, secret_body) => (secret_body ? body_secrets(a.data) : links_in(a.data));
128
+ // One call of an account command. The links in its answer never reach the trace. With `secret_body`
129
+ // (the shared page, whose answer is the address in whatever shape Reply gives it) the trace shows none
130
+ // of the body, and nothing of it appears anywhere else in the trace either.
131
+ const account_call = async (s, g, method, path, kind, body, opts = {}) => {
132
+ const a = await (0, call_1.call_reply)(s, method, path, kind, body);
133
+ if (g.verbose) {
134
+ const secret_body = opts.secret_body === true;
135
+ console.error(redact_links(trace_lines(a, secret_body).join('\n'), secrets_of(a, secret_body)));
136
+ }
137
+ return a;
138
+ };
139
+ exports.account_call = account_call;
140
+ // The same answer with every secret of its body replaced, for an error built from a secret body.
141
+ const without_secrets = (a) => {
142
+ const secrets = body_secrets(a.data);
143
+ const clean = (v) => {
144
+ if (typeof v === 'string') {
145
+ return redact_links(v, secrets);
146
+ }
147
+ if (Array.isArray(v)) {
148
+ return v.map(clean);
149
+ }
150
+ return (0, call_1.is_object)(v) ? Object.fromEntries(Object.entries(v).map(([k, x]) => [k, clean(x)])) : v;
151
+ };
152
+ return { ...a, data: clean(a.data) };
153
+ };
154
+ exports.without_secrets = without_secrets;
155
+ // Reply's refusals of the account routes, each at the status Reply answers it with, under the CLI's
156
+ // code. Reply's own code always travels in reply_code; any other answer reads as every operation reads it.
157
+ const ACCOUNT_REFUSALS = {
158
+ 'emailAccount.notFound': {
159
+ status: 404, code: 'email_account.not_found', title: 'Reply has no email account by that id that this user can act on.',
160
+ },
161
+ 'emailAccount.limitReached': {
162
+ status: 409, code: 'email_account.limit_reached', title: 'The plan\'s email account limit is reached, so no link was made.',
163
+ },
164
+ 'emailAccount.noFreeMailboxSlots': {
165
+ status: 409, code: 'email_account.no_free_mailbox_slots', title: 'One more email account would need a paid seat, so no link was made.',
166
+ },
167
+ 'emailAccount.reconnectNotSupported': {
168
+ status: 400, code: 'email_account.reconnect_not_supported',
169
+ title: 'Only a Gmail or Office 365 single-click mailbox can be reconnected by link, so no link was made.',
170
+ },
171
+ 'linkedInAccount.notFound': {
172
+ status: 404, code: 'linkedin.account_not_found', title: 'Reply has no LinkedIn account by that id that this user can act on.',
173
+ },
174
+ 'linkedInAccount.limitReached': {
175
+ status: 409, code: 'linkedin.account_limit_reached', title: 'The plan has no room for another LinkedIn account, so no link was made.',
176
+ },
177
+ 'linkedInAccount.accountInUse': {
178
+ status: 409, code: 'linkedin.account_in_use', title: 'Sequences use the LinkedIn account, so it was not deleted; --force deletes it anyway.',
179
+ },
180
+ 'linkedInAccount.cookieInvalid': {
181
+ status: 400, code: 'linkedin.invalid_cookie', title: 'The LinkedIn account\'s session is no longer valid; reconnect the account.',
182
+ },
183
+ };
184
+ exports.ACCOUNT_REFUSALS = ACCOUNT_REFUSALS;
185
+ const account_refusal = (a, kind) => {
186
+ const reply_code = (0, call_1.reply_code_of)(a);
187
+ const known = reply_code === undefined ? undefined : ACCOUNT_REFUSALS[reply_code];
188
+ if (known === undefined || known.status !== a.status) {
189
+ return (0, call_1.refusal)(a, kind);
190
+ }
191
+ return new errors_1.Operation_error(known.code, known.title, { status: a.status, reply_code, detail: (0, call_1.detail_of)(a) });
192
+ };
193
+ exports.account_refusal = account_refusal;
194
+ // A route this Reply does not have answers 404 with no code of Reply's; one it has answers its own.
195
+ const route_missing = (a) => a.status === 404 && (0, call_1.reply_code_of)(a) === undefined;
196
+ exports.route_missing = route_missing;
197
+ //# sourceMappingURL=account-call.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account-call.js","sourceRoot":"","sources":["../../src/operations/account-call.ts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AAK,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,EACpD,CAAC;QACG,OAAO,IAAA,cAAO,EAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IAC5B,CAAC;IACD,OAAO,IAAI,wBAAe,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,EAAC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,IAAA,gBAAS,EAAC,CAAC,CAAC,EAAC,CAAC,CAAC;AAC9G,CAAC,CAAC;AAKqD,0CAAe;AAHtE,oGAAoG;AACpG,MAAM,aAAa,GAAG,CAAC,CAAS,EAAU,EAAE,CAAA,CAAC,CAAC,MAAM,KAAK,GAAG,IAAI,IAAA,oBAAa,EAAC,CAAC,CAAC,KAAK,SAAS,CAAC;AAEvB,sCAAa"}
@@ -0,0 +1,14 @@
1
+ import { type Op_globals } from './options';
2
+ import type { Cli_context } from '../context';
3
+ type Link_opts = {
4
+ channel?: string;
5
+ provider?: string;
6
+ name?: string;
7
+ allowSharedPage?: boolean;
8
+ };
9
+ declare const handle_account_connect: (opts: Link_opts, ctx: Cli_context, g: Op_globals) => Promise<void>;
10
+ declare const handle_account_reconnect: (id_arg: string, opts: Link_opts, ctx: Cli_context, g: Op_globals) => Promise<void>;
11
+ declare const handle_account_pending: (opts: {
12
+ channel?: string;
13
+ }, ctx: Cli_context, g: Op_globals) => Promise<void>;
14
+ export { handle_account_connect, handle_account_reconnect, handle_account_pending };
@@ -0,0 +1,209 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.handle_account_pending = exports.handle_account_reconnect = exports.handle_account_connect = void 0;
4
+ const errors_1 = require("../utils/errors");
5
+ const call_1 = require("./call");
6
+ const account_call_1 = require("./account-call");
7
+ const shared_page_1 = require("./shared-page");
8
+ const accounts_1 = require("./accounts");
9
+ const options_1 = require("./options");
10
+ const result_1 = require("./result");
11
+ const EMAIL_NAME_MAX = 100; // Reply's limit on a connection link's label
12
+ const email_link_not_available = () => new errors_1.Operation_error('email_link.not_available', 'This Reply does not issue one-mailbox email connection links yet, so no link was made.', {
13
+ status: 404,
14
+ hint: 'With --allow-shared-page the account\'s hosted mailbox page is printed instead; '
15
+ + `${shared_page_1.SHARED_PAGE_WARNING}.`,
16
+ });
17
+ const text_or_null = (v) => (typeof v === 'string' && v.trim() !== '' ? v : null);
18
+ const positive_or_null = (v) => (typeof v === 'number' && Number.isSafeInteger(v) && v > 0 ? v : null);
19
+ // The link of a v3 answer, or an unreadable answer: the write was made, so a link Reply did not give back
20
+ // means one may exist that nobody holds.
21
+ const link_of = (a) => {
22
+ if (!(0, call_1.is_object)(a.data) || typeof a.data.connectionLink !== 'string' || a.data.connectionLink === '') {
23
+ throw (0, call_1.unreadable)(a, 'write');
24
+ }
25
+ return { link: a.data.connectionLink, body: a.data };
26
+ };
27
+ const connection_link = (channel, kind, a, id) => {
28
+ const { link, body } = link_of(a);
29
+ return {
30
+ channel, ...(id === undefined ? {} : { id }), link,
31
+ expires_at: text_or_null(body.expiresAtUtc), pending_id: positive_or_null(body.pendingAccountId),
32
+ kind, link_kind: 'connection_link',
33
+ };
34
+ };
35
+ // The account user's hosted mailbox page, from Reply's v1 route: the provider's connect when one is named,
36
+ // else the index. Reply's v1 gives no code, so the plan's refusal is named here.
37
+ const shared_page = async (s, g, kind, provider, id) => {
38
+ // Its answer is the address, in whatever shape Reply gives it, so the whole body is a secret.
39
+ const a = await (0, account_call_1.account_call)(s, g, 'GET', '/v1/SharedPageUrl', 'read', undefined, { secret_body: true });
40
+ if (a.status === 403 && /shared page is not enabled/i.test(JSON.stringify(a.data ?? ''))) {
41
+ throw new errors_1.Operation_error('shared_page.not_enabled', 'The account\'s plan does not include hosted pages, so there is no shared page.', {
42
+ status: 403,
43
+ });
44
+ }
45
+ if (a.status !== 200) {
46
+ throw (0, call_1.refusal)((0, account_call_1.without_secrets)(a), 'read');
47
+ }
48
+ // {"url": …} as Reply's v1 answers it; a bare string is read as the address too.
49
+ const url = typeof a.data === 'string' ? a.data.trim() : (0, call_1.is_object)(a.data) ? a.data.url ?? a.data.Url : undefined;
50
+ const page = typeof url === 'string' ? (0, shared_page_1.read_shared_page)(url) : null;
51
+ if (page === null) {
52
+ throw (0, call_1.unreadable)(a, 'read');
53
+ }
54
+ return {
55
+ channel: 'email', ...(id === undefined ? {} : { id }), link: (0, shared_page_1.shared_page_link)(page, provider, kind),
56
+ expires_at: null, pending_id: null, kind, link_kind: 'shared_page', warning: shared_page_1.SHARED_PAGE_WARNING,
57
+ };
58
+ };
59
+ const parse_provider = (raw) => (0, options_1.parse_choice)(raw, '--provider', shared_page_1.HOSTED_PROVIDERS);
60
+ const email_only = (opts) => {
61
+ for (const [value, flag] of [[opts.provider, '--provider'], [opts.allowSharedPage, '--allow-shared-page']]) {
62
+ if (value !== undefined && value !== false) {
63
+ throw new errors_1.UsageError(`${flag} applies to --channel email only.`, { code: 'usage.channel' });
64
+ }
65
+ }
66
+ };
67
+ const connect_linkedin = async (s, g, name) => {
68
+ // connection-link, not connect: it makes a pending entry, so the attempt can be listed and revoked.
69
+ const a = await (0, account_call_1.account_call)(s, g, 'POST', '/v3/linkedin-accounts/connection-link', 'write', { name });
70
+ if (a.status !== 201 && a.status !== 200) {
71
+ throw (0, account_call_1.account_refusal)(a, 'write');
72
+ }
73
+ return connection_link('linkedin', 'connect', a);
74
+ };
75
+ const connect_email = async (s, g, provider, name, allow_shared_page) => {
76
+ if (provider === undefined) {
77
+ // Reply's one-mailbox link is made for one provider. The shared page's index needs none, and is
78
+ // given only by a Reply without those links: a read of their list says which Reply this is.
79
+ const probe = await (0, account_call_1.account_call)(s, g, 'GET', '/v3/email-accounts/pending', 'read');
80
+ if (!(0, account_call_1.route_missing)(probe)) {
81
+ if (probe.status === 401 || probe.status === 429 || probe.status >= 500) {
82
+ throw (0, call_1.refusal)(probe, 'read');
83
+ }
84
+ throw new errors_1.Operation_error('email_link.provider_required', 'This Reply issues one-mailbox connection links, and each is made for one provider, so none was made.', {
85
+ status: probe.status, hint: 'Name the mailbox\'s provider: --provider gmail or --provider office365.',
86
+ });
87
+ }
88
+ return shared_page(s, g, 'connect', undefined);
89
+ }
90
+ const a = await (0, account_call_1.account_call)(s, g, 'POST', '/v3/email-accounts/connection-link', 'write', { provider, ...(name === undefined ? {} : { name }) });
91
+ if (a.status === 201 || a.status === 200) {
92
+ return connection_link('email', 'connect', a);
93
+ }
94
+ if (!(0, account_call_1.route_missing)(a)) {
95
+ throw (0, account_call_1.account_refusal)(a, 'write');
96
+ }
97
+ if (!allow_shared_page) {
98
+ throw email_link_not_available();
99
+ }
100
+ return shared_page(s, g, 'connect', provider);
101
+ };
102
+ const handle_account_connect = async (opts, ctx, g) => {
103
+ const channel = (0, accounts_1.require_channel)(opts.channel);
104
+ const name = opts.name?.trim() === '' ? undefined : opts.name?.trim();
105
+ if (channel === 'linkedin') {
106
+ email_only(opts);
107
+ if (name === undefined) {
108
+ throw new errors_1.UsageError('--name is required for a LinkedIn connection link: Reply lists the pending account under it.', {
109
+ code: 'usage.name',
110
+ });
111
+ }
112
+ const s = await (0, call_1.open_session)(ctx, g);
113
+ (0, result_1.print_result)(await connect_linkedin(s, g, name), g);
114
+ return;
115
+ }
116
+ const provider = parse_provider(opts.provider);
117
+ if (name !== undefined && name.length > EMAIL_NAME_MAX) {
118
+ throw new errors_1.UsageError(`--name must be at most ${EMAIL_NAME_MAX} characters.`, { code: 'usage.name' });
119
+ }
120
+ if (provider === undefined && opts.allowSharedPage !== true) {
121
+ throw new errors_1.UsageError('--provider is required for an email connection link: gmail or office365.', {
122
+ code: 'usage.provider',
123
+ hint: 'Only with --allow-shared-page, and only on a Reply without one-mailbox links, does the CLI print the hosted '
124
+ + 'mailbox page without a provider.',
125
+ });
126
+ }
127
+ const s = await (0, call_1.open_session)(ctx, g);
128
+ (0, result_1.print_result)(await connect_email(s, g, provider, name, opts.allowSharedPage === true), g);
129
+ };
130
+ exports.handle_account_connect = handle_account_connect;
131
+ const handle_account_reconnect = async (id_arg, opts, ctx, g) => {
132
+ const channel = (0, accounts_1.require_channel)(opts.channel);
133
+ if (opts.name !== undefined) {
134
+ throw new errors_1.UsageError('--name applies to account connect only.', { code: 'usage.name' });
135
+ }
136
+ if (channel === 'linkedin') {
137
+ email_only(opts);
138
+ const id = (0, options_1.parse_id)(id_arg, 'LinkedIn account id');
139
+ const s = await (0, call_1.open_session)(ctx, g);
140
+ const a = await (0, account_call_1.account_call)(s, g, 'POST', `/v3/linkedin-accounts/${id}/reconnect`, 'write');
141
+ if (a.status !== 200) {
142
+ throw (0, account_call_1.account_refusal)(a, 'write');
143
+ }
144
+ (0, result_1.print_result)(connection_link('linkedin', 'reconnect', a, id), g);
145
+ return;
146
+ }
147
+ const id = (0, options_1.parse_id)(id_arg, 'Email account id', options_1.LARGEST_SAFE_ID);
148
+ const provider = parse_provider(opts.provider);
149
+ const s = await (0, call_1.open_session)(ctx, g);
150
+ // Reply takes the provider from the mailbox itself; --provider picks only the shared page's address.
151
+ const a = await (0, account_call_1.account_call)(s, g, 'POST', `/v3/email-accounts/${id}/reconnect`, 'write');
152
+ if (a.status === 200 || a.status === 201) {
153
+ (0, result_1.print_result)(connection_link('email', 'reconnect', a, id), g);
154
+ return;
155
+ }
156
+ if (!(0, account_call_1.route_missing)(a)) {
157
+ throw (0, account_call_1.account_refusal)(a, 'write');
158
+ }
159
+ if (opts.allowSharedPage !== true) {
160
+ throw email_link_not_available();
161
+ }
162
+ (0, result_1.print_result)(await shared_page(s, g, 'reconnect', provider, id), g);
163
+ };
164
+ exports.handle_account_reconnect = handle_account_reconnect;
165
+ const pending_items = (a, channel) => {
166
+ if (!Array.isArray(a.data)) {
167
+ throw (0, call_1.unreadable)(a, 'read');
168
+ }
169
+ return a.data.map(entry => {
170
+ if (!(0, call_1.is_object)(entry) || positive_or_null(entry.id) === null) {
171
+ throw new errors_1.Operation_error('reply.unavailable', 'Reply listed a pending account without a usable id.', { status: a.status });
172
+ }
173
+ // A pending LinkedIn account is always a connect, and its link is not kept: it is a credential.
174
+ const kind = channel === 'linkedin' ? 'connect' : (entry.kind === 'connect' || entry.kind === 'reconnect' ? entry.kind : null);
175
+ return {
176
+ channel, id: entry.id, name: text_or_null(entry.name), kind,
177
+ account_id: channel === 'email' ? positive_or_null(entry.emailAccountId) : null,
178
+ expires_at: text_or_null(entry.expiresAtUtc), expired: typeof entry.isExpired === 'boolean' ? entry.isExpired : null,
179
+ };
180
+ });
181
+ };
182
+ const handle_account_pending = async (opts, ctx, g) => {
183
+ const only = (0, options_1.parse_choice)(opts.channel, '--channel', accounts_1.ACCOUNT_CHANNELS);
184
+ const s = await (0, call_1.open_session)(ctx, g);
185
+ const items = [];
186
+ const unsupported = [];
187
+ if (only !== 'linkedin') {
188
+ const a = await (0, account_call_1.account_call)(s, g, 'GET', '/v3/email-accounts/pending', 'read');
189
+ if ((0, account_call_1.route_missing)(a)) {
190
+ unsupported.push('email');
191
+ }
192
+ else if (a.status === 200) {
193
+ items.push(...pending_items(a, 'email'));
194
+ }
195
+ else {
196
+ throw (0, account_call_1.account_refusal)(a, 'read');
197
+ }
198
+ }
199
+ if (only !== 'email') {
200
+ const a = await (0, account_call_1.account_call)(s, g, 'GET', '/v3/linkedin-accounts/pending', 'read');
201
+ if (a.status !== 200) {
202
+ throw (0, account_call_1.account_refusal)(a, 'read');
203
+ }
204
+ items.push(...pending_items(a, 'linkedin'));
205
+ }
206
+ (0, result_1.print_result)({ items, supported: unsupported.length === 0, unsupported_channels: unsupported }, g);
207
+ };
208
+ exports.handle_account_pending = handle_account_pending;
209
+ //# sourceMappingURL=account-links.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account-links.js","sourceRoot":"","sources":["../../src/operations/account-links.ts"],"names":[],"mappings":";;;AAAA,4CAA4D;AAC5D,iCAAkG;AAClG,iDAA6F;AAC7F,+CAA8H;AAC9H,yCAAmF;AACnF,uCAAmF;AACnF,qCAAsC;AAatC,MAAM,cAAc,GAAG,GAAG,C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I,CAAC,GAAG,aAAa,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;QAC7C,CAAC;aAED,CAAC;YACG,MAAM,IAAA,8BAAe,EAAC,CAAC,EAAE,MAAM,CAAC,CAAC;QACrC,CAAC;IACL,CAAC;IACD,IAAI,IAAI,KAAK,OAAO,EACpB,CAAC;QACG,MAAM,CAAC,GAAG,MAAM,IAAA,2BAAY,EAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,+BAA+B,EAAE,MAAM,CAAC,CAAC;QACnF,IAAI,CAAC,CAAC,MAAM,KAAK,GAAG,EACpB,CAAC;YACG,MAAM,IAAA,8BAAe,EAAC,CAAC,EAAE,MAAM,CAAC,CAAC;QACrC,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC;IAChD,CAAC;IACD,IAAA,qBAAY,EAAC,EAAC,KAAK,EAAE,SAAS,EAAE,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,oBAAoB,EAAE,WAAW,EAAC,EAAE,CAAC,CAAC,CAAC;AACrG,CAAC,CAAC;AAEwD,wDAAsB"}
@@ -0,0 +1,20 @@
1
+ import { type Op_globals } from './options';
2
+ import type { Cli_context } from '../context';
3
+ declare const handle_account_limits: (id_arg: string, opts: {
4
+ channel?: string;
5
+ daily?: string;
6
+ set?: string;
7
+ }, ctx: Cli_context, g: Op_globals) => Promise<void>;
8
+ declare const handle_account_pause: (id_arg: string, opts: {
9
+ channel?: string;
10
+ }, ctx: Cli_context, g: Op_globals) => Promise<void>;
11
+ declare const handle_account_resume: (id_arg: string, opts: {
12
+ channel?: string;
13
+ }, ctx: Cli_context, g: Op_globals) => Promise<void>;
14
+ declare const handle_account_unblock: (id_arg: string, ctx: Cli_context, g: Op_globals) => Promise<void>;
15
+ declare const handle_account_delete: (id_arg: string, opts: {
16
+ channel?: string;
17
+ yes?: boolean;
18
+ force?: boolean;
19
+ }, ctx: Cli_context, g: Op_globals) => Promise<void>;
20
+ export { handle_account_limits, handle_account_pause, handle_account_resume, handle_account_unblock, handle_account_delete };