@zapier/zapier-sdk-cli 0.51.3 → 0.52.1

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 CHANGED
@@ -1,5 +1,23 @@
1
1
  # @zapier/zapier-sdk-cli
2
2
 
3
+ ## 0.52.1
4
+
5
+ ### Patch Changes
6
+
7
+ - c8655a4: Added non-interactive support to the `login` command. When running in a headless environment (no TTY — such as CI, piped scripts, or an MCP server), `login` now automatically uses `email@hostname` as the credential name instead of hanging on interactive prompts. If re-authentication or migration is required and a terminal is unavailable, the command now exits with a clear error pointing to `logout` or an interactive terminal.
8
+
9
+ ## 0.52.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 5457bdd: Added a `trash` option to `listTableRecords` and `listTableFields` for controlling soft-deleted item visibility. Accepts `"exclude"` (default, active items only), `"include"` (active and soft-deleted), or `"only"` (soft-deleted items only).
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies [5457bdd]
18
+ - @zapier/zapier-sdk@0.57.0
19
+ - @zapier/zapier-sdk-mcp@0.13.11
20
+
3
21
  ## 0.51.3
4
22
 
5
23
  ### Patch Changes
package/README.md CHANGED
@@ -698,15 +698,16 @@ List fields for a table
698
698
 
699
699
  **Options:**
700
700
 
701
- | Option | Type | Required | Default | Possible Values | Description |
702
- | ---------- | -------- | -------- | ------- | --------------- | ----------------------------------------------------------------------------------------- |
703
- | `<table>` | `string` | ✅ | — | — | The unique identifier of the table |
704
- | `--fields` | `array` | ❌ | — | — | Fields to operate on. Accepts field names (e.g., "Email") or IDs (e.g., "f6", "6", or 6). |
701
+ | Option | Type | Required | Default | Possible Values | Description |
702
+ | ---------- | -------- | -------- | ------- | ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
703
+ | `<table>` | `string` | ✅ | — | — | The unique identifier of the table |
704
+ | `--fields` | `array` | ❌ | — | — | Fields to operate on. Accepts field names (e.g., "Email") or IDs (e.g., "f6", "6", or 6). |
705
+ | `--trash` | `string` | ❌ | — | `exclude`, `include`, `only` | Control soft-deleted item visibility. "exclude" (default) returns active items only, "include" returns both active and soft-deleted, "only" returns soft-deleted items only. |
705
706
 
706
707
  **Usage:**
707
708
 
708
709
  ```bash
709
- npx zapier-sdk list-table-fields <table> [--fields]
710
+ npx zapier-sdk list-table-fields <table> [--fields] [--trash]
710
711
  ```
711
712
 
712
713
  #### `list-table-records`
@@ -715,22 +716,23 @@ List records in a table with optional filtering and sorting
715
716
 
716
717
  **Options:**
717
718
 
