@zapier/zapier-sdk-cli 0.52.4 → 0.52.6
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 +29 -0
- package/README.md +141 -12
- package/dist/cli.cjs +56 -59
- package/dist/cli.mjs +56 -59
- package/dist/experimental.cjs +55 -58
- package/dist/experimental.mjs +55 -58
- package/dist/index.cjs +56 -59
- package/dist/index.mjs +56 -59
- package/dist/package.json +1 -1
- package/dist/src/login/credentials-revoke.js +13 -6
- package/dist/src/login/credentials-store.d.ts +0 -4
- package/dist/src/login/credentials-store.js +0 -3
- package/dist/src/plugins/init/display.js +2 -2
- package/dist/src/plugins/init/index.d.ts +1 -0
- package/dist/src/plugins/init/index.js +4 -2
- package/dist/src/plugins/init/schemas.d.ts +1 -0
- package/dist/src/plugins/init/schemas.js +6 -1
- package/dist/src/plugins/init/steps.d.ts +2 -2
- package/dist/src/plugins/init/steps.js +3 -3
- package/dist/src/plugins/init/types.d.ts +1 -1
- package/dist/src/plugins/init/utils.d.ts +2 -2
- package/dist/src/plugins/init/utils.js +2 -2
- package/dist/src/plugins/login/index.d.ts +1 -0
- package/dist/src/plugins/login/index.js +15 -22
- package/dist/src/plugins/login/schemas.d.ts +1 -0
- package/dist/src/plugins/login/schemas.js +6 -1
- package/dist/src/plugins/logout/index.js +0 -15
- package/dist/src/plugins/logout/schemas.d.ts +0 -1
- package/dist/src/plugins/logout/schemas.js +0 -1
- package/dist/src/utils/non-interactive.d.ts +13 -0
- package/dist/src/utils/non-interactive.js +14 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# @zapier/zapier-sdk-cli
|
|
2
2
|
|
|
3
|
+
## 0.52.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 104daa3: Fix login/logout reliability bugs.
|
|
8
|
+
|
|
9
|
+
**Bug fixes:**
|
|
10
|
+
- `logout` now warns and still clears local keychain/registry state when the server returns 401 during revocation (404 is still silently swallowed; 401 is surfaced as a console warning so users know to verify or revoke the credential manually if needed)
|
|
11
|
+
- Re-login no longer fails with "already exists" when a locally-orphaned registry entry has the same name as the desired new credential
|
|
12
|
+
- `logout` no longer prompts for confirmation before deleting credentials; it always proceeds immediately, which also fixes hangs in non-TTY/CI environments
|
|
13
|
+
|
|
14
|
+
**Deprecations:**
|
|
15
|
+
- `--skip-prompts` on `login` and `init` is deprecated in favour of `--non-interactive`. The old flag continues to work with a deprecation warning.
|
|
16
|
+
|
|
17
|
+
- 4827ffe: Add the workflow-write experimental code-substrate plugins: `createWorkflow`, `updateWorkflow`, `enableWorkflow`, `disableWorkflow`, `deleteWorkflow`. All five are registered only in `@zapier/zapier-sdk/experimental`; the stable subpath does not expose them. The four ID-based ops (update, enable, disable, delete) reuse `workflowIdResolver` so callers get an interactive picker via `sdk.listWorkflows()`. `deleteWorkflow` is marked `confirm: "delete"` for an explicit confirmation prompt before the destructive call. Input field naming follows the in-tree convention (`workflow` rather than the fork's `workflowId`, matching `tableIdResolver`'s shape) and is validated as a UUID at the input boundary so non-UUID strings fail with a clear schema error instead of an opaque 500 from the backend's `::uuid` cast. Response shapes match what the durableworkflowzaps handlers actually emit — no fabricated `is_private` / `created_by_user_id` / `triggers` fields. Handlers pass API responses through verbatim (no client-side `.parse()` re-emission) so callers see any richer fields the server adds later without an SDK release.
|
|
18
|
+
- Updated dependencies [104daa3]
|
|
19
|
+
- Updated dependencies [4827ffe]
|
|
20
|
+
- @zapier/zapier-sdk@0.61.0
|
|
21
|
+
- @zapier/zapier-sdk-mcp@0.13.15
|
|
22
|
+
|
|
23
|
+
## 0.52.5
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- f12598a: Add the workflow-read experimental plugins: `listWorkflows` and `getWorkflow`. Both are registered only in `@zapier/zapier-sdk/experimental`; the stable subpath does not expose them. `listWorkflows` uses `createPaginatedPluginMethod` (page-iterator + `pageSize`/`cursor`/`maxItems` options) so callers can iterate via `for await (const page of sdk.listWorkflows())` or `toIterable(sdk.listWorkflows())`. The backend does not paginate today; the SDK treats a missing `next_cursor` as the last page, so server-side pagination drops in without an SDK API change. Introduces `packages/zapier-sdk/src/plugins/codeSubstrate/shared.ts` with `codeSubstrateDefaults` (`{ categories: ["code-workflow"], experimental: true }`) that subsequent code-workflow plugins spread into their `createPluginMethod` configs. Also adds `workflowIdResolver` in `src/resolvers/workflowId.ts` (mirrors `tableIdResolver` / `triggerInboxResolver`) so commands that take a workflow id present an interactive picker via `sdk.listWorkflows()` in the CLI. Workflow-write commands (`createWorkflow`, `updateWorkflow`, `enable/disable/deleteWorkflow`) land in a follow-up MR.
|
|
28
|
+
- Updated dependencies [f12598a]
|
|
29
|
+
- @zapier/zapier-sdk@0.60.0
|
|
30
|
+
- @zapier/zapier-sdk-mcp@0.13.14
|
|
31
|
+
|
|
3
32
|
## 0.52.4
|
|
4
33
|
|
|
5
34
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -25,6 +25,14 @@
|
|
|
25
25
|
- [`create-client-credentials`](#create-client-credentials)
|
|
26
26
|
- [`delete-client-credentials`](#delete-client-credentials)
|
|
27
27
|
- [`list-client-credentials`](#list-client-credentials)
|
|
28
|
+
- [Code Workflows (Experimental)](#code-workflows-experimental)
|
|
29
|
+
- [`create-workflow`](#create-workflow--experimental)
|
|
30
|
+
- [`delete-workflow`](#delete-workflow--experimental)
|
|
31
|
+
- [`disable-workflow`](#disable-workflow--experimental)
|
|
32
|
+
- [`enable-workflow`](#enable-workflow--experimental)
|
|
33
|
+
- [`get-workflow`](#get-workflow--experimental)
|
|
34
|
+
- [`list-workflows`](#list-workflows--experimental)
|
|
35
|
+
- [`update-workflow`](#update-workflow--experimental)
|
|
28
36
|
- [Connections](#connections)
|
|
29
37
|
- [`find-first-connection`](#find-first-connection)
|
|
30
38
|
- [`find-unique-connection`](#find-unique-connection)
|
|
@@ -84,7 +92,7 @@ Bootstrap a new project with everything you need to start integrating thousands
|
|
|
84
92
|
npx @zapier/zapier-sdk-cli init my-zapier-app
|
|
85
93
|
|
|
86
94
|
# Or skip the interactive prompts and accept all defaults.
|
|
87
|
-
npx @zapier/zapier-sdk-cli init my-zapier-app --
|
|
95
|
+
npx @zapier/zapier-sdk-cli init my-zapier-app --non-interactive
|
|
88
96
|
```
|
|
89
97
|
|
|
90
98
|
## Installation
|
|
@@ -178,16 +186,16 @@ Log in to Zapier to access your account
|
|
|
178
186
|
|
|
179
187
|
**Options:**
|
|
180
188
|
|
|
181
|
-
| Option
|
|
182
|
-
|
|
|
183
|
-
| `--timeout`
|
|
184
|
-
| `--use-approvals`
|
|
185
|
-
| `--
|
|
189
|
+
| Option | Type | Required | Default | Possible Values | Description |
|
|
190
|
+
| ------------------- | --------- | -------- | ------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
191
|
+
| `--timeout` | `string` | ❌ | — | — | Login timeout in seconds (default: 300) |
|
|
192
|
+
| `--use-approvals` | `boolean` | ❌ | — | — | Require approvals for actions performed with these credentials |
|
|
193
|
+
| `--non-interactive` | `boolean` | ❌ | — | — | 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. |
|
|
186
194
|
|
|
187
195
|
**Usage:**
|
|
188
196
|
|
|
189
197
|
```bash
|
|
190
|
-
npx zapier-sdk login [--timeout] [--use-approvals] [--
|
|
198
|
+
npx zapier-sdk login [--timeout] [--use-approvals] [--non-interactive]
|
|
191
199
|
```
|
|
192
200
|
|
|
193
201
|
#### `logout`
|
|
@@ -423,6 +431,127 @@ List client credentials for the authenticated user
|
|
|
423
431
|
npx zapier-sdk list-client-credentials [--page-size] [--max-items] [--cursor]
|
|
424
432
|
```
|
|
425
433
|
|
|
434
|
+
### Code Workflows (Experimental)
|
|
435
|
+
|
|
436
|
+
> ℹ️ **Experimental.** Run commands via the `zapier-sdk-experimental` binary, pass `--experimental` to `zapier-sdk`, or set `ZAPIER_EXPERIMENTAL=true` in the environment. Flags and behavior may change between versions.
|
|
437
|
+
|
|
438
|
+
#### `create-workflow` 🧪 _experimental_
|
|
439
|
+
|
|
440
|
+
Create a durable workflow container. Starts disabled with no version; publish a version to add code.
|
|
441
|
+
|
|
442
|
+
**Options:**
|
|
443
|
+
|
|
444
|
+
| Option | Type | Required | Default | Possible Values | Description |
|
|
445
|
+
| --------------- | -------- | -------- | ------- | --------------- | ------------------------------------- |
|
|
446
|
+
| `<name>` | `string` | ✅ | — | — | Workflow name |
|
|
447
|
+
| `--description` | `string` | ❌ | — | — | Optional description for the workflow |
|
|
448
|
+
|
|
449
|
+
**Usage:**
|
|
450
|
+
|
|
451
|
+
```bash
|
|
452
|
+
npx zapier-sdk create-workflow <name> [--description]
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
#### `delete-workflow` 🧪 _experimental_
|
|
456
|
+
|
|
457
|
+
Delete a durable workflow. Throws `ZapierNotFoundError` if the workflow doesn't exist; callers wanting idempotency should catch that themselves.
|
|
458
|
+
|
|
459
|
+
**Options:**
|
|
460
|
+
|
|
461
|
+
| Option | Type | Required | Default | Possible Values | Description |
|
|
462
|
+
| ------------ | -------- | -------- | ------- | --------------- | ------------------- |
|
|
463
|
+
| `<workflow>` | `string` | ✅ | — | — | Durable workflow ID |
|
|
464
|
+
|
|
465
|
+
**Usage:**
|
|
466
|
+
|
|
467
|
+
```bash
|
|
468
|
+
npx zapier-sdk delete-workflow <workflow>
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
#### `disable-workflow` 🧪 _experimental_
|
|
472
|
+
|
|
473
|
+
Disable a durable workflow so it stops accepting triggers
|
|
474
|
+
|
|
475
|
+
**Options:**
|
|
476
|
+
|
|
477
|
+
| Option | Type | Required | Default | Possible Values | Description |
|
|
478
|
+
| ------------ | -------- | -------- | ------- | --------------- | ------------------- |
|
|
479
|
+
| `<workflow>` | `string` | ✅ | — | — | Durable workflow ID |
|
|
480
|
+
|
|
481
|
+
**Usage:**
|
|
482
|
+
|
|
483
|
+
```bash
|
|
484
|
+
npx zapier-sdk disable-workflow <workflow>
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
#### `enable-workflow` 🧪 _experimental_
|
|
488
|
+
|
|
489
|
+
Enable a durable workflow so it accepts triggers
|
|
490
|
+
|
|
491
|
+
**Options:**
|
|
492
|
+
|
|
493
|
+
| Option | Type | Required | Default | Possible Values | Description |
|
|
494
|
+
| ------------ | -------- | -------- | ------- | --------------- | ------------------- |
|
|
495
|
+
| `<workflow>` | `string` | ✅ | — | — | Durable workflow ID |
|
|
496
|
+
|
|
497
|
+
**Usage:**
|
|
498
|
+
|
|
499
|
+
```bash
|
|
500
|
+
npx zapier-sdk enable-workflow <workflow>
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
#### `get-workflow` 🧪 _experimental_
|
|
504
|
+
|
|
505
|
+
Get a durable workflow with its current version details and trigger claim status
|
|
506
|
+
|
|
507
|
+
**Options:**
|
|
508
|
+
|
|
509
|
+
| Option | Type | Required | Default | Possible Values | Description |
|
|
510
|
+
| ------------ | -------- | -------- | ------- | --------------- | ------------------- |
|
|
511
|
+
| `<workflow>` | `string` | ✅ | — | — | Durable workflow ID |
|
|
512
|
+
|
|
513
|
+
**Usage:**
|
|
514
|
+
|
|
515
|
+
```bash
|
|
516
|
+
npx zapier-sdk get-workflow <workflow>
|
|
517
|
+
```
|
|
518
|
+
|
|
519
|
+
#### `list-workflows` 🧪 _experimental_
|
|
520
|
+
|
|
521
|
+
List all active durable workflows for the authenticated account
|
|
522
|
+
|
|
523
|
+
**Options:**
|
|
524
|
+
|
|
525
|
+
| Option | Type | Required | Default | Possible Values | Description |
|
|
526
|
+
| ------------- | -------- | -------- | ------- | --------------- | -------------------------------------------------------------------------------------------- |
|
|
527
|
+
| `--page-size` | `number` | ❌ | — | — | Number of workflows per page (server-side pagination forthcoming; ignored until then) |
|
|
528
|
+
| `--max-items` | `number` | ❌ | — | — | Maximum total workflows to return across all pages |
|
|
529
|
+
| `--cursor` | `string` | ❌ | — | — | Cursor to start from for pagination (server-side pagination forthcoming; ignored until then) |
|
|
530
|
+
|
|
531
|
+
**Usage:**
|
|
532
|
+
|
|
533
|
+
```bash
|
|
534
|
+
npx zapier-sdk list-workflows [--page-size] [--max-items] [--cursor]
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
#### `update-workflow` 🧪 _experimental_
|
|
538
|
+
|
|
539
|
+
Update a durable workflow's name and/or description
|
|
540
|
+
|
|
541
|
+
**Options:**
|
|
542
|
+
|
|
543
|
+
| Option | Type | Required | Default | Possible Values | Description |
|
|
544
|
+
| --------------- | -------- | -------- | ------- | --------------- | ----------------------------------------------------- |
|
|
545
|
+
| `<workflow>` | `string` | ✅ | — | — | Durable workflow ID |
|
|
546
|
+
| `--name` | `string` | ❌ | — | — | New name for the workflow |
|
|
547
|
+
| `--description` | `string` | ❌ | — | — | New description for the workflow (pass null to clear) |
|
|
548
|
+
|
|
549
|
+
**Usage:**
|
|
550
|
+
|
|
551
|
+
```bash
|
|
552
|
+
npx zapier-sdk update-workflow <workflow> [--name] [--description]
|
|
553
|
+
```
|
|
554
|
+
|
|
426
555
|
### Connections
|
|
427
556
|
|
|
428
557
|
#### `find-first-connection`
|
|
@@ -1221,15 +1350,15 @@ Create a new Zapier SDK project in a new directory with starter files
|
|
|
1221
1350
|
|
|
1222
1351
|
**Options:**
|
|
1223
1352
|
|
|
1224
|
-
| Option
|
|
1225
|
-
|
|
|
1226
|
-
| `<project-name>`
|
|
1227
|
-
| `--
|
|
1353
|
+
| Option | Type | Required | Default | Possible Values | Description |
|
|
1354
|
+
| ------------------- | --------- | -------- | ------- | --------------- | ---------------------------------------------------- |
|
|
1355
|
+
| `<project-name>` | `string` | ✅ | — | — | Name of the project directory to create |
|
|
1356
|
+
| `--non-interactive` | `boolean` | ❌ | — | — | Skip all interactive prompts and accept all defaults |
|
|
1228
1357
|
|
|
1229
1358
|
**Usage:**
|
|
1230
1359
|
|
|
1231
1360
|
```bash
|
|
1232
|
-
npx zapier-sdk init <project-name> [--
|
|
1361
|
+
npx zapier-sdk init <project-name> [--non-interactive]
|
|
1233
1362
|
```
|
|
1234
1363
|
|
|
1235
1364
|
#### `mcp`
|
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.52.
|
|
1575
|
+
version: "0.52.6"};
|
|
1576
1576
|
|
|
1577
1577
|
// src/telemetry/builders.ts
|
|
1578
1578
|
function createCliBaseEvent(context = {}) {
|
|
@@ -3062,12 +3062,6 @@ async function storeClientCredentials({
|
|
|
3062
3062
|
await deleteKeychainSecret(existingEntry);
|
|
3063
3063
|
}
|
|
3064
3064
|
}
|
|
3065
|
-
function credentialsNameExists({
|
|
3066
|
-
name,
|
|
3067
|
-
baseUrl: baseUrl2
|
|
3068
|
-
}) {
|
|
3069
|
-
return !!findEntry(readRegistry(), name, normalizeBaseUrl(baseUrl2));
|
|
3070
|
-
}
|
|
3071
3065
|
async function getStoredClientCredentials(options) {
|
|
3072
3066
|
const entry = options?.name ? findEntry(readRegistry(), options.name, normalizeBaseUrl(options.baseUrl)) : getActiveCredentials(options);
|
|
3073
3067
|
if (!entry) return void 0;
|
|
@@ -3503,8 +3497,11 @@ function emitAuthLogout(onEvent) {
|
|
|
3503
3497
|
timestamp: Date.now()
|
|
3504
3498
|
});
|
|
3505
3499
|
}
|
|
3506
|
-
function
|
|
3507
|
-
|
|
3500
|
+
function getStatusCode(err) {
|
|
3501
|
+
if (typeof err === "object" && err !== null && "statusCode" in err) {
|
|
3502
|
+
return err.statusCode;
|
|
3503
|
+
}
|
|
3504
|
+
return void 0;
|
|
3508
3505
|
}
|
|
3509
3506
|
async function revokeCredentials({
|
|
3510
3507
|
api: api2,
|
|
@@ -3520,7 +3517,14 @@ async function revokeCredentials({
|
|
|
3520
3517
|
{ authRequired: true, requiredScopes: ["credentials"] }
|
|
3521
3518
|
);
|
|
3522
3519
|
} catch (err) {
|
|
3523
|
-
|
|
3520
|
+
const status = getStatusCode(err);
|
|
3521
|
+
if (status === 404) return;
|
|
3522
|
+
if (status === 401) {
|
|
3523
|
+
console.warn(
|
|
3524
|
+
"Could not revoke credentials on the server (unauthorized). Local state will be cleared, but the credential may still be active. Verify or revoke via `list-client-credentials` or `delete-client-credentials`."
|
|
3525
|
+
);
|
|
3526
|
+
return;
|
|
3527
|
+
}
|
|
3524
3528
|
throw err;
|
|
3525
3529
|
}
|
|
3526
3530
|
}
|
|
@@ -3880,14 +3884,24 @@ async function resolveCredentialsBaseUrl(context) {
|
|
|
3880
3884
|
const resolvedCredentials = "resolvedCredentials" in context ? context.resolvedCredentials : await context.resolveCredentials?.();
|
|
3881
3885
|
return getBaseUrlFromResolvedCredentials(resolvedCredentials) ?? getBaseUrlFromOptionsCredentials(context.options?.credentials) ?? context.options?.baseUrl;
|
|
3882
3886
|
}
|
|
3887
|
+
|
|
3888
|
+
// src/utils/non-interactive.ts
|
|
3889
|
+
function resolveNonInteractive(options) {
|
|
3890
|
+
return (options.nonInteractive ?? options.skipPrompts) === true || !process.stdin.isTTY || !process.stdout.isTTY;
|
|
3891
|
+
}
|
|
3883
3892
|
var LoginSchema = zod.z.object({
|
|
3884
3893
|
timeout: zod.z.string().optional().describe("Login timeout in seconds (default: 300)"),
|
|
3885
3894
|
useApprovals: zod.z.boolean().optional().describe(
|
|
3886
3895
|
"Require approvals for actions performed with these credentials"
|
|
3887
3896
|
),
|
|
3888
|
-
|
|
3897
|
+
nonInteractive: zod.z.boolean().optional().describe(
|
|
3889
3898
|
"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."
|
|
3890
|
-
)
|
|
3899
|
+
),
|
|
3900
|
+
/** @deprecated Use `nonInteractive` instead. */
|
|
3901
|
+
skipPrompts: zod.z.boolean().optional().meta({
|
|
3902
|
+
deprecated: true,
|
|
3903
|
+
deprecationMessage: "Use --non-interactive instead."
|
|
3904
|
+
})
|
|
3891
3905
|
}).describe("Log in to Zapier to access your account");
|
|
3892
3906
|
|
|
3893
3907
|
// src/plugins/login/index.ts
|
|
@@ -3902,8 +3916,8 @@ function toPkceCredentials(credentials2) {
|
|
|
3902
3916
|
}
|
|
3903
3917
|
return void 0;
|
|
3904
3918
|
}
|
|
3905
|
-
async function confirmRevokeAndRelogin(activeCredentials,
|
|
3906
|
-
if (
|
|
3919
|
+
async function confirmRevokeAndRelogin(activeCredentials, nonInteractive) {
|
|
3920
|
+
if (nonInteractive) {
|
|
3907
3921
|
throw new ZapierCliValidationError(
|
|
3908
3922
|
`Already logged in as "${activeCredentials.name}". Run \`logout\` first or use an interactive terminal to re-authenticate.`
|
|
3909
3923
|
);
|
|
@@ -3924,8 +3938,8 @@ Log out and log in again?`,
|
|
|
3924
3938
|
}
|
|
3925
3939
|
return true;
|
|
3926
3940
|
}
|
|
3927
|
-
async function confirmJwtMigration(
|
|
3928
|
-
if (
|
|
3941
|
+
async function confirmJwtMigration(nonInteractive) {
|
|
3942
|
+
if (nonInteractive) {
|
|
3929
3943
|
throw new ZapierCliValidationError(
|
|
3930
3944
|
"Legacy JWT login detected. Run `logout` first or use an interactive terminal to migrate to client credentials."
|
|
3931
3945
|
);
|
|
@@ -3944,8 +3958,8 @@ async function confirmJwtMigration(skipPrompts) {
|
|
|
3944
3958
|
}
|
|
3945
3959
|
return true;
|
|
3946
3960
|
}
|
|
3947
|
-
async function confirmLocalLoginReset(
|
|
3948
|
-
if (
|
|
3961
|
+
async function confirmLocalLoginReset(nonInteractive) {
|
|
3962
|
+
if (nonInteractive) {
|
|
3949
3963
|
throw new ZapierCliValidationError(
|
|
3950
3964
|
"Login cleanup failed and cannot be reset without confirmation. Re-run with an interactive terminal."
|
|
3951
3965
|
);
|
|
@@ -3971,14 +3985,9 @@ function parseTimeoutSeconds(timeout) {
|
|
|
3971
3985
|
}
|
|
3972
3986
|
return timeoutSeconds;
|
|
3973
3987
|
}
|
|
3974
|
-
async function promptCredentialsName(email,
|
|
3988
|
+
async function promptCredentialsName(email, nonInteractive) {
|
|
3975
3989
|
const fallback = `${email}@${os.hostname()}`;
|
|
3976
|
-
if (
|
|
3977
|
-
if (credentialsNameExists({ name: fallback, baseUrl: baseUrl2 })) {
|
|
3978
|
-
throw new ZapierCliValidationError(
|
|
3979
|
-
`Credentials named "${fallback}" already exist. Run \`logout\` first or use an interactive terminal to choose a different name.`
|
|
3980
|
-
);
|
|
3981
|
-
}
|
|
3990
|
+
if (nonInteractive) {
|
|
3982
3991
|
return fallback;
|
|
3983
3992
|
}
|
|
3984
3993
|
const { credentialName } = await inquirer__default.default.prompt([
|
|
@@ -3989,9 +3998,6 @@ async function promptCredentialsName(email, skipPrompts, baseUrl2) {
|
|
|
3989
3998
|
default: fallback,
|
|
3990
3999
|
validate: (input) => {
|
|
3991
4000
|
if (!input.trim()) return "Name cannot be empty";
|
|
3992
|
-
if (credentialsNameExists({ name: input.trim(), baseUrl: baseUrl2 })) {
|
|
3993
|
-
return `Credentials named "${input.trim()}" already exist. Please provide a different name.`;
|
|
3994
|
-
}
|
|
3995
4001
|
return true;
|
|
3996
4002
|
}
|
|
3997
4003
|
}
|
|
@@ -4035,7 +4041,7 @@ var loginPlugin = zapierSdk.definePlugin(
|
|
|
4035
4041
|
supportsJsonOutput: false,
|
|
4036
4042
|
handler: async ({ sdk: sdk2, options }) => {
|
|
4037
4043
|
const timeoutSeconds = parseTimeoutSeconds(options.timeout);
|
|
4038
|
-
const
|
|
4044
|
+
const nonInteractive = resolveNonInteractive(options);
|
|
4039
4045
|
const resolvedCredentials = await sdk2.context.resolveCredentials();
|
|
4040
4046
|
const pkceCredentials = toPkceCredentials(resolvedCredentials);
|
|
4041
4047
|
const credentialsBaseUrl2 = await resolveCredentialsBaseUrl({
|
|
@@ -4046,7 +4052,7 @@ var loginPlugin = zapierSdk.definePlugin(
|
|
|
4046
4052
|
baseUrl: credentialsBaseUrl2
|
|
4047
4053
|
});
|
|
4048
4054
|
if (activeCredentials) {
|
|
4049
|
-
if (!await confirmRevokeAndRelogin(activeCredentials,
|
|
4055
|
+
if (!await confirmRevokeAndRelogin(activeCredentials, nonInteractive))
|
|
4050
4056
|
return;
|
|
4051
4057
|
try {
|
|
4052
4058
|
await revokeCredentials({
|
|
@@ -4054,14 +4060,14 @@ var loginPlugin = zapierSdk.definePlugin(
|
|
|
4054
4060
|
credentials: activeCredentials
|
|
4055
4061
|
});
|
|
4056
4062
|
} catch {
|
|
4057
|
-
if (!await confirmLocalLoginReset(
|
|
4063
|
+
if (!await confirmLocalLoginReset(nonInteractive)) return;
|
|
4058
4064
|
await deleteStoredClientCredentials({
|
|
4059
4065
|
name: activeCredentials.name,
|
|
4060
4066
|
baseUrl: activeCredentials.baseUrl
|
|
4061
4067
|
});
|
|
4062
4068
|
}
|
|
4063
4069
|
} else if (hasLegacyJwtConfig()) {
|
|
4064
|
-
if (!await confirmJwtMigration(
|
|
4070
|
+
if (!await confirmJwtMigration(nonInteractive)) return;
|
|
4065
4071
|
}
|
|
4066
4072
|
const { accessToken } = await runOauthFlow({
|
|
4067
4073
|
timeoutMs: timeoutSeconds * 1e3,
|
|
@@ -4079,8 +4085,7 @@ var loginPlugin = zapierSdk.definePlugin(
|
|
|
4079
4085
|
);
|
|
4080
4086
|
const credentialName = await promptCredentialsName(
|
|
4081
4087
|
profile.email,
|
|
4082
|
-
|
|
4083
|
-
credentialsBaseUrl2
|
|
4088
|
+
nonInteractive
|
|
4084
4089
|
);
|
|
4085
4090
|
const useApprovals = options.useApprovals === true;
|
|
4086
4091
|
await setupClientCredentials({
|
|
@@ -4120,20 +4125,6 @@ var logoutPlugin = zapierSdk.definePlugin(
|
|
|
4120
4125
|
console.log("\u2705 Successfully logged out");
|
|
4121
4126
|
return;
|
|
4122
4127
|
}
|
|
4123
|
-
const { confirmed } = await inquirer__default.default.prompt([
|
|
4124
|
-
{
|
|
4125
|
-
type: "confirm",
|
|
4126
|
-
name: "confirmed",
|
|
4127
|
-
message: `Logging out will delete credentials "${activeCredentials.name}".
|
|
4128
|
-
This may interrupt other Zapier SDK or CLI sessions using them.
|
|
4129
|
-
Do you want to continue?`,
|
|
4130
|
-
default: true
|
|
4131
|
-
}
|
|
4132
|
-
]);
|
|
4133
|
-
if (!confirmed) {
|
|
4134
|
-
console.log("Logout cancelled.");
|
|
4135
|
-
return;
|
|
4136
|
-
}
|
|
4137
4128
|
await revokeCredentials({
|
|
4138
4129
|
api: sdk2.context.api,
|
|
4139
4130
|
credentials: activeCredentials,
|
|
@@ -5693,7 +5684,12 @@ var cliOverridesPlugin = zapierSdk.definePlugin(
|
|
|
5693
5684
|
var TEMPLATES = ["basic"];
|
|
5694
5685
|
var InitSchema = zod.z.object({
|
|
5695
5686
|
projectName: zod.z.string().min(1).describe("Name of the project directory to create"),
|
|
5696
|
-
|
|
5687
|
+
nonInteractive: zod.z.boolean().optional().describe("Skip all interactive prompts and accept all defaults"),
|
|
5688
|
+
/** @deprecated Use `nonInteractive` instead. */
|
|
5689
|
+
skipPrompts: zod.z.boolean().optional().meta({
|
|
5690
|
+
deprecated: true,
|
|
5691
|
+
deprecationMessage: "Use --non-interactive instead."
|
|
5692
|
+
})
|
|
5697
5693
|
}).describe(
|
|
5698
5694
|
"Create a new Zapier SDK project in a new directory with starter files"
|
|
5699
5695
|
);
|
|
@@ -5788,9 +5784,9 @@ function createExec({ cwd }) {
|
|
|
5788
5784
|
async function promptYesNo({
|
|
5789
5785
|
message,
|
|
5790
5786
|
defaultValue,
|
|
5791
|
-
|
|
5787
|
+
nonInteractive
|
|
5792
5788
|
}) {
|
|
5793
|
-
if (
|
|
5789
|
+
if (nonInteractive) return defaultValue;
|
|
5794
5790
|
const { answer } = await inquirer__default.default.prompt([
|
|
5795
5791
|
{ type: "confirm", name: "answer", message, default: defaultValue }
|
|
5796
5792
|
]);
|
|
@@ -5938,14 +5934,14 @@ async function runStep({
|
|
|
5938
5934
|
step,
|
|
5939
5935
|
stepNumber,
|
|
5940
5936
|
totalSteps,
|
|
5941
|
-
|
|
5937
|
+
nonInteractive,
|
|
5942
5938
|
displayHooks
|
|
5943
5939
|
}) {
|
|
5944
5940
|
if (step.askConfirmation) {
|
|
5945
5941
|
const should = await promptYesNo({
|
|
5946
5942
|
message: step.description,
|
|
5947
5943
|
defaultValue: true,
|
|
5948
|
-
|
|
5944
|
+
nonInteractive
|
|
5949
5945
|
});
|
|
5950
5946
|
if (!should) return false;
|
|
5951
5947
|
}
|
|
@@ -5954,7 +5950,7 @@ async function runStep({
|
|
|
5954
5950
|
stepNumber,
|
|
5955
5951
|
totalSteps,
|
|
5956
5952
|
command: step.command,
|
|
5957
|
-
|
|
5953
|
+
nonInteractive
|
|
5958
5954
|
});
|
|
5959
5955
|
try {
|
|
5960
5956
|
await step.run();
|
|
@@ -6055,11 +6051,11 @@ function createConsoleDisplayHooks() {
|
|
|
6055
6051
|
stepNumber,
|
|
6056
6052
|
totalSteps,
|
|
6057
6053
|
command,
|
|
6058
|
-
|
|
6054
|
+
nonInteractive
|
|
6059
6055
|
}) => {
|
|
6060
6056
|
const progressMessage = `${description}...`;
|
|
6061
6057
|
const stepCounter = chalk__default.default.dim(`${stepNumber}/${totalSteps}`);
|
|
6062
|
-
if (
|
|
6058
|
+
if (nonInteractive) {
|
|
6063
6059
|
console.log(
|
|
6064
6060
|
"\n" + chalk__default.default.bold(`\u276F ${progressMessage}`) + " " + stepCounter + "\n"
|
|
6065
6061
|
);
|
|
@@ -6135,7 +6131,8 @@ var initPlugin = zapierSdk.definePlugin(
|
|
|
6135
6131
|
inputSchema: InitSchema,
|
|
6136
6132
|
supportsJsonOutput: false,
|
|
6137
6133
|
handler: async ({ options }) => {
|
|
6138
|
-
const { projectName: rawName
|
|
6134
|
+
const { projectName: rawName } = options;
|
|
6135
|
+
const nonInteractive = resolveNonInteractive(options);
|
|
6139
6136
|
const cwd = process.cwd();
|
|
6140
6137
|
const { projectName, projectDir } = validateInitOptions({ rawName, cwd });
|
|
6141
6138
|
const displayHooks = createConsoleDisplayHooks();
|
|
@@ -6161,7 +6158,7 @@ var initPlugin = zapierSdk.definePlugin(
|
|
|
6161
6158
|
step,
|
|
6162
6159
|
stepNumber: i + 1,
|
|
6163
6160
|
totalSteps: steps.length,
|
|
6164
|
-
|
|
6161
|
+
nonInteractive,
|
|
6165
6162
|
displayHooks
|
|
6166
6163
|
})
|
|
6167
6164
|
);
|
|
@@ -6656,7 +6653,7 @@ var watchTriggerInboxCliPlugin = zapierSdk.definePlugin(
|
|
|
6656
6653
|
// package.json with { type: 'json' }
|
|
6657
6654
|
var package_default2 = {
|
|
6658
6655
|
name: "@zapier/zapier-sdk-cli",
|
|
6659
|
-
version: "0.52.
|
|
6656
|
+
version: "0.52.6"};
|
|
6660
6657
|
|
|
6661
6658
|
// src/sdk.ts
|
|
6662
6659
|
zapierSdk.injectCliLogin(login_exports);
|