reply-cli 0.2.0 → 0.3.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 +107 -144
- package/dist/api/headers.d.ts +4 -0
- package/dist/api/headers.js +13 -0
- package/dist/api/headers.js.map +1 -0
- package/dist/auth/oauth-flow.d.ts +38 -0
- package/dist/auth/oauth-flow.js +193 -0
- package/dist/auth/oauth-flow.js.map +1 -0
- package/dist/auth/pkce.d.ts +9 -0
- package/dist/auth/pkce.js +19 -0
- package/dist/auth/pkce.js.map +1 -0
- package/dist/auth/request-identity.d.ts +16 -0
- package/dist/auth/request-identity.js +67 -0
- package/dist/auth/request-identity.js.map +1 -0
- package/dist/auth/resolve.d.ts +23 -0
- package/dist/auth/resolve.js +55 -0
- package/dist/auth/resolve.js.map +1 -0
- package/dist/auth/status.d.ts +19 -0
- package/dist/auth/status.js +27 -0
- package/dist/auth/status.js.map +1 -0
- package/dist/auth/token.d.ts +29 -0
- package/dist/auth/token.js +39 -0
- package/dist/auth/token.js.map +1 -0
- package/dist/commands/api.d.ts +19 -0
- package/dist/commands/api.js +137 -0
- package/dist/commands/api.js.map +1 -0
- package/dist/commands/auth.d.ts +19 -3
- package/dist/commands/auth.js +251 -16
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/authed.d.ts +13 -0
- package/dist/commands/authed.js +20 -0
- package/dist/commands/authed.js.map +1 -0
- package/dist/commands/profile.d.ts +31 -0
- package/dist/commands/profile.js +348 -0
- package/dist/commands/profile.js.map +1 -0
- package/dist/commands/team.d.ts +17 -0
- package/dist/commands/team.js +146 -0
- package/dist/commands/team.js.map +1 -0
- package/dist/config.d.ts +14 -0
- package/dist/config.js +80 -0
- package/dist/config.js.map +1 -0
- package/dist/context.d.ts +15 -0
- package/dist/context.js +17 -0
- package/dist/context.js.map +1 -0
- package/dist/credentials/file-store.d.ts +13 -0
- package/dist/credentials/file-store.js +88 -0
- package/dist/credentials/file-store.js.map +1 -0
- package/dist/credentials/types.d.ts +25 -0
- package/dist/credentials/types.js +3 -0
- package/dist/credentials/types.js.map +1 -0
- package/dist/index.js +97 -69
- package/dist/index.js.map +1 -1
- package/dist/profile.d.ts +51 -0
- package/dist/profile.js +295 -0
- package/dist/profile.js.map +1 -0
- package/dist/teams.d.ts +14 -0
- package/dist/teams.js +103 -0
- package/dist/teams.js.map +1 -0
- package/dist/utils/client.d.ts +19 -34
- package/dist/utils/client.js +123 -94
- package/dist/utils/client.js.map +1 -1
- package/dist/utils/errors.d.ts +47 -0
- package/dist/utils/errors.js +86 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/output.d.ts +7 -19
- package/dist/utils/output.js +39 -81
- package/dist/utils/output.js.map +1 -1
- package/package.json +10 -25
- package/dist/commands/contacts.d.ts +0 -35
- package/dist/commands/contacts.js +0 -412
- package/dist/commands/contacts.js.map +0 -1
- package/dist/commands/email-accounts.d.ts +0 -11
- package/dist/commands/email-accounts.js +0 -97
- package/dist/commands/email-accounts.js.map +0 -1
- package/dist/commands/inbox.d.ts +0 -30
- package/dist/commands/inbox.js +0 -225
- package/dist/commands/inbox.js.map +0 -1
- package/dist/commands/lists.d.ts +0 -20
- package/dist/commands/lists.js +0 -137
- package/dist/commands/lists.js.map +0 -1
- package/dist/commands/reports.d.ts +0 -10
- package/dist/commands/reports.js +0 -70
- package/dist/commands/reports.js.map +0 -1
- package/dist/commands/schedules.d.ts +0 -6
- package/dist/commands/schedules.js +0 -59
- package/dist/commands/schedules.js.map +0 -1
- package/dist/commands/sequence-contacts.d.ts +0 -19
- package/dist/commands/sequence-contacts.js +0 -129
- package/dist/commands/sequence-contacts.js.map +0 -1
- package/dist/commands/sequences-stats.d.ts +0 -42
- package/dist/commands/sequences-stats.js +0 -99
- package/dist/commands/sequences-stats.js.map +0 -1
- package/dist/commands/sequences.d.ts +0 -22
- package/dist/commands/sequences.js +0 -211
- package/dist/commands/sequences.js.map +0 -1
- package/dist/utils/auth.d.ts +0 -2
- package/dist/utils/auth.js +0 -33
- package/dist/utils/auth.js.map +0 -1
- package/dist/utils/command.d.ts +0 -18
- package/dist/utils/command.js +0 -51
- package/dist/utils/command.js.map +0 -1
- package/dist/utils/csv.d.ts +0 -19
- package/dist/utils/csv.js +0 -118
- package/dist/utils/csv.js.map +0 -1
- package/dist/utils/pagination.d.ts +0 -22
- package/dist/utils/pagination.js +0 -37
- package/dist/utils/pagination.js.map +0 -1
- package/dist/utils/resolve.d.ts +0 -4
- package/dist/utils/resolve.js +0 -34
- package/dist/utils/resolve.js.map +0 -1
package/dist/commands/auth.js
CHANGED
|
@@ -1,31 +1,266 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.handle_whoami = exports.auth_command = void 0;
|
|
6
|
+
exports.handle_login_token = exports.handle_login = exports.handle_whoami = exports.handle_status = exports.principal_label = exports.normalize_principal = exports.auth_command = void 0;
|
|
7
|
+
const readline_1 = __importDefault(require("readline"));
|
|
4
8
|
const commander_1 = require("commander");
|
|
9
|
+
const config_1 = require("../config");
|
|
10
|
+
const context_1 = require("../context");
|
|
5
11
|
const client_1 = require("../utils/client");
|
|
6
|
-
const
|
|
12
|
+
const resolve_1 = require("../auth/resolve");
|
|
13
|
+
const request_identity_1 = require("../auth/request-identity");
|
|
14
|
+
const oauth_flow_1 = require("../auth/oauth-flow");
|
|
15
|
+
const status_1 = require("../auth/status");
|
|
16
|
+
const errors_1 = require("../utils/errors");
|
|
7
17
|
const output_1 = require("../utils/output");
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
18
|
+
const read_globals = (cmd) => {
|
|
19
|
+
const o = cmd.optsWithGlobals();
|
|
20
|
+
return {
|
|
21
|
+
apiKey: o.apiKey, profile: o.profile,
|
|
22
|
+
teamId: o.teamId, userId: o.userId, userEmail: o.userEmail,
|
|
23
|
+
json: o.json, pretty: o.pretty,
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
// Resolve the team/acting-user headers for a request from the global flags,
|
|
27
|
+
// env, and the profile's pinned team. `credential_type` only affects the
|
|
28
|
+
// OAuth advisory note; the headers themselves are never gated on it.
|
|
29
|
+
const resolve_identity = (g, ctx, credential_type) => (0, request_identity_1.resolve_request_identity)({
|
|
30
|
+
team_id_flag: g.teamId,
|
|
31
|
+
user_id_flag: g.userId,
|
|
32
|
+
user_email_flag: g.userEmail,
|
|
33
|
+
env: process.env,
|
|
34
|
+
profile_team_id: ctx.team_id,
|
|
35
|
+
credential_type,
|
|
36
|
+
});
|
|
37
|
+
const print_opts = (g) => ({ json: g.json, pretty: g.pretty });
|
|
38
|
+
const wants_json = (g) => Boolean(g.json || g.pretty);
|
|
39
|
+
// Only surface the profile in human output when it's not the implicit default,
|
|
40
|
+
// so the common (no-profile) user never sees profile noise.
|
|
41
|
+
const profile_note = (name) => name === 'default' ? '' : ` (profile: ${name})`;
|
|
42
|
+
// v3 /whoami returns exactly {userId, username, teamId} (WhoamiResponse);
|
|
43
|
+
// read those three, guarding types so a malformed body degrades to empty.
|
|
44
|
+
const normalize_principal = (raw) => {
|
|
45
|
+
const num = (v) => typeof v === 'number' ? v : undefined;
|
|
46
|
+
const str = (v) => typeof v === 'string' ? v : undefined;
|
|
47
|
+
return {
|
|
48
|
+
id: num(raw.userId),
|
|
49
|
+
username: str(raw.username),
|
|
50
|
+
team_id: num(raw.teamId),
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
exports.normalize_principal = normalize_principal;
|
|
54
|
+
const principal_label = (p) => {
|
|
55
|
+
const who = p.username ?? (p.id !== undefined ? `#${p.id}` : 'unknown');
|
|
56
|
+
const meta = [];
|
|
57
|
+
// Only append the user id as extra when the username already carries the
|
|
58
|
+
// display name — otherwise `who` is already `#id` and it would be redundant.
|
|
59
|
+
if (p.username && p.id !== undefined) {
|
|
60
|
+
meta.push(`user ${p.id}`);
|
|
61
|
+
}
|
|
62
|
+
if (p.team_id !== undefined) {
|
|
63
|
+
meta.push(`team ${p.team_id}`);
|
|
64
|
+
}
|
|
65
|
+
return meta.length ? `${who} (${meta.join(', ')})` : who;
|
|
66
|
+
};
|
|
67
|
+
exports.principal_label = principal_label;
|
|
68
|
+
const fetch_whoami = async (api_base, token, headers) => {
|
|
69
|
+
const raw = await (0, client_1.create_client)(api_base, token, headers).get('/v3/whoami');
|
|
70
|
+
return raw ?? {};
|
|
71
|
+
};
|
|
72
|
+
// The credential is already valid here; persist it before the identity lookup
|
|
73
|
+
// so a transient /whoami failure can't discard it. Enriching the stored record
|
|
74
|
+
// with the principal is best-effort.
|
|
75
|
+
const enrich_identity = async (ctx, token, headers, record) => {
|
|
76
|
+
try {
|
|
77
|
+
const user = normalize_principal(await fetch_whoami(ctx.api_base, token, headers));
|
|
78
|
+
record.user = user;
|
|
79
|
+
await ctx.store.set(ctx.key, record);
|
|
80
|
+
return user;
|
|
81
|
+
}
|
|
82
|
+
catch (e) {
|
|
83
|
+
(0, output_1.warn)(`Signed in, but could not fetch your identity: ${e.message}`);
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
const read_token_from_stdin = async () => {
|
|
88
|
+
if (process.stdin.isTTY) {
|
|
89
|
+
const rl = readline_1.default.createInterface({ input: process.stdin, output: process.stderr, terminal: true });
|
|
90
|
+
const line = await new Promise(resolve => {
|
|
91
|
+
rl.question('Paste your API key, then press Enter: ', resolve);
|
|
92
|
+
// The prompt is already written; swallow the echo of typed characters
|
|
93
|
+
// so the key never appears on screen (the piped path never echoes).
|
|
94
|
+
rl._writeToOutput = () => { };
|
|
95
|
+
});
|
|
96
|
+
rl.close();
|
|
97
|
+
process.stderr.write('\n');
|
|
98
|
+
return line.trim();
|
|
99
|
+
}
|
|
100
|
+
const chunks = [];
|
|
101
|
+
for await (const chunk of process.stdin) {
|
|
102
|
+
chunks.push(Buffer.from(chunk));
|
|
103
|
+
}
|
|
104
|
+
return Buffer.concat(chunks).toString('utf8').trim();
|
|
105
|
+
};
|
|
106
|
+
const handle_login = async (ctx, g, login = oauth_flow_1.run_login) => {
|
|
107
|
+
// Validate identity flags before opening the browser, so a bad combo fails fast.
|
|
108
|
+
const identity = resolve_identity(g, ctx, 'oauth');
|
|
109
|
+
identity.warnings.forEach(w => (0, output_1.warn)(w));
|
|
110
|
+
const record = await login({ authority: ctx.authority });
|
|
111
|
+
// Persist first — a good login must survive a transient /whoami failure
|
|
112
|
+
// (else the user pays another browser round-trip).
|
|
113
|
+
await ctx.store.set(ctx.key, record);
|
|
114
|
+
const user = await enrich_identity(ctx, record.access_token, identity.headers, record);
|
|
115
|
+
if (wants_json(g)) {
|
|
116
|
+
(0, output_1.print)({ logged_in: true, method: 'oauth', profile: ctx.profile, user }, print_opts(g));
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
(0, output_1.success)(`Logged in${user ? ` as ${principal_label(user)}` : ''}${profile_note(ctx.profile)}.`);
|
|
120
|
+
};
|
|
121
|
+
exports.handle_login = handle_login;
|
|
122
|
+
const handle_login_token = async (ctx, g, read_token = read_token_from_stdin) => {
|
|
123
|
+
// Validate identity flags before consuming stdin.
|
|
124
|
+
const identity = resolve_identity(g, ctx, 'api_key');
|
|
125
|
+
const key = await read_token();
|
|
126
|
+
if (!key) {
|
|
127
|
+
throw new errors_1.UsageError('No API key was provided on stdin.', {
|
|
128
|
+
code: 'usage.stdin',
|
|
129
|
+
hint: `Try: echo <key> | ${config_1.PROGRAM_NAME} auth login --with-token`,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
const raw = await fetch_whoami(ctx.api_base, key, identity.headers);
|
|
133
|
+
const user = normalize_principal(raw);
|
|
134
|
+
const record = { type: 'api_key', key, user };
|
|
135
|
+
await ctx.store.set(ctx.key, record);
|
|
136
|
+
if (wants_json(g)) {
|
|
137
|
+
(0, output_1.print)({ logged_in: true, method: 'api_key', profile: ctx.profile, user }, print_opts(g));
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
(0, output_1.success)(`Stored API key for ${principal_label(user)}${profile_note(ctx.profile)}.`);
|
|
141
|
+
};
|
|
142
|
+
exports.handle_login_token = handle_login_token;
|
|
143
|
+
const handle_logout = async (ctx, g) => {
|
|
144
|
+
const removed = await ctx.store.remove(ctx.key);
|
|
145
|
+
if (wants_json(g)) {
|
|
146
|
+
(0, output_1.print)({ logged_out: removed }, print_opts(g));
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
if (removed) {
|
|
150
|
+
(0, output_1.success)('Logged out.');
|
|
12
151
|
return;
|
|
13
152
|
}
|
|
14
|
-
(0, output_1.
|
|
15
|
-
|
|
16
|
-
|
|
153
|
+
(0, output_1.info)('No stored credential to remove.');
|
|
154
|
+
};
|
|
155
|
+
const handle_status = async (ctx, g) => {
|
|
156
|
+
const api_key_env = (0, config_1.get_env)('API_KEY');
|
|
157
|
+
const ephemeral = Boolean(g.apiKey || api_key_env);
|
|
158
|
+
const record = ephemeral ? undefined : await ctx.store.get(ctx.key);
|
|
159
|
+
const status = (0, status_1.describe_status)({
|
|
160
|
+
profile: ctx.profile,
|
|
161
|
+
api_key_flag: g.apiKey,
|
|
162
|
+
api_key_env,
|
|
163
|
+
record,
|
|
164
|
+
now: Date.now(),
|
|
165
|
+
});
|
|
166
|
+
const cred_type = ephemeral ? 'api_key' : (record?.type ?? 'api_key');
|
|
167
|
+
const { headers } = resolve_identity(g, ctx, cred_type);
|
|
168
|
+
const team_header = headers['X-TEAM-ID'];
|
|
169
|
+
const acting_user = headers['X-USER-ID'];
|
|
170
|
+
const acting_email = headers['X-User-Email'];
|
|
171
|
+
if (!status.authenticated) {
|
|
172
|
+
process.exitCode = 1;
|
|
173
|
+
}
|
|
174
|
+
if (wants_json(g)) {
|
|
175
|
+
(0, output_1.print)({
|
|
176
|
+
...status,
|
|
177
|
+
...(team_header ? { team_id: Number(team_header) } : {}),
|
|
178
|
+
...(acting_user ? { acting_user_id: Number(acting_user) } : {}),
|
|
179
|
+
...(acting_email ? { acting_email } : {}),
|
|
180
|
+
}, print_opts(g));
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
if (!status.authenticated) {
|
|
184
|
+
(0, output_1.info)(`Not authenticated${profile_note(status.profile)}.`);
|
|
185
|
+
(0, output_1.info)(`Run \`${config_1.PROGRAM_NAME} auth login\` or set ${(0, config_1.env_var)('API_KEY')}.`);
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
(0, output_1.success)('Authenticated.');
|
|
189
|
+
const lines = [];
|
|
190
|
+
if (status.profile !== 'default') {
|
|
191
|
+
lines.push(` Profile: ${status.profile}`);
|
|
192
|
+
}
|
|
193
|
+
lines.push(` Source: ${status.source}`);
|
|
194
|
+
lines.push(` Method: ${status.method}`);
|
|
195
|
+
if (status.user) {
|
|
196
|
+
lines.push(` User: ${principal_label(status.user)}`);
|
|
197
|
+
}
|
|
198
|
+
if (team_header) {
|
|
199
|
+
lines.push(` Team: ${team_header}`);
|
|
200
|
+
}
|
|
201
|
+
if (acting_email) {
|
|
202
|
+
lines.push(` Acting as: ${acting_email}`);
|
|
203
|
+
}
|
|
204
|
+
else if (acting_user) {
|
|
205
|
+
lines.push(` Acting as: user ${acting_user}`);
|
|
206
|
+
}
|
|
207
|
+
if (status.method === 'oauth') {
|
|
208
|
+
lines.push(` Expires: ${status.expires_at}${status.expired ? output_1.pc.red(' (expired)') : ''}`);
|
|
209
|
+
}
|
|
210
|
+
console.log(lines.join('\n'));
|
|
211
|
+
};
|
|
212
|
+
exports.handle_status = handle_status;
|
|
213
|
+
const handle_whoami = async (ctx, g) => {
|
|
214
|
+
const resolved = await (0, resolve_1.resolve_credential)({ api_key: g.apiKey }, { key: ctx.key, store: ctx.store, env: process.env, refresh: ctx.refresh });
|
|
215
|
+
const identity = resolve_identity(g, ctx, resolved.type);
|
|
216
|
+
identity.warnings.forEach(w => (0, output_1.warn)(w));
|
|
217
|
+
const raw = await fetch_whoami(ctx.api_base, resolved.token, identity.headers);
|
|
218
|
+
if (wants_json(g)) {
|
|
219
|
+
(0, output_1.print)(raw, print_opts(g));
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
const principal = normalize_principal(raw);
|
|
223
|
+
(0, output_1.success)(`Credential is valid (${resolved.type}, source: ${resolved.source})${profile_note(ctx.profile)}.`);
|
|
224
|
+
console.log(` ${principal_label(principal)}`);
|
|
17
225
|
};
|
|
18
226
|
exports.handle_whoami = handle_whoami;
|
|
19
|
-
const auth_command = new commander_1.Command('auth')
|
|
20
|
-
.description('Verify authentication');
|
|
227
|
+
const auth_command = new commander_1.Command('auth').description('Authenticate and inspect identity');
|
|
21
228
|
exports.auth_command = auth_command;
|
|
229
|
+
auth_command
|
|
230
|
+
.command('login')
|
|
231
|
+
.description('Log in via OAuth (browser), or --with-token to store an API key from stdin')
|
|
232
|
+
.option('--with-token', 'Read an API key from stdin instead of running the OAuth flow')
|
|
233
|
+
.addHelpText('after', `\nExamples:\n ${config_1.PROGRAM_NAME} auth login\n echo <key> | ${config_1.PROGRAM_NAME} auth login --with-token`)
|
|
234
|
+
.action(async function () {
|
|
235
|
+
const g = read_globals(this);
|
|
236
|
+
const ctx = (0, context_1.build_context)({ profile: g.profile });
|
|
237
|
+
if (this.opts().withToken) {
|
|
238
|
+
await handle_login_token(ctx, g);
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
await handle_login(ctx, g);
|
|
242
|
+
});
|
|
243
|
+
auth_command
|
|
244
|
+
.command('logout')
|
|
245
|
+
.description('Remove the stored credential')
|
|
246
|
+
.action(async function () {
|
|
247
|
+
const g = read_globals(this);
|
|
248
|
+
await handle_logout((0, context_1.build_context)({ profile: g.profile }), g);
|
|
249
|
+
});
|
|
250
|
+
auth_command
|
|
251
|
+
.command('status')
|
|
252
|
+
.description('Show the active credential source, method, user and OAuth expiry (no secrets)')
|
|
253
|
+
.addHelpText('after', `\nExamples:\n ${config_1.PROGRAM_NAME} auth status\n ${config_1.PROGRAM_NAME} auth status --json\n\nRuns offline — no API call.`)
|
|
254
|
+
.action(async function () {
|
|
255
|
+
const g = read_globals(this);
|
|
256
|
+
await handle_status((0, context_1.build_context)({ profile: g.profile }), g);
|
|
257
|
+
});
|
|
22
258
|
auth_command
|
|
23
259
|
.command('whoami')
|
|
24
|
-
.description('
|
|
25
|
-
.addHelpText('after',
|
|
260
|
+
.description('Validate the active credential against the API and print the principal')
|
|
261
|
+
.addHelpText('after', `\nExamples:\n ${config_1.PROGRAM_NAME} auth whoami\n ${config_1.PROGRAM_NAME} auth whoami --json`)
|
|
26
262
|
.action(async function () {
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
await handle_whoami(key, { json: opts.json, pretty: opts.pretty });
|
|
263
|
+
const g = read_globals(this);
|
|
264
|
+
await handle_whoami((0, context_1.build_context)({ profile: g.profile }), g);
|
|
30
265
|
});
|
|
31
266
|
//# sourceMappingURL=auth.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":";;;AAAA,yCAAkC;AAClC,4CAAoC;AACpC,wCAA8C;AAC9C,4CAAmD;AASnD,MAAM,aAAa,GAAG,KAAK,EAAC,OAAe,EAAE,UAAsB,EAAC,EAAE;IAClE,MAAM,MAAM,GAAG,MAAM,IAAA,YAAG,EAAS,OAAO,EAAE,SAAS,CAAC,CAAC;IACrD,IAAI,UAAU,CAAC,IAAI,IAAI,UAAU,CAAC,MAAM,EACxC,CAAC;QACG,IAAA,cAAK,EAAC,MAAM,EAAE,UAAU,CAAC,CAAC;QAC1B,OAAO;IACX,CAAC;IACD,IAAA,gBAAO,EAAC,mBAAmB,CAAC,CAAC;IAC7B,OAAO,CAAC,GAAG,CAAC,YAAY,WAAE,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,MAAM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qBAAY,qBAAqB,CAAC;KACxG,MAAM,CAAC,KAAK;IACT,MAAM,CAAC,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAC7B,MAAM,aAAa,CAAC,IAAA,uBAAa,EAAC,EAAC,OAAO,EAAE,CAAC,CAAC,OAAO,EAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAChE,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Cli_context } from '../context';
|
|
2
|
+
type Identity_opts = {
|
|
3
|
+
apiKey?: string;
|
|
4
|
+
teamId?: string;
|
|
5
|
+
userId?: string;
|
|
6
|
+
userEmail?: string;
|
|
7
|
+
};
|
|
8
|
+
declare const authed: (ctx: Cli_context, g: Identity_opts) => Promise<{
|
|
9
|
+
token: string;
|
|
10
|
+
headers: Record<string, string>;
|
|
11
|
+
}>;
|
|
12
|
+
export { authed };
|
|
13
|
+
export type { Identity_opts };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.authed = void 0;
|
|
4
|
+
const resolve_1 = require("../auth/resolve");
|
|
5
|
+
const request_identity_1 = require("../auth/request-identity");
|
|
6
|
+
const output_1 = require("../utils/output");
|
|
7
|
+
// Resolve the credential + team/acting-user headers for an authenticated call,
|
|
8
|
+
// surfacing identity warnings to stderr. Shared by the team and api commands
|
|
9
|
+
// (mirrors how the auth commands resolve the same pair).
|
|
10
|
+
const authed = async (ctx, g) => {
|
|
11
|
+
const resolved = await (0, resolve_1.resolve_credential)({ api_key: g.apiKey }, { key: ctx.key, store: ctx.store, env: process.env, refresh: ctx.refresh });
|
|
12
|
+
const identity = (0, request_identity_1.resolve_request_identity)({
|
|
13
|
+
team_id_flag: g.teamId, user_id_flag: g.userId, user_email_flag: g.userEmail,
|
|
14
|
+
env: process.env, profile_team_id: ctx.team_id, credential_type: resolved.type,
|
|
15
|
+
});
|
|
16
|
+
identity.warnings.forEach(w => (0, output_1.warn)(w));
|
|
17
|
+
return { token: resolved.token, headers: identity.headers };
|
|
18
|
+
};
|
|
19
|
+
exports.authed = authed;
|
|
20
|
+
//# sourceMappingURL=authed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authed.js","sourceRoot":"","sources":["../../src/commands/authed.ts"],"names":[],"mappings":";;;AAAA,6CAAmD;AACnD,+DAAkE;AAClE,4CAAqC;AAKrC,+EAA+E;AAC/E,6EAA6E;AAC7E,yDAAyD;AACzD,MAAM,MAAM,GAAG,KAAK,EAChB,GAAgB,EAAE,CAAgB,EACsB,EAAE;IAC1D,MAAM,QAAQ,GAAG,MAAM,IAAA,4BAAkB,EACrC,EAAC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAC,EAAE,EAAC,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAC,CAAC,CAAC;IACnG,MAAM,QAAQ,GAAG,IAAA,2CAAwB,EAAC;QACtC,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,eAAe,EAAE,CAAC,CAAC,SAAS;QAC5E,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,CAAC,OAAO,EAAE,eAAe,EAAE,QAAQ,CAAC,IAAI;KACjF,CAAC,CAAC;IACH,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAA,EAAE,CAAA,IAAA,aAAI,EAAC,CAAC,CAAC,CAAC,CAAC;IACtC,OAAO,EAAC,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAC,CAAC;AAC9D,CAAC,CAAC;AAEM,wBAAM"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { type Env } from '../config';
|
|
3
|
+
import type { CredentialStore } from '../credentials/types';
|
|
4
|
+
type Global_opts = {
|
|
5
|
+
json?: boolean;
|
|
6
|
+
pretty?: boolean;
|
|
7
|
+
apiKey?: string;
|
|
8
|
+
};
|
|
9
|
+
declare const parse_url: (v?: string) => string | undefined;
|
|
10
|
+
type Rename_deps = {
|
|
11
|
+
store: CredentialStore;
|
|
12
|
+
env?: Env;
|
|
13
|
+
};
|
|
14
|
+
declare const handle_rename: (old_name: string, new_name: string, g: Global_opts, deps: Rename_deps) => Promise<void>;
|
|
15
|
+
type Delete_deps = {
|
|
16
|
+
store: CredentialStore;
|
|
17
|
+
env?: Env;
|
|
18
|
+
is_tty?: boolean;
|
|
19
|
+
confirm?: (q: string) => Promise<boolean>;
|
|
20
|
+
};
|
|
21
|
+
declare const handle_delete: (name: string, opts: {
|
|
22
|
+
yes?: boolean;
|
|
23
|
+
}, g: Global_opts, deps: Delete_deps) => Promise<void>;
|
|
24
|
+
type Show_deps = {
|
|
25
|
+
store: CredentialStore;
|
|
26
|
+
env?: Env;
|
|
27
|
+
api_key_flag?: string;
|
|
28
|
+
};
|
|
29
|
+
declare const handle_show: (name: string | undefined, g: Global_opts, deps: Show_deps) => Promise<void>;
|
|
30
|
+
declare const profile_command: Command;
|
|
31
|
+
export { profile_command, handle_rename, handle_delete, handle_show, parse_url };
|