718
- | Option | Type | Required | Default | Possible Values | Description |
719
- | --------------- | -------- | -------- | --------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------- |
720
- | `<table>` | `string` | ✅ | — | — | The unique identifier of the table |
721
- | `--filters` | `array` | ❌ | — | — | Filter conditions for the query |
722
- | `--sort` | `object` | ❌ | — | — | Sort records by a field |
723
- | ​ ↳ `fieldKey` | `string` | ✅ | — | — | The field key to sort by |
724
- | ​ ↳ `direction` | `string` | ❌ | `"asc"` | — | Sort direction |
725
- | `--page-size` | `number` | ❌ | — | — | Number of records per page (max 1000) |
726
- | `--max-items` | `number` | ❌ | — | — | Maximum total items to return across all pages |
727
- | `--cursor` | `string` | ❌ | — | — | Cursor to start from |
728
- | `--key-mode` | `string` | ❌ | `"names"` | — | How to interpret field keys in record data. "names" (default) uses human-readable field names, "ids" uses raw field IDs (f1, f2). |
719
+ | Option | Type | Required | Default | Possible Values | Description |
720
+ | --------------- | -------- | -------- | --------- | ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
721
+ | `<table>` | `string` | ✅ | — | — | The unique identifier of the table |
722
+ | `--filters` | `array` | ❌ | — | — | Filter conditions for the query |
723
+ | `--sort` | `object` | ❌ | — | — | Sort records by a field |
724
+ | ​ ↳ `fieldKey` | `string` | ✅ | — | — | The field key to sort by |
725
+ | ​ ↳ `direction` | `string` | ❌ | `"asc"` | — | Sort direction |
726
+ | `--page-size` | `number` | ❌ | — | — | Number of records per page (max 1000) |
727
+ | `--max-items` | `number` | ❌ | — | — | Maximum total items to return across all pages |
728
+ | `--cursor` | `string` | ❌ | — | — | Cursor to start from |
729
+ | `--key-mode` | `string` | ❌ | `"names"` | — | How to interpret field keys in record data. "names" (default) uses human-readable field names, "ids" uses raw field IDs (f1, f2). |
730
+ | `--trash` | `string` | ❌ | — | `exclude`, `include`, `only` | Control soft-deleted item visibility. "exclude" (default) returns active items only, "include" returns both active and soft-deleted, "only" returns soft-deleted items only. |
729
731
 
730
732
  **Usage:**
731
733
 
732
734
  ```bash
733
- npx zapier-sdk list-table-records <table> [--filters] [--sort] [--page-size] [--max-items] [--cursor] [--key-mode]
735
+ npx zapier-sdk list-table-records <table> [--filters] [--sort] [--page-size] [--max-items] [--cursor] [--key-mode] [--trash]
734
736
  ```
735
737
 
736
738
  #### `list-tables`
package/dist/cli.cjs CHANGED
@@ -1572,7 +1572,7 @@ var SHARED_COMMAND_CLI_OPTIONS = [
1572
1572
 
1573
1573
  // package.json
1574
1574
  var package_default = {
1575
- version: "0.51.3"};
1575
+ version: "0.52.1"};
1576
1576
 
1577
1577
  // src/telemetry/builders.ts
