@zapier/zapier-sdk-cli 0.45.0 → 0.46.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,30 @@
1
1
  # @zapier/zapier-sdk-cli
2
2
 
3
+ ## 0.46.1
4
+
5
+ ### Patch Changes
6
+
7
+ - cd8f37b: Collapse the approval-flow surface into a single tri-state `approvalMode` option.
8
+
9
+ What changed:
10
+ - `approvalMode` is now `"disabled" | "poll" | "throw"` (was `"poll" | "fail"`).
11
+ - `"disabled"` is the default. While the approval flow is alpha, callers must opt in explicitly via `approvalMode: "poll"` or `approvalMode: "throw"` (or the `ZAPIER_APPROVAL_MODE` env var). On an approval-required response, `"disabled"` throws a `ZapierApprovalError` with `status: "approval_required"` without creating an approval.
12
+ - The `isInteractive` SDK option and the `ZAPIER_IS_INTERACTIVE` env var have been removed. Their role is subsumed by `approvalMode`: choosing `"poll"` / `"throw"` is the explicit opt-in that previously required `isInteractive: true`.
13
+ - `"fail"` has been renamed to `"throw"` (both the option value and the `ZAPIER_APPROVAL_MODE` env var value). The behavior is unchanged: throw a `ZapierApprovalError` carrying the approval URL so the caller can surface it.
14
+ - `approvalMode`, `approvalTimeoutMs`, and `maxApprovalRetries` are now part of the public API (no longer marked `internal: true`).
15
+
16
+ There is no back-compat shim. `approvalMode: "fail"` and `isInteractive: <anything>` will fail Zod validation up front.
17
+
18
+ - Updated dependencies [cd8f37b]
19
+ - @zapier/zapier-sdk@0.50.0
20
+ - @zapier/zapier-sdk-mcp@0.13.1
21
+
22
+ ## 0.46.0
23
+
24
+ ### Minor Changes
25
+
26
+ - 774e9d3: Add `(Enter custom value)` sentinel to dynamic-resolver dropdowns in the CLI. Selecting it opens a free-text prompt and returns the typed value, so users can supply IDs that aren't in the fetched list without rerunning the command with a CLI flag. Shown for every single-select dynamic resolver; suppressed on checkbox (multi-select) prompts where a typed scalar can't merge with the user's other selections.
27
+
3
28
  ## 0.45.0
4
29
 
5
30
  ### Minor Changes
package/README.md CHANGED
@@ -133,23 +133,26 @@ npx zapier-sdk fetch "https://gmail.googleapis.com/gmail/v1/users/me/labels" --c
133
133
 
134
134
  These options are available for all commands:
135
135
 
136
- | Option | Short | Description |
137
- | -------------------------------------- | ----- | --------------------------------------------------- |
138
- | `--version` | `-V` | Display version number |
139
- | `--help` | `-h` | Display help for command |
140
- | `--credentials <token>` | | Authentication token. |
141
- | `--credentials-client-id <id>` | | OAuth client ID for authentication. |
142
- | `--credentials-client-secret <secret>` | | OAuth client secret for authentication. |
143
- | `--credentials-base-url <url>` | | Override authentication base URL. |
144
- | `--debug` | | Enable debug logging. |
145
- | `--base-url <url>` | | Base URL for Zapier API endpoints. |
146
- | `--tracking-base-url <url>` | | Base URL for Zapier tracking endpoints. |
147
- | `--max-network-retries <count>` | | Max retries for rate-limited requests (default: 3). |
148
- | `--max-network-retry-delay-ms <ms>` | | Max delay in ms to wait for retry (default: 60000). |
149
- | `--can-include-shared-connections` | | Allow listing shared connections. |
150
- | `--can-include-shared-tables` | | Allow listing shared tables. |
151
- | `--can-delete-tables` | | Allow deleting tables. |
152
- | `--json` | | Output raw JSON instead of formatted results |
136
+ | Option | Short | Description |
137
+ | -------------------------------------- | ----- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
138
+ | `--version` | `-V` | Display version number |
139
+ | `--help` | `-h` | Display help for command |
140
+ | `--credentials <token>` | | Authentication token. |
141
+ | `--credentials-client-id <id>` | | OAuth client ID for authentication. |
142
+ | `--credentials-client-secret <secret>` | | OAuth client secret for authentication. |
143
+ | `--credentials-base-url <url>` | | Override authentication base URL. |
144
+ | `--debug` | | Enable debug logging. |
145
+ | `--base-url <url>` | | Base URL for Zapier API endpoints. |
146
+ | `--tracking-base-url <url>` | | Base URL for Zapier tracking endpoints. |
147
+ | `--max-network-retries <count>` | | Max retries for rate-limited requests (default: 3). |
148
+ | `--max-network-retry-delay-ms <ms>` | | Max delay in ms to wait for retry (default: 60000). |
149
+ | `--approval-timeout-ms <ms>` | | Timeout in ms for approval polling. Default: 600000 (10 min). |
150
+ | `--max-approval-retries` | | Maximum number of sequential approval rounds per request (one per gating policy) before giving up. Default: 2. |
151
+ | `--approval-mode` | | Approval flow behavior. "disabled" (default) throws a ZapierApprovalError on approval-required responses without creating an approval. "poll" creates the approval, opens it in a browser, polls until resolved, and retries the original request. "throw" creates the approval and throws a ZapierApprovalError with the approval URL so the caller can surface it. Defaults to the ZAPIER_APPROVAL_MODE env var, then "disabled". |
152
+ | `--can-include-shared-connections` | | Allow listing shared connections. |
153
+ | `--can-include-shared-tables` | | Allow listing shared tables. |
154
+ | `--can-delete-tables` | | Allow deleting tables. |
155
+ | `--json` | | Output raw JSON instead of formatted results |
153
156
 
