@zapier/zapier-sdk-cli 0.52.0 → 0.52.2
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/CHANGELOG.md +12 -0
- package/README.md +6 -5
- package/dist/cli.cjs +40 -10
- package/dist/cli.mjs +40 -10
- package/dist/experimental.cjs +39 -9
- package/dist/experimental.mjs +39 -9
- package/dist/index.cjs +40 -10
- package/dist/index.mjs +40 -10
- package/dist/package.json +1 -1
- package/dist/src/plugins/login/index.d.ts +1 -0
- package/dist/src/plugins/login/index.js +29 -9
- package/dist/src/plugins/login/schemas.d.ts +1 -0
- package/dist/src/plugins/login/schemas.js +4 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1260,6 +1260,9 @@ var LoginSchema = zod.z.object({
|
|
|
1260
1260
|
timeout: zod.z.string().optional().describe("Login timeout in seconds (default: 300)"),
|
|
1261
1261
|
useApprovals: zod.z.boolean().optional().describe(
|
|
1262
1262
|
"Require approvals for actions performed with these credentials"
|
|
1263
|
+
),
|
|
1264
|
+
skipPrompts: zod.z.boolean().optional().describe(
|
|
1265
|
+
"Skip interactive prompts. Uses defaults where possible; errors instead of prompting when input is required. Useful in CI, piped output, or environments where TTY detection is unreliable."
|
|
1263
1266
|
)
|
|
1264
1267
|
}).describe("Log in to Zapier to access your account");
|
|
1265
1268
|
|
|
@@ -1275,7 +1278,12 @@ function toPkceCredentials(credentials) {
|
|
|
1275
1278
|
}
|
|
1276
1279
|
return void 0;
|
|
1277
1280
|
}
|
|
1278
|
-
async function confirmRevokeAndRelogin(activeCredentials) {
|
|
1281
|
+
async function confirmRevokeAndRelogin(activeCredentials, skipPrompts) {
|
|
1282
|
+
if (skipPrompts) {
|
|
1283
|
+
throw new ZapierCliValidationError(
|
|
1284
|
+
`Already logged in as "${activeCredentials.name}". Run \`logout\` first or use an interactive terminal to re-authenticate.`
|
|
1285
|
+
);
|
|
1286
|
+
}
|
|
1279
1287
|
const { confirmed } = await inquirer__default.default.prompt([
|
|
1280
1288
|
{
|
|
1281
1289
|
type: "confirm",
|
|
@@ -1292,7 +1300,12 @@ Log out and log in again?`,
|
|
|
1292
1300
|
}
|
|
1293
1301
|
return true;
|
|
1294
1302
|
}
|
|
1295
|
-
async function confirmJwtMigration() {
|
|
1303
|
+
async function confirmJwtMigration(skipPrompts) {
|
|
1304
|
+
if (skipPrompts) {
|
|
1305
|
+
throw new ZapierCliValidationError(
|
|
1306
|
+
"Legacy JWT login detected. Run `logout` first or use an interactive terminal to migrate to client credentials."
|
|
1307
|
+
);
|
|
1308
|
+
}
|
|
1296
1309
|
const { confirmed } = await inquirer__default.default.prompt([
|
|
1297
1310
|
{
|
|
1298
1311
|
type: "confirm",
|
|
@@ -1307,7 +1320,12 @@ async function confirmJwtMigration() {
|
|
|
1307
1320
|
}
|
|
1308
1321
|
return true;
|
|
1309
1322
|
}
|
|
1310
|
-
async function confirmLocalLoginReset() {
|
|
1323
|
+
async function confirmLocalLoginReset(skipPrompts) {
|
|
1324
|
+
if (skipPrompts) {
|
|
1325
|
+
throw new ZapierCliValidationError(
|
|
1326
|
+
"Login cleanup failed and cannot be reset without confirmation. Re-run with an interactive terminal."
|
|
1327
|
+
);
|
|
1328
|
+
}
|
|
1311
1329
|
const { confirmed } = await inquirer__default.default.prompt([
|
|
1312
1330
|
{
|
|
1313
1331
|
type: "confirm",
|
|
@@ -1329,13 +1347,22 @@ function parseTimeoutSeconds(timeout) {
|
|
|
1329
1347
|
}
|
|
1330
1348
|
return timeoutSeconds;
|
|
1331
1349
|
}
|
|
1332
|
-
async function promptCredentialsName(email, baseUrl) {
|
|
1350
|
+
async function promptCredentialsName(email, skipPrompts, baseUrl) {
|
|
1351
|
+
const fallback = `${email}@${os.hostname()}`;
|
|
1352
|
+
if (skipPrompts) {
|
|
1353
|
+
if (credentialsNameExists({ name: fallback, baseUrl })) {
|
|
1354
|
+
throw new ZapierCliValidationError(
|
|
1355
|
+
`Credentials named "${fallback}" already exist. Run \`logout\` first or use an interactive terminal to choose a different name.`
|
|
1356
|
+
);
|
|
1357
|
+
}
|
|
1358
|
+
return fallback;
|
|
1359
|
+
}
|
|
1333
1360
|
const { credentialName } = await inquirer__default.default.prompt([
|
|
1334
1361
|
{
|
|
1335
1362
|
type: "input",
|
|
1336
1363
|
name: "credentialName",
|
|
1337
1364
|
message: "Enter a name to identify them:",
|
|
1338
|
-
default:
|
|
1365
|
+
default: fallback,
|
|
1339
1366
|
validate: (input) => {
|
|
1340
1367
|
if (!input.trim()) return "Name cannot be empty";
|
|
1341
1368
|
if (credentialsNameExists({ name: input.trim(), baseUrl })) {
|
|
@@ -1384,6 +1411,7 @@ var loginPlugin = zapierSdk.definePlugin(
|
|
|
1384
1411
|
supportsJsonOutput: false,
|
|
1385
1412
|
handler: async ({ sdk: sdk2, options }) => {
|
|
1386
1413
|
const timeoutSeconds = parseTimeoutSeconds(options.timeout);
|
|
1414
|
+
const skipPrompts = options.skipPrompts === true || !process.stdin.isTTY || !process.stdout.isTTY;
|
|
1387
1415
|
const resolvedCredentials = await sdk2.context.resolveCredentials();
|
|
1388
1416
|
const pkceCredentials = toPkceCredentials(resolvedCredentials);
|
|
1389
1417
|
const credentialsBaseUrl = await resolveCredentialsBaseUrl({
|
|
@@ -1394,21 +1422,22 @@ var loginPlugin = zapierSdk.definePlugin(
|
|
|
1394
1422
|
baseUrl: credentialsBaseUrl
|
|
1395
1423
|
});
|
|
1396
1424
|
if (activeCredentials) {
|
|
1397
|
-
if (!await confirmRevokeAndRelogin(activeCredentials))
|
|
1425
|
+
if (!await confirmRevokeAndRelogin(activeCredentials, skipPrompts))
|
|
1426
|
+
return;
|
|
1398
1427
|
try {
|
|
1399
1428
|
await revokeCredentials({
|
|
1400
1429
|
api: sdk2.context.api,
|
|
1401
1430
|
credentials: activeCredentials
|
|
1402
1431
|
});
|
|
1403
1432
|
} catch {
|
|
1404
|
-
if (!await confirmLocalLoginReset()) return;
|
|
1433
|
+
if (!await confirmLocalLoginReset(skipPrompts)) return;
|
|
1405
1434
|
await deleteStoredClientCredentials({
|
|
1406
1435
|
name: activeCredentials.name,
|
|
1407
1436
|
baseUrl: activeCredentials.baseUrl
|
|
1408
1437
|
});
|
|
1409
1438
|
}
|
|
1410
1439
|
} else if (hasLegacyJwtConfig()) {
|
|
1411
|
-
if (!await confirmJwtMigration()) return;
|
|
1440
|
+
if (!await confirmJwtMigration(skipPrompts)) return;
|
|
1412
1441
|
}
|
|
1413
1442
|
const { accessToken } = await runOauthFlow({
|
|
1414
1443
|
timeoutMs: timeoutSeconds * 1e3,
|
|
@@ -1426,6 +1455,7 @@ var loginPlugin = zapierSdk.definePlugin(
|
|
|
1426
1455
|
);
|
|
1427
1456
|
const credentialName = await promptCredentialsName(
|
|
1428
1457
|
profile.email,
|
|
1458
|
+
skipPrompts,
|
|
1429
1459
|
credentialsBaseUrl
|
|
1430
1460
|
);
|
|
1431
1461
|
const useApprovals = options.useApprovals === true;
|
|
@@ -3985,7 +4015,7 @@ zapierSdk.definePlugin(
|
|
|
3985
4015
|
// package.json with { type: 'json' }
|
|
3986
4016
|
var package_default = {
|
|
3987
4017
|
name: "@zapier/zapier-sdk-cli",
|
|
3988
|
-
version: "0.52.
|
|
4018
|
+
version: "0.52.2"};
|
|
3989
4019
|
|
|
3990
4020
|
// src/sdk.ts
|
|
3991
4021
|
zapierSdk.injectCliLogin(login_exports);
|
|
@@ -4013,7 +4043,7 @@ function createZapierCliSdk(options = {}) {
|
|
|
4013
4043
|
|
|
4014
4044
|
// package.json
|
|
4015
4045
|
var package_default2 = {
|
|
4016
|
-
version: "0.52.
|
|
4046
|
+
version: "0.52.2"};
|
|
4017
4047
|
|
|
4018
4048
|
// src/telemetry/builders.ts
|
|
4019
4049
|
function createCliBaseEvent(context = {}) {
|
package/dist/index.mjs
CHANGED
|
@@ -1224,6 +1224,9 @@ var LoginSchema = z.object({
|
|
|
1224
1224
|
timeout: z.string().optional().describe("Login timeout in seconds (default: 300)"),
|
|
1225
1225
|
useApprovals: z.boolean().optional().describe(
|
|
1226
1226
|
"Require approvals for actions performed with these credentials"
|
|
1227
|
+
),
|
|
1228
|
+
skipPrompts: z.boolean().optional().describe(
|
|
1229
|
+
"Skip interactive prompts. Uses defaults where possible; errors instead of prompting when input is required. Useful in CI, piped output, or environments where TTY detection is unreliable."
|
|
1227
1230
|
)
|
|
1228
1231
|
}).describe("Log in to Zapier to access your account");
|
|
1229
1232
|
|
|
@@ -1239,7 +1242,12 @@ function toPkceCredentials(credentials) {
|
|
|
1239
1242
|
}
|
|
1240
1243
|
return void 0;
|
|
1241
1244
|
}
|
|
1242
|
-
async function confirmRevokeAndRelogin(activeCredentials) {
|
|
1245
|
+
async function confirmRevokeAndRelogin(activeCredentials, skipPrompts) {
|
|
1246
|
+
if (skipPrompts) {
|
|
1247
|
+
throw new ZapierCliValidationError(
|
|
1248
|
+
`Already logged in as "${activeCredentials.name}". Run \`logout\` first or use an interactive terminal to re-authenticate.`
|
|
1249
|
+
);
|
|
1250
|
+
}
|
|
1243
1251
|
const { confirmed } = await inquirer.prompt([
|
|
1244
1252
|
{
|
|
1245
1253
|
type: "confirm",
|
|
@@ -1256,7 +1264,12 @@ Log out and log in again?`,
|
|
|
1256
1264
|
}
|
|
1257
1265
|
return true;
|
|
1258
1266
|
}
|
|
1259
|
-
async function confirmJwtMigration() {
|
|
1267
|
+
async function confirmJwtMigration(skipPrompts) {
|
|
1268
|
+
if (skipPrompts) {
|
|
1269
|
+
throw new ZapierCliValidationError(
|
|
1270
|
+
"Legacy JWT login detected. Run `logout` first or use an interactive terminal to migrate to client credentials."
|
|
1271
|
+
);
|
|
1272
|
+
}
|
|
1260
1273
|
const { confirmed } = await inquirer.prompt([
|
|
1261
1274
|
{
|
|
1262
1275
|
type: "confirm",
|
|
@@ -1271,7 +1284,12 @@ async function confirmJwtMigration() {
|
|
|
1271
1284
|
}
|
|
1272
1285
|
return true;
|
|
1273
1286
|
}
|
|
1274
|
-
async function confirmLocalLoginReset() {
|
|
1287
|
+
async function confirmLocalLoginReset(skipPrompts) {
|
|
1288
|
+
if (skipPrompts) {
|
|
1289
|
+
throw new ZapierCliValidationError(
|
|
1290
|
+
"Login cleanup failed and cannot be reset without confirmation. Re-run with an interactive terminal."
|
|
1291
|
+
);
|
|
1292
|
+
}
|
|
1275
1293
|
const { confirmed } = await inquirer.prompt([
|
|
1276
1294
|
{
|
|
1277
1295
|
type: "confirm",
|
|
@@ -1293,13 +1311,22 @@ function parseTimeoutSeconds(timeout) {
|
|
|
1293
1311
|
}
|
|
1294
1312
|
return timeoutSeconds;
|
|
1295
1313
|
}
|
|
1296
|
-
async function promptCredentialsName(email, baseUrl) {
|
|
1314
|
+
async function promptCredentialsName(email, skipPrompts, baseUrl) {
|
|
1315
|
+
const fallback = `${email}@${hostname()}`;
|
|
1316
|
+
if (skipPrompts) {
|
|
1317
|
+
if (credentialsNameExists({ name: fallback, baseUrl })) {
|
|
1318
|
+
throw new ZapierCliValidationError(
|
|
1319
|
+
`Credentials named "${fallback}" already exist. Run \`logout\` first or use an interactive terminal to choose a different name.`
|
|
1320
|
+
);
|
|
1321
|
+
}
|
|
1322
|
+
return fallback;
|
|
1323
|
+
}
|
|
1297
1324
|
const { credentialName } = await inquirer.prompt([
|
|
1298
1325
|
{
|
|
1299
1326
|
type: "input",
|
|
1300
1327
|
name: "credentialName",
|
|
1301
1328
|
message: "Enter a name to identify them:",
|
|
1302
|
-
default:
|
|
1329
|
+
default: fallback,
|
|
1303
1330
|
validate: (input) => {
|
|
1304
1331
|
if (!input.trim()) return "Name cannot be empty";
|
|
1305
1332
|
if (credentialsNameExists({ name: input.trim(), baseUrl })) {
|
|
@@ -1348,6 +1375,7 @@ var loginPlugin = definePlugin(
|
|
|
1348
1375
|
supportsJsonOutput: false,
|
|
1349
1376
|
handler: async ({ sdk: sdk2, options }) => {
|
|
1350
1377
|
const timeoutSeconds = parseTimeoutSeconds(options.timeout);
|
|
1378
|
+
const skipPrompts = options.skipPrompts === true || !process.stdin.isTTY || !process.stdout.isTTY;
|
|
1351
1379
|
const resolvedCredentials = await sdk2.context.resolveCredentials();
|
|
1352
1380
|
const pkceCredentials = toPkceCredentials(resolvedCredentials);
|
|
1353
1381
|
const credentialsBaseUrl = await resolveCredentialsBaseUrl({
|
|
@@ -1358,21 +1386,22 @@ var loginPlugin = definePlugin(
|
|
|
1358
1386
|
baseUrl: credentialsBaseUrl
|
|
1359
1387
|
});
|
|
1360
1388
|
if (activeCredentials) {
|
|
1361
|
-
if (!await confirmRevokeAndRelogin(activeCredentials))
|
|
1389
|
+
if (!await confirmRevokeAndRelogin(activeCredentials, skipPrompts))
|
|
1390
|
+
return;
|
|
1362
1391
|
try {
|
|
1363
1392
|
await revokeCredentials({
|
|
1364
1393
|
api: sdk2.context.api,
|
|
1365
1394
|
credentials: activeCredentials
|
|
1366
1395
|
});
|
|
1367
1396
|
} catch {
|
|
1368
|
-
if (!await confirmLocalLoginReset()) return;
|
|
1397
|
+
if (!await confirmLocalLoginReset(skipPrompts)) return;
|
|
1369
1398
|
await deleteStoredClientCredentials({
|
|
1370
1399
|
name: activeCredentials.name,
|
|
1371
1400
|
baseUrl: activeCredentials.baseUrl
|
|
1372
1401
|
});
|
|
1373
1402
|
}
|
|
1374
1403
|
} else if (hasLegacyJwtConfig()) {
|
|
1375
|
-
if (!await confirmJwtMigration()) return;
|
|
1404
|
+
if (!await confirmJwtMigration(skipPrompts)) return;
|
|
1376
1405
|
}
|
|
1377
1406
|
const { accessToken } = await runOauthFlow({
|
|
1378
1407
|
timeoutMs: timeoutSeconds * 1e3,
|
|
@@ -1390,6 +1419,7 @@ var loginPlugin = definePlugin(
|
|
|
1390
1419
|
);
|
|
1391
1420
|
const credentialName = await promptCredentialsName(
|
|
1392
1421
|
profile.email,
|
|
1422
|
+
skipPrompts,
|
|
1393
1423
|
credentialsBaseUrl
|
|
1394
1424
|
);
|
|
1395
1425
|
const useApprovals = options.useApprovals === true;
|
|
@@ -3949,7 +3979,7 @@ definePlugin(
|
|
|
3949
3979
|
// package.json with { type: 'json' }
|
|
3950
3980
|
var package_default = {
|
|
3951
3981
|
name: "@zapier/zapier-sdk-cli",
|
|
3952
|
-
version: "0.52.
|
|
3982
|
+
version: "0.52.2"};
|
|
3953
3983
|
|
|
3954
3984
|
// src/sdk.ts
|
|
3955
3985
|
injectCliLogin(login_exports);
|
|
@@ -3977,7 +4007,7 @@ function createZapierCliSdk(options = {}) {
|
|
|
3977
4007
|
|
|
3978
4008
|
// package.json
|
|
3979
4009
|
var package_default2 = {
|
|
3980
|
-
version: "0.52.
|
|
4010
|
+
version: "0.52.2"};
|
|
3981
4011
|
|
|
3982
4012
|
// src/telemetry/builders.ts
|
|
3983
4013
|
function createCliBaseEvent(context = {}) {
|
package/dist/package.json
CHANGED
|
@@ -7,6 +7,7 @@ import { revokeCredentials } from "../../login/credentials-revoke";
|
|
|
7
7
|
import { runOauthFlow } from "../../utils/auth/oauth-flow";
|
|
8
8
|
import { EMPTY_POLICY, setupClientCredentials, } from "../../utils/auth/client-credentials";
|
|
9
9
|
import { resolveCredentialsBaseUrl } from "../auth/credentials-base-url";
|
|
10
|
+
import { ZapierCliValidationError } from "../../utils/errors";
|
|
10
11
|
import { LoginSchema } from "./schemas";
|
|
11
12
|
function toPkceCredentials(credentials) {
|
|
12
13
|
if (credentials &&
|
|
@@ -21,7 +22,10 @@ function toPkceCredentials(credentials) {
|
|
|
21
22
|
}
|
|
22
23
|
return undefined;
|
|
23
24
|
}
|
|
24
|
-
async function confirmRevokeAndRelogin(activeCredentials) {
|
|
25
|
+
async function confirmRevokeAndRelogin(activeCredentials, skipPrompts) {
|
|
26
|
+
if (skipPrompts) {
|
|
27
|
+
throw new ZapierCliValidationError(`Already logged in as "${activeCredentials.name}". Run \`logout\` first or use an interactive terminal to re-authenticate.`);
|
|
28
|
+
}
|
|
25
29
|
const { confirmed } = await inquirer.prompt([
|
|
26
30
|
{
|
|
27
31
|
type: "confirm",
|
|
@@ -38,7 +42,10 @@ async function confirmRevokeAndRelogin(activeCredentials) {
|
|
|
38
42
|
}
|
|
39
43
|
return true;
|
|
40
44
|
}
|
|
41
|
-
async function confirmJwtMigration() {
|
|
45
|
+
async function confirmJwtMigration(skipPrompts) {
|
|
46
|
+
if (skipPrompts) {
|
|
47
|
+
throw new ZapierCliValidationError("Legacy JWT login detected. Run `logout` first or use an interactive terminal to migrate to client credentials.");
|
|
48
|
+
}
|
|
42
49
|
const { confirmed } = await inquirer.prompt([
|
|
43
50
|
{
|
|
44
51
|
type: "confirm",
|
|
@@ -56,7 +63,10 @@ async function confirmJwtMigration() {
|
|
|
56
63
|
}
|
|
57
64
|
return true;
|
|
58
65
|
}
|
|
59
|
-
async function confirmLocalLoginReset() {
|
|
66
|
+
async function confirmLocalLoginReset(skipPrompts) {
|
|
67
|
+
if (skipPrompts) {
|
|
68
|
+
throw new ZapierCliValidationError("Login cleanup failed and cannot be reset without confirmation. Re-run with an interactive terminal.");
|
|
69
|
+
}
|
|
60
70
|
const { confirmed } = await inquirer.prompt([
|
|
61
71
|
{
|
|
62
72
|
type: "confirm",
|
|
@@ -78,13 +88,20 @@ function parseTimeoutSeconds(timeout) {
|
|
|
78
88
|
}
|
|
79
89
|
return timeoutSeconds;
|
|
80
90
|
}
|
|
81
|
-
async function promptCredentialsName(email, baseUrl) {
|
|
91
|
+
async function promptCredentialsName(email, skipPrompts, baseUrl) {
|
|
92
|
+
const fallback = `${email}@${hostname()}`;
|
|
93
|
+
if (skipPrompts) {
|
|
94
|
+
if (credentialsNameExists({ name: fallback, baseUrl })) {
|
|
95
|
+
throw new ZapierCliValidationError(`Credentials named "${fallback}" already exist. Run \`logout\` first or use an interactive terminal to choose a different name.`);
|
|
96
|
+
}
|
|
97
|
+
return fallback;
|
|
98
|
+
}
|
|
82
99
|
const { credentialName } = await inquirer.prompt([
|
|
83
100
|
{
|
|
84
101
|
type: "input",
|
|
85
102
|
name: "credentialName",
|
|
86
103
|
message: "Enter a name to identify them:",
|
|
87
|
-
default:
|
|
104
|
+
default: fallback,
|
|
88
105
|
validate: (input) => {
|
|
89
106
|
if (!input.trim())
|
|
90
107
|
return "Name cannot be empty";
|
|
@@ -126,6 +143,9 @@ export const loginPlugin = definePlugin((sdk) => createPluginMethod(sdk, {
|
|
|
126
143
|
supportsJsonOutput: false,
|
|
127
144
|
handler: async ({ sdk, options }) => {
|
|
128
145
|
const timeoutSeconds = parseTimeoutSeconds(options.timeout);
|
|
146
|
+
const skipPrompts = options.skipPrompts === true ||
|
|
147
|
+
!process.stdin.isTTY ||
|
|
148
|
+
!process.stdout.isTTY;
|
|
129
149
|
const resolvedCredentials = await sdk.context.resolveCredentials();
|
|
130
150
|
const pkceCredentials = toPkceCredentials(resolvedCredentials);
|
|
131
151
|
const credentialsBaseUrl = await resolveCredentialsBaseUrl({
|
|
@@ -136,7 +156,7 @@ export const loginPlugin = definePlugin((sdk) => createPluginMethod(sdk, {
|
|
|
136
156
|
baseUrl: credentialsBaseUrl,
|
|
137
157
|
});
|
|
138
158
|
if (activeCredentials) {
|
|
139
|
-
if (!(await confirmRevokeAndRelogin(activeCredentials)))
|
|
159
|
+
if (!(await confirmRevokeAndRelogin(activeCredentials, skipPrompts)))
|
|
140
160
|
return;
|
|
141
161
|
try {
|
|
142
162
|
await revokeCredentials({
|
|
@@ -145,7 +165,7 @@ export const loginPlugin = definePlugin((sdk) => createPluginMethod(sdk, {
|
|
|
145
165
|
});
|
|
146
166
|
}
|
|
147
167
|
catch {
|
|
148
|
-
if (!(await confirmLocalLoginReset()))
|
|
168
|
+
if (!(await confirmLocalLoginReset(skipPrompts)))
|
|
149
169
|
return;
|
|
150
170
|
await deleteStoredClientCredentials({
|
|
151
171
|
name: activeCredentials.name,
|
|
@@ -154,7 +174,7 @@ export const loginPlugin = definePlugin((sdk) => createPluginMethod(sdk, {
|
|
|
154
174
|
}
|
|
155
175
|
}
|
|
156
176
|
else if (hasLegacyJwtConfig()) {
|
|
157
|
-
if (!(await confirmJwtMigration()))
|
|
177
|
+
if (!(await confirmJwtMigration(skipPrompts)))
|
|
158
178
|
return;
|
|
159
179
|
}
|
|
160
180
|
const { accessToken } = await runOauthFlow({
|
|
@@ -169,7 +189,7 @@ export const loginPlugin = definePlugin((sdk) => createPluginMethod(sdk, {
|
|
|
169
189
|
const profile = await getProfile(scopedApi);
|
|
170
190
|
console.log(`👤 Logged in as ${profile.email}`);
|
|
171
191
|
console.log("\nGenerating credentials so this machine can make authenticated requests on your behalf.");
|
|
172
|
-
const credentialName = await promptCredentialsName(profile.email, credentialsBaseUrl);
|
|
192
|
+
const credentialName = await promptCredentialsName(profile.email, skipPrompts, credentialsBaseUrl);
|
|
173
193
|
const useApprovals = options.useApprovals === true;
|
|
174
194
|
await setupClientCredentials({
|
|
175
195
|
api: scopedApi,
|
|
@@ -2,5 +2,6 @@ import { z } from "zod";
|
|
|
2
2
|
export declare const LoginSchema: z.ZodObject<{
|
|
3
3
|
timeout: z.ZodOptional<z.ZodString>;
|
|
4
4
|
useApprovals: z.ZodOptional<z.ZodBoolean>;
|
|
5
|
+
skipPrompts: z.ZodOptional<z.ZodBoolean>;
|
|
5
6
|
}, z.core.$strip>;
|
|
6
7
|
export type LoginOptions = z.infer<typeof LoginSchema>;
|
|
@@ -10,5 +10,9 @@ export const LoginSchema = z
|
|
|
10
10
|
.boolean()
|
|
11
11
|
.optional()
|
|
12
12
|
.describe("Require approvals for actions performed with these credentials"),
|
|
13
|
+
skipPrompts: z
|
|
14
|
+
.boolean()
|
|
15
|
+
.optional()
|
|
16
|
+
.describe("Skip interactive prompts. Uses defaults where possible; errors instead of prompting when input is required. Useful in CI, piped output, or environments where TTY detection is unreliable."),
|
|
13
17
|
})
|
|
14
18
|
.describe("Log in to Zapier to access your account");
|