1578
1578
  function createCliBaseEvent(context = {}) {
@@ -3900,6 +3900,11 @@ function toPkceCredentials(credentials2) {
3900
3900
  return void 0;
3901
3901
  }
3902
3902
  async function confirmRevokeAndRelogin(activeCredentials) {
3903
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
3904
+ throw new ZapierCliValidationError(
3905
+ `Already logged in as "${activeCredentials.name}". Run \`logout\` first or use an interactive terminal to re-authenticate.`
3906
+ );
3907
+ }
3903
3908
  const { confirmed } = await inquirer__default.default.prompt([
3904
3909
  {
3905
3910
  type: "confirm",
@@ -3917,6 +3922,11 @@ Log out and log in again?`,
3917
3922
  return true;
3918
3923
  }
3919
3924
  async function confirmJwtMigration() {
3925
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
3926
+ throw new ZapierCliValidationError(
3927
+ "Legacy JWT login detected. Run `logout` first or use an interactive terminal to migrate to client credentials."
3928
+ );
3929
+ }
3920
3930
  const { confirmed } = await inquirer__default.default.prompt([
3921
3931
  {
3922
3932
  type: "confirm",
@@ -3932,6 +3942,11 @@ async function confirmJwtMigration() {
3932
3942
  return true;
3933
3943
  }
3934
3944
  async function confirmLocalLoginReset() {
3945
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
3946
+ throw new ZapierCliValidationError(
3947
+ "Login cleanup failed and cannot be reset without confirmation. Re-run with an interactive terminal."
3948
+ );
3949
+ }
3935
3950
  const { confirmed } = await inquirer__default.default.prompt([
3936
3951
  {
3937
3952
  type: "confirm",
@@ -3954,12 +3969,21 @@ function parseTimeoutSeconds(timeout) {
3954
3969
  return timeoutSeconds;
3955
3970
  }
3956
3971
  async function promptCredentialsName(email, baseUrl2) {
3972
+ const fallback = `${email}@${os.hostname()}`;
3973
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
3974
+ if (credentialsNameExists({ name: fallback, baseUrl: baseUrl2 })) {
3975
+ throw new ZapierCliValidationError(
3976
+ `Credentials named "${fallback}" already exist. Run \`logout\` first or use an interactive terminal to choose a different name.`
3977
+ );
3978
+ }
3979
+ return fallback;
3980
+ }
3957
3981
  const { credentialName } = await inquirer__default.default.prompt([
3958
3982
  {
3959
3983
  type: "input",
3960
3984
  name: "credentialName",
3961
3985
  message: "Enter a name to identify them:",
3962
- default: `${email}@${os.hostname()}`,
3986
+ default: fallback,
3963
3987
  validate: (input) => {
3964
3988
  if (!input.trim()) return "Name cannot be empty";
3965
3989
  if (credentialsNameExists({ name: input.trim(), baseUrl: baseUrl2 })) {
@@ -6626,7 +6650,7 @@ var watchTriggerInboxCliPlugin = zapierSdk.definePlugin(
6626
6650
  // package.json with { type: 'json' }
6627
6651
  var package_default2 = {
6628
6652
  name: "@zapier/zapier-sdk-cli",
6629
- version: "0.51.3"};
6653
+ version: "0.52.1"};
6630
6654
 
6631
6655
  // src/sdk.ts
6632
6656
  zapierSdk.injectCliLogin(login_exports);
package/dist/cli.mjs CHANGED
@@ -1530,7 +1530,7 @@ var SHARED_COMMAND_CLI_OPTIONS = [
1530
1530
 
1531
1531
  // package.json
1532
1532
  var package_default = {
1533
- version: "0.51.3"};
1533
+ version: "0.52.1"};
1534
1534
 
1535
1535
  // src/telemetry/builders.ts
1536
1536
  function createCliBaseEvent(context = {}) {
@@ -3858,6 +3858,11 @@ function toPkceCredentials(credentials2) {
3858
3858
  return void 0;
3859
3859
  }
3860
3860
  async function confirmRevokeAndRelogin(activeCredentials) {
3861
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
3862
+ throw new ZapierCliValidationError(
3863
+ `Already logged in as "${activeCredentials.name}". Run \`logout\` first or use an interactive terminal to re-authenticate.`
3864
+ );
3865
+ }
3861
3866
  const { confirmed } = await inquirer.prompt([
3862
3867
  {
3863
3868
  type: "confirm",
@@ -3875,6 +3880,11 @@ Log out and log in again?`,
3875
3880
  return true;
3876
3881
  }
3877
3882
  async function confirmJwtMigration() {
3883
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
3884
+ throw new ZapierCliValidationError(
3885
+ "Legacy JWT login detected. Run `logout` first or use an interactive terminal to migrate to client credentials."
3886
+ );
3887
+ }
3878
3888
  const { confirmed } = await inquirer.prompt([
3879
3889
  {
3880
3890
  type: "confirm",
@@ -3890,6 +3900,11 @@ async function confirmJwtMigration() {
3890
3900
  return true;
3891
3901
  }
3892
3902
  async function confirmLocalLoginReset() {
3903
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
3904
+ throw new ZapierCliValidationError(
3905
+ "Login cleanup failed and cannot be reset without confirmation. Re-run with an interactive terminal."
3906
+ );
3907
+ }
3893
3908
  const { confirmed } = await inquirer.prompt([
3894
3909
  {
3895
3910
  type: "confirm",
@@ -3912,12 +3927,21 @@ function parseTimeoutSeconds(timeout) {
3912
3927
  return timeoutSeconds;
3913
3928
  }
3914
3929
  async function promptCredentialsName(email, baseUrl2) {
3930
+ const fallback = `${email}@${hostname()}`;
3931
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
3932
+ if (credentialsNameExists({ name: fallback, baseUrl: baseUrl2 })) {
3933
+ throw new ZapierCliValidationError(
3934
+ `Credentials named "${fallback}" already exist. Run \`logout\` first or use an interactive terminal to choose a different name.`
3935
+ );
3936
+ }
3937
+ return fallback;
3938
+ }
3915
3939
  const { credentialName } = await inquirer.prompt([
3916
3940
  {
3917
3941
  type: "input",
3918
3942
  name: "credentialName",
3919
3943
  message: "Enter a name to identify them:",
3920
- default: `${email}@${hostname()}`,
3944
+ default: fallback,
3921
3945
  validate: (input) => {
3922
3946
  if (!input.trim()) return "Name cannot be empty";
3923
3947
  if (credentialsNameExists({ name: input.trim(), baseUrl: baseUrl2 })) {
@@ -6584,7 +6608,7 @@ var watchTriggerInboxCliPlugin = definePlugin(
6584
6608
  // package.json with { type: 'json' }
6585
6609
  var package_default2 = {
6586
6610
  name: "@zapier/zapier-sdk-cli",
6587
- version: "0.51.3"};
6611
+ version: "0.52.1"};
6588
6612
 
6589
6613
  // src/sdk.ts
6590
6614
  injectCliLogin(login_exports);
@@ -1277,6 +1277,11 @@ function toPkceCredentials(credentials) {
1277
1277
  return void 0;
1278
1278
  }
1279
1279
  async function confirmRevokeAndRelogin(activeCredentials) {
1280
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
1281
+ throw new ZapierCliValidationError(
1282
+ `Already logged in as "${activeCredentials.name}". Run \`logout\` first or use an interactive terminal to re-authenticate.`
1283
+ );
1284
+ }
1280
1285
  const { confirmed } = await inquirer__default.default.prompt([
1281
1286
  {
1282
1287
  type: "confirm",
@@ -1294,6 +1299,11 @@ Log out and log in again?`,
1294
1299
  return true;
1295
1300
  }
1296
1301
  async function confirmJwtMigration() {
1302
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
1303
+ throw new ZapierCliValidationError(
1304
+ "Legacy JWT login detected. Run `logout` first or use an interactive terminal to migrate to client credentials."
1305
+ );
1306
+ }
1297
1307
  const { confirmed } = await inquirer__default.default.prompt([
1298
1308
  {
1299
1309
  type: "confirm",
@@ -1309,6 +1319,11 @@ async function confirmJwtMigration() {
1309
1319
  return true;
1310
1320
  }
1311
1321
  async function confirmLocalLoginReset() {
1322
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
1323
+ throw new ZapierCliValidationError(
1324
+ "Login cleanup failed and cannot be reset without confirmation. Re-run with an interactive terminal."
1325
+ );
1326
+ }
1312
1327
  const { confirmed } = await inquirer__default.default.prompt([
1313
1328
  {
1314
1329
  type: "confirm",
@@ -1331,12 +1346,21 @@ function parseTimeoutSeconds(timeout) {
1331
1346
  return timeoutSeconds;
1332
1347
  }
1333
1348
  async function promptCredentialsName(email, baseUrl) {
1349
+ const fallback = `${email}@${os.hostname()}`;
1350
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
1351
+ if (credentialsNameExists({ name: fallback, baseUrl })) {
1352
+ throw new ZapierCliValidationError(
1353
+ `Credentials named "${fallback}" already exist. Run \`logout\` first or use an interactive terminal to choose a different name.`
1354
+ );
1355
+ }
1356
+ return fallback;
1357
+ }
1334
1358
  const { credentialName } = await inquirer__default.default.prompt([
1335
1359
  {
1336
1360
  type: "input",
1337
1361
  name: "credentialName",
1338
1362
  message: "Enter a name to identify them:",
1339
- default: `${email}@${os.hostname()}`,
1363
+ default: fallback,
1340
1364
  validate: (input) => {
1341
1365
  if (!input.trim()) return "Name cannot be empty";
1342
1366
  if (credentialsNameExists({ name: input.trim(), baseUrl })) {
@@ -3986,7 +4010,7 @@ var watchTriggerInboxCliPlugin = zapierSdk.definePlugin(
3986
4010
  // package.json with { type: 'json' }
3987
4011
  var package_default = {
3988
4012
  name: "@zapier/zapier-sdk-cli",
3989
- version: "0.51.3"};
4013
+ version: "0.52.1"};
3990
4014
 
3991
4015
  // src/experimental.ts
3992
4016
  experimental.injectCliLogin(login_exports);
@@ -1241,6 +1241,11 @@ function toPkceCredentials(credentials) {
1241
1241
  return void 0;
1242
1242
  }
1243
1243
  async function confirmRevokeAndRelogin(activeCredentials) {
1244
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
1245
+ throw new ZapierCliValidationError(
1246
+ `Already logged in as "${activeCredentials.name}". Run \`logout\` first or use an interactive terminal to re-authenticate.`
1247
+ );
1248
+ }
1244
1249
  const { confirmed } = await inquirer.prompt([
1245
1250
  {
1246
1251
  type: "confirm",
@@ -1258,6 +1263,11 @@ Log out and log in again?`,
1258
1263
  return true;
1259
1264
  }
1260
1265
  async function confirmJwtMigration() {
1266
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
1267
+ throw new ZapierCliValidationError(
1268
+ "Legacy JWT login detected. Run `logout` first or use an interactive terminal to migrate to client credentials."
1269
+ );
1270
+ }
1261
1271
  const { confirmed } = await inquirer.prompt([
1262
1272
  {
1263
1273
  type: "confirm",
@@ -1273,6 +1283,11 @@ async function confirmJwtMigration() {
1273
1283
  return true;
1274
1284
  }
1275
1285
  async function confirmLocalLoginReset() {
1286
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
1287
+ throw new ZapierCliValidationError(
1288
+ "Login cleanup failed and cannot be reset without confirmation. Re-run with an interactive terminal."
1289
+ );
1290
+ }
1276
1291
  const { confirmed } = await inquirer.prompt([
1277
1292
  {
1278
1293
  type: "confirm",
@@ -1295,12 +1310,21 @@ function parseTimeoutSeconds(timeout) {
1295
1310
  return timeoutSeconds;
1296
1311
  }
1297
1312
  async function promptCredentialsName(email, baseUrl) {
1313
+ const fallback = `${email}@${hostname()}`;
1314
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
1315
+ if (credentialsNameExists({ name: fallback, baseUrl })) {
1316
+ throw new ZapierCliValidationError(
1317
+ `Credentials named "${fallback}" already exist. Run \`logout\` first or use an interactive terminal to choose a different name.`
1318
+ );
1319
+ }
1320
+ return fallback;
1321
+ }
1298
1322
  const { credentialName } = await inquirer.prompt([
1299
1323
  {
1300
1324
  type: "input",
1301
1325
  name: "credentialName",
1302
1326
  message: "Enter a name to identify them:",
1303
- default: `${email}@${hostname()}`,
1327
+ default: fallback,
1304
1328
  validate: (input) => {
1305
1329
  if (!input.trim()) return "Name cannot be empty";
1306
1330
  if (credentialsNameExists({ name: input.trim(), baseUrl })) {
@@ -3950,7 +3974,7 @@ var watchTriggerInboxCliPlugin = definePlugin(
3950
3974
  // package.json with { type: 'json' }
3951
3975
  var package_default = {
3952
3976
  name: "@zapier/zapier-sdk-cli",
3953
- version: "0.51.3"};
3977
+ version: "0.52.1"};
3954
3978
 
3955
3979
  // src/experimental.ts
3956
3980
  injectCliLogin(login_exports);
package/dist/index.cjs CHANGED
@@ -1276,6 +1276,11 @@ function toPkceCredentials(credentials) {
1276
1276
  return void 0;
1277
1277
  }
1278
1278
  async function confirmRevokeAndRelogin(activeCredentials) {
1279
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
1280
+ throw new ZapierCliValidationError(
1281
+ `Already logged in as "${activeCredentials.name}". Run \`logout\` first or use an interactive terminal to re-authenticate.`
1282
+ );
1283
+ }
1279
1284
  const { confirmed } = await inquirer__default.default.prompt([
1280
1285
  {
1281
1286
  type: "confirm",
@@ -1293,6 +1298,11 @@ Log out and log in again?`,
1293
1298
  return true;
1294
1299
  }
1295
1300
  async function confirmJwtMigration() {
1301
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
1302
+ throw new ZapierCliValidationError(
1303
+ "Legacy JWT login detected. Run `logout` first or use an interactive terminal to migrate to client credentials."
1304
+ );
1305
+ }
1296
1306
  const { confirmed } = await inquirer__default.default.prompt([
1297
1307
  {
1298
1308
  type: "confirm",
@@ -1308,6 +1318,11 @@ async function confirmJwtMigration() {
1308
1318
  return true;
1309
1319
  }
1310
1320
  async function confirmLocalLoginReset() {
1321
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
1322
+ throw new ZapierCliValidationError(
1323
+ "Login cleanup failed and cannot be reset without confirmation. Re-run with an interactive terminal."
1324
+ );
1325
+ }
1311
1326
  const { confirmed } = await inquirer__default.default.prompt([
1312
1327
  {
1313
1328
  type: "confirm",
@@ -1330,12 +1345,21 @@ function parseTimeoutSeconds(timeout) {
1330
1345
  return timeoutSeconds;
1331
1346
  }
1332
1347
  async function promptCredentialsName(email, baseUrl) {
1348
+ const fallback = `${email}@${os.hostname()}`;
1349
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
1350
+ if (credentialsNameExists({ name: fallback, baseUrl })) {
1351
+ throw new ZapierCliValidationError(
1352
+ `Credentials named "${fallback}" already exist. Run \`logout\` first or use an interactive terminal to choose a different name.`
1353
+ );
1354
+ }
1355
+ return fallback;
1356
+ }
1333
1357
  const { credentialName } = await inquirer__default.default.prompt([
1334
1358
  {
1335
1359
  type: "input",
1336
1360
  name: "credentialName",
1337
1361
  message: "Enter a name to identify them:",
1338
- default: `${email}@${os.hostname()}`,
1362
+ default: fallback,
1339
1363
  validate: (input) => {
1340
1364
  if (!input.trim()) return "Name cannot be empty";
1341
1365
  if (credentialsNameExists({ name: input.trim(), baseUrl })) {
@@ -3985,7 +4009,7 @@ zapierSdk.definePlugin(
3985
4009
  // package.json with { type: 'json' }
3986
4010
  var package_default = {
3987
4011
  name: "@zapier/zapier-sdk-cli",
3988
- version: "0.51.3"};
4012
+ version: "0.52.1"};
3989
4013
 
3990
4014
  // src/sdk.ts
3991
4015
  zapierSdk.injectCliLogin(login_exports);
@@ -4013,7 +4037,7 @@ function createZapierCliSdk(options = {}) {
4013
4037
 
4014
4038
  // package.json
4015
4039
  var package_default2 = {
4016
- version: "0.51.3"};
4040
+ version: "0.52.1"};
4017
4041
 
4018
4042
  // src/telemetry/builders.ts
4019
4043
  function createCliBaseEvent(context = {}) {
package/dist/index.mjs CHANGED
@@ -1240,6 +1240,11 @@ function toPkceCredentials(credentials) {
1240
1240
  return void 0;
1241
1241
  }
1242
1242
  async function confirmRevokeAndRelogin(activeCredentials) {
1243
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
1244
+ throw new ZapierCliValidationError(
1245
+ `Already logged in as "${activeCredentials.name}". Run \`logout\` first or use an interactive terminal to re-authenticate.`
1246
+ );
1247
+ }
1243
1248
  const { confirmed } = await inquirer.prompt([
1244
1249
  {
1245
1250
  type: "confirm",
@@ -1257,6 +1262,11 @@ Log out and log in again?`,
1257
1262
  return true;
1258
1263
  }
1259
1264
  async function confirmJwtMigration() {
1265
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
1266
+ throw new ZapierCliValidationError(
1267
+ "Legacy JWT login detected. Run `logout` first or use an interactive terminal to migrate to client credentials."
1268
+ );
1269
+ }
1260
1270
  const { confirmed } = await inquirer.prompt([
1261
1271
  {
1262
1272
  type: "confirm",
@@ -1272,6 +1282,11 @@ async function confirmJwtMigration() {
1272
1282
  return true;
1273
1283
  }
1274
1284
  async function confirmLocalLoginReset() {
1285
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
1286
+ throw new ZapierCliValidationError(
1287
+ "Login cleanup failed and cannot be reset without confirmation. Re-run with an interactive terminal."
1288
+ );
1289
+ }
1275
1290
  const { confirmed } = await inquirer.prompt([
1276
1291
  {
1277
1292
  type: "confirm",
@@ -1294,12 +1309,21 @@ function parseTimeoutSeconds(timeout) {
1294
1309
  return timeoutSeconds;
1295
1310
  }
1296
1311
  async function promptCredentialsName(email, baseUrl) {
1312
+ const fallback = `${email}@${hostname()}`;
1313
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
1314
+ if (credentialsNameExists({ name: fallback, baseUrl })) {
1315
+ throw new ZapierCliValidationError(
1316
+ `Credentials named "${fallback}" already exist. Run \`logout\` first or use an interactive terminal to choose a different name.`
1317
+ );
1318
+ }
1319
+ return fallback;
1320
+ }
1297
1321
  const { credentialName } = await inquirer.prompt([
1298
1322
  {
1299
1323
  type: "input",
1300
1324
  name: "credentialName",
1301
1325
  message: "Enter a name to identify them:",
1302
- default: `${email}@${hostname()}`,
1326
+ default: fallback,
1303
1327
  validate: (input) => {
1304
1328
  if (!input.trim()) return "Name cannot be empty";
1305
1329
  if (credentialsNameExists({ name: input.trim(), baseUrl })) {
@@ -3949,7 +3973,7 @@ definePlugin(
3949
3973
  // package.json with { type: 'json' }
3950
3974
  var package_default = {
3951
3975
  name: "@zapier/zapier-sdk-cli",
3952
- version: "0.51.3"};
3976
+ version: "0.52.1"};
3953
3977
 
3954
3978
  // src/sdk.ts
3955
3979
  injectCliLogin(login_exports);
@@ -3977,7 +4001,7 @@ function createZapierCliSdk(options = {}) {
3977
4001
 
3978
4002
  // package.json
3979
4003
  var package_default2 = {
3980
- version: "0.51.3"};
4004
+ version: "0.52.1"};
3981
4005
 
3982
4006
  // src/telemetry/builders.ts
3983
4007
  function createCliBaseEvent(context = {}) {
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zapier/zapier-sdk-cli",
3
- "version": "0.51.3",
3
+ "version": "0.52.1",
4
4
  "description": "Command line interface for Zapier SDK",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
@@ -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 &&
@@ -22,6 +23,9 @@ function toPkceCredentials(credentials) {
22
23
  return undefined;
23
24
  }
24
25
  async function confirmRevokeAndRelogin(activeCredentials) {
26
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
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",
@@ -39,6 +43,9 @@ async function confirmRevokeAndRelogin(activeCredentials) {
39
43
  return true;
40
44
  }
41
45
  async function confirmJwtMigration() {
46
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
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",
@@ -57,6 +64,9 @@ async function confirmJwtMigration() {
57
64
  return true;
58
65
  }
59
66
  async function confirmLocalLoginReset() {
67
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
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",
@@ -79,12 +89,19 @@ function parseTimeoutSeconds(timeout) {
79
89
  return timeoutSeconds;
80
90
  }
81
91
  async function promptCredentialsName(email, baseUrl) {
92
+ const fallback = `${email}@${hostname()}`;
93
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
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: `${email}@${hostname()}`,
104
+ default: fallback,
88
105
  validate: (input) => {
89
106
  if (!input.trim())
90
107
  return "Name cannot be empty";