154
157
  ## Available Commands
155
158
 
package/dist/cli.cjs CHANGED
@@ -485,6 +485,7 @@ var SchemaParameterResolver = class {
485
485
  }
486
486
  const LOAD_MORE_SENTINEL = Symbol("LOAD_MORE");
487
487
  const SKIP_SENTINEL = Symbol("SKIP");
488
+ const CUSTOM_VALUE_SENTINEL = Symbol("CUSTOM_VALUE");
488
489
  let newItemsStartIndex = -1;
489
490
  this.stopSpinner();
490
491
  while (true) {
@@ -507,6 +508,13 @@ var SchemaParameterResolver = class {
507
508
  value: SKIP_SENTINEL
508
509
  });
509
510
  }
511
+ if (promptConfig.choices && promptConfig.type === "list") {
512
+ const insertAt = isOptional ? 1 : 0;
513
+ promptConfig.choices.splice(insertAt, 0, {
514
+ name: chalk7__default.default.dim("(Enter custom value)"),
515
+ value: CUSTOM_VALUE_SENTINEL
516
+ });
517
+ }
510
518
  if (hasMore && pageIterator && promptConfig.choices) {
511
519
  promptConfig.choices.push({
512
520
  name: chalk7__default.default.dim("(Load more...)"),
@@ -529,7 +537,7 @@ var SchemaParameterResolver = class {
529
537
  }
530
538
  }
531
539
  if (newItemsStartIndex >= 0 && promptConfig.choices) {
532
- const injectedBefore = isOptional ? 1 : 0;
540
+ const injectedBefore = (isOptional ? 1 : 0) + (promptConfig.type === "list" ? 1 : 0);
533
541
  const adjustedIndex = newItemsStartIndex + injectedBefore;
534
542
  if (promptConfig.choices[adjustedIndex]) {
535
543
  promptConfig.default = promptConfig.choices[adjustedIndex].value;
@@ -541,6 +549,20 @@ var SchemaParameterResolver = class {
541
549
  if (selected === SKIP_SENTINEL) {
542
550
  return void 0;
543
551
  }
552
+ if (selected === CUSTOM_VALUE_SENTINEL) {
553
+ const customAnswer = await inquirer__default.default.prompt([
554
+ {
555
+ type: "input",
556
+ name: promptName,
557
+ message: `Enter ${promptLabel}${isOptional ? " (optional)" : ""}:`
558
+ }
559
+ ]);
560
+ const value = customAnswer[promptName];
561
+ if (isOptional && (value === void 0 || value === "")) {
562
+ return void 0;
563
+ }
564
+ return value;
565
+ }
544
566
  const wantsMore = Array.isArray(selected) ? selected.includes(LOAD_MORE_SENTINEL) : selected === LOAD_MORE_SENTINEL;
545
567
  if (wantsMore && pageIterator) {
546
568
  if (Array.isArray(selected)) {
@@ -1157,7 +1179,7 @@ var SHARED_COMMAND_CLI_OPTIONS = [
1157
1179
 
1158
1180
  // package.json
1159
1181
  var package_default = {
1160
- version: "0.45.0"};
1182
+ version: "0.46.1"};
1161
1183
 
1162
1184
  // src/telemetry/builders.ts
1163
1185
  function createCliBaseEvent(context = {}) {
@@ -5713,7 +5735,7 @@ var watchTriggerInboxCliPlugin = zapierSdk.definePlugin(
5713
5735
  // package.json with { type: 'json' }
5714
5736
  var package_default2 = {
5715
5737
  name: "@zapier/zapier-sdk-cli",
5716
- version: "0.45.0"};
5738
+ version: "0.46.1"};
5717
5739
 
5718
5740
  // src/sdk.ts
5719
5741
  zapierSdk.injectCliLogin(login_exports);
package/dist/cli.mjs CHANGED
@@ -444,6 +444,7 @@ var SchemaParameterResolver = class {
444
444
  }
445
445
  const LOAD_MORE_SENTINEL = Symbol("LOAD_MORE");
446
446
  const SKIP_SENTINEL = Symbol("SKIP");
447
+ const CUSTOM_VALUE_SENTINEL = Symbol("CUSTOM_VALUE");
447
448
  let newItemsStartIndex = -1;
448
449
  this.stopSpinner();
449
450
  while (true) {
@@ -466,6 +467,13 @@ var SchemaParameterResolver = class {
466
467
  value: SKIP_SENTINEL
467
468
  });
468
469
  }
470
+ if (promptConfig.choices && promptConfig.type === "list") {
471
+ const insertAt = isOptional ? 1 : 0;
472
+ promptConfig.choices.splice(insertAt, 0, {
473
+ name: chalk7.dim("(Enter custom value)"),
474
+ value: CUSTOM_VALUE_SENTINEL
475
+ });
476
+ }
469
477
  if (hasMore && pageIterator && promptConfig.choices) {
470
478
  promptConfig.choices.push({
471
479
  name: chalk7.dim("(Load more...)"),
@@ -488,7 +496,7 @@ var SchemaParameterResolver = class {
488
496
  }
489
497
  }
490
498
  if (newItemsStartIndex >= 0 && promptConfig.choices) {
491
- const injectedBefore = isOptional ? 1 : 0;
499
+ const injectedBefore = (isOptional ? 1 : 0) + (promptConfig.type === "list" ? 1 : 0);
492
500
  const adjustedIndex = newItemsStartIndex + injectedBefore;
493
501
  if (promptConfig.choices[adjustedIndex]) {
494
502
  promptConfig.default = promptConfig.choices[adjustedIndex].value;
@@ -500,6 +508,20 @@ var SchemaParameterResolver = class {
500
508
  if (selected === SKIP_SENTINEL) {
501
509
  return void 0;
502
510
  }
511
+ if (selected === CUSTOM_VALUE_SENTINEL) {
512
+ const customAnswer = await inquirer.prompt([
513
+ {
514
+ type: "input",
515
+ name: promptName,
516
+ message: `Enter ${promptLabel}${isOptional ? " (optional)" : ""}:`
517
+ }
518
+ ]);
519
+ const value = customAnswer[promptName];
520
+ if (isOptional && (value === void 0 || value === "")) {
521
+ return void 0;
522
+ }
523
+ return value;
524
+ }
503
525
  const wantsMore = Array.isArray(selected) ? selected.includes(LOAD_MORE_SENTINEL) : selected === LOAD_MORE_SENTINEL;
504
526
  if (wantsMore && pageIterator) {
505
527
  if (Array.isArray(selected)) {
@@ -1116,7 +1138,7 @@ var SHARED_COMMAND_CLI_OPTIONS = [
1116
1138
 
1117
1139
  // package.json
1118
1140
  var package_default = {
1119
- version: "0.45.0"};
1141
+ version: "0.46.1"};
1120
1142
 
1121
1143
  // src/telemetry/builders.ts
1122
1144
  function createCliBaseEvent(context = {}) {
@@ -5672,7 +5694,7 @@ var watchTriggerInboxCliPlugin = definePlugin(
5672
5694
  // package.json with { type: 'json' }
5673
5695
  var package_default2 = {
5674
5696
  name: "@zapier/zapier-sdk-cli",
5675
- version: "0.45.0"};
5697
+ version: "0.46.1"};
5676
5698
 
5677
5699
  // src/sdk.ts
5678
5700
  injectCliLogin(login_exports);
@@ -3487,7 +3487,7 @@ var watchTriggerInboxCliPlugin = zapierSdk.definePlugin(
3487
3487
  // package.json with { type: 'json' }
3488
3488
  var package_default = {
3489
3489
  name: "@zapier/zapier-sdk-cli",
3490
- version: "0.45.0"};
3490
+ version: "0.46.1"};
3491
3491
 
3492
3492
  // src/experimental.ts
3493
3493
  experimental.injectCliLogin(login_exports);
@@ -3451,7 +3451,7 @@ var watchTriggerInboxCliPlugin = definePlugin(
3451
3451
  // package.json with { type: 'json' }
3452
3452
  var package_default = {
3453
3453
  name: "@zapier/zapier-sdk-cli",
3454
- version: "0.45.0"};
3454
+ version: "0.46.1"};
3455
3455
 
3456
3456
  // src/experimental.ts
3457
3457
  injectCliLogin(login_exports);
package/dist/index.cjs CHANGED
@@ -3486,7 +3486,7 @@ zapierSdk.definePlugin(
3486
3486
  // package.json with { type: 'json' }
3487
3487
  var package_default = {
3488
3488
  name: "@zapier/zapier-sdk-cli",
3489
- version: "0.45.0"};
3489
+ version: "0.46.1"};
3490
3490
 
3491
3491
  // src/sdk.ts
3492
3492
  zapierSdk.injectCliLogin(login_exports);
@@ -3514,7 +3514,7 @@ function createZapierCliSdk(options = {}) {
3514
3514
 
3515
3515
  // package.json
3516
3516
  var package_default2 = {
3517
- version: "0.45.0"};
3517
+ version: "0.46.1"};
3518
3518
 
3519
3519
  // src/telemetry/builders.ts
3520
3520
  function createCliBaseEvent(context = {}) {
package/dist/index.mjs CHANGED
@@ -3450,7 +3450,7 @@ definePlugin(
3450
3450
  // package.json with { type: 'json' }
3451
3451
  var package_default = {
3452
3452
  name: "@zapier/zapier-sdk-cli",
3453
- version: "0.45.0"};
3453
+ version: "0.46.1"};
3454
3454
 
3455
3455
  // src/sdk.ts
3456
3456
  injectCliLogin(login_exports);
@@ -3478,7 +3478,7 @@ function createZapierCliSdk(options = {}) {
3478
3478
 
3479
3479
  // package.json
3480
3480
  var package_default2 = {
3481
- version: "0.45.0"};
3481
+ version: "0.46.1"};
3482
3482
 
3483
3483
  // src/telemetry/builders.ts
3484
3484
  function createCliBaseEvent(context = {}) {
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zapier/zapier-sdk-cli",
3
- "version": "0.45.0",
3
+ "version": "0.46.1",
4
4
  "description": "Command line interface for Zapier SDK",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
@@ -385,6 +385,7 @@ export class SchemaParameterResolver {
385
385
  }
386
386
  const LOAD_MORE_SENTINEL = Symbol("LOAD_MORE");
387
387
  const SKIP_SENTINEL = Symbol("SKIP");
388
+ const CUSTOM_VALUE_SENTINEL = Symbol("CUSTOM_VALUE");
388
389
  let newItemsStartIndex = -1;
389
390
  this.stopSpinner();
390
391
  while (true) {
@@ -405,6 +406,16 @@ export class SchemaParameterResolver {
405
406
  value: SKIP_SENTINEL,
406
407
  });
407
408
  }
409
+ // Pinned to the top so it's reachable without scrolling past a long
410
+ // list. Restricted to single-select: a typed scalar can't merge
411
+ // sensibly with checkbox selections.
412
+ if (promptConfig.choices && promptConfig.type === "list") {
413
+ const insertAt = isOptional ? 1 : 0;
414
+ promptConfig.choices.splice(insertAt, 0, {
415
+ name: chalk.dim("(Enter custom value)"),
416
+ value: CUSTOM_VALUE_SENTINEL,
417
+ });
418
+ }
408
419
  // Add "Load more..." option if paginated
409
420
  if (hasMore && pageIterator && promptConfig.choices) {
410
421
  promptConfig.choices.push({
@@ -433,7 +444,7 @@ export class SchemaParameterResolver {
433
444
  // After loading more, jump cursor to first new item.
434
445
  // Offset by the number of injected choices before the data items (e.g. Skip).
435
446
  if (newItemsStartIndex >= 0 && promptConfig.choices) {
436
- const injectedBefore = isOptional ? 1 : 0;
447
+ const injectedBefore = (isOptional ? 1 : 0) + (promptConfig.type === "list" ? 1 : 0);
437
448
  const adjustedIndex = newItemsStartIndex + injectedBefore;
438
449
  if (promptConfig.choices[adjustedIndex]) {
439
450
  promptConfig.default = promptConfig.choices[adjustedIndex].value;
@@ -445,6 +456,20 @@ export class SchemaParameterResolver {
445
456
  if (selected === SKIP_SENTINEL) {
446
457
  return undefined;
447
458
  }
459
+ if (selected === CUSTOM_VALUE_SENTINEL) {
460
+ const customAnswer = await inquirer.prompt([
461
+ {
462
+ type: "input",
463
+ name: promptName,
464
+ message: `Enter ${promptLabel}${isOptional ? " (optional)" : ""}:`,
465
+ },
466
+ ]);
467
+ const value = customAnswer[promptName];
468
+ if (isOptional && (value === undefined || value === "")) {
469
+ return undefined;
470
+ }
471
+ return value;
472
+ }
448
473
  const wantsMore = Array.isArray(selected)
449
474
  ? selected.includes(LOAD_MORE_SENTINEL)
450
475
  : selected === LOAD_MORE_SENTINEL;