@zapier/zapier-sdk-cli 0.39.11 → 0.40.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.
Files changed (37) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +29 -29
  3. package/dist/cli.cjs +32 -31
  4. package/dist/cli.mjs +32 -31
  5. package/dist/index.cjs +25 -27
  6. package/dist/index.d.mts +2 -3
  7. package/dist/index.d.ts +2 -3
  8. package/dist/index.mjs +25 -27
  9. package/dist/package.json +1 -1
  10. package/dist/src/cli.js +1 -1
  11. package/dist/src/generators/ast-generator.d.ts +2 -2
  12. package/dist/src/plugins/add/index.d.ts +2 -2
  13. package/dist/src/plugins/add/index.js +1 -1
  14. package/dist/src/plugins/buildManifest/index.d.ts +2 -2
  15. package/dist/src/plugins/buildManifest/index.js +2 -2
  16. package/dist/src/plugins/bundleCode/index.d.ts +0 -1
  17. package/dist/src/plugins/cliOverrides/index.d.ts +5 -3
  18. package/dist/src/plugins/cliOverrides/index.js +7 -4
  19. package/dist/src/plugins/curl/index.d.ts +1 -1
  20. package/dist/src/plugins/curl/index.js +2 -3
  21. package/dist/src/plugins/curl/schemas.js +3 -1
  22. package/dist/src/plugins/feedback/index.d.ts +7 -1
  23. package/dist/src/plugins/feedback/index.js +2 -2
  24. package/dist/src/plugins/generateAppTypes/index.d.ts +2 -2
  25. package/dist/src/plugins/generateAppTypes/index.js +1 -1
  26. package/dist/src/plugins/getLoginConfigPath/index.d.ts +0 -1
  27. package/dist/src/plugins/init/index.d.ts +1 -1
  28. package/dist/src/plugins/login/index.d.ts +5 -3
  29. package/dist/src/plugins/login/index.js +3 -3
  30. package/dist/src/plugins/logout/index.d.ts +1 -1
  31. package/dist/src/plugins/mcp/index.d.ts +7 -1
  32. package/dist/src/plugins/mcp/index.js +2 -2
  33. package/dist/src/types/sdk.d.ts +2 -3
  34. package/dist/src/utils/cli-generator.js +1 -3
  35. package/dist/src/utils/parameter-resolver.js +1 -1
  36. package/dist/tsconfig.tsbuildinfo +1 -1
  37. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @zapier/zapier-sdk-cli
2
2
 
3
+ ## 0.40.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 707c57a: Simplify plugin system: plugins now receive sdk as a positional parameter with context at sdk.context. The Plugin type takes 2 generics (input SDK shape, output provides) instead of 3. Context is shallow-frozen to prevent reassignment of top-level properties. createSdk() is now zero-arg; SDK options are injected via createOptionsPlugin(options) through addPlugin like any other state. Plugins that need options declare it as an explicit context dependency. The addPluginOptions second argument to addPlugin has been removed.
8
+ - Updated dependencies [707c57a]
9
+ - @zapier/zapier-sdk@0.42.1
10
+ - @zapier/zapier-sdk-mcp@0.10.15
11
+
12
+ ## 0.40.0
13
+
14
+ ### Minor Changes
15
+
16
+ - 55e8330: Support maxTime for SDK fetch & CLI curl - Relay extended timeout
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies [55e8330]
21
+ - @zapier/zapier-sdk@0.42.0
22
+ - @zapier/zapier-sdk-mcp@0.10.14
23
+
3
24
  ## 0.39.11
4
25
 
5
26
  ### Patch Changes
package/README.md CHANGED
@@ -494,35 +494,35 @@ Make authenticated HTTP requests to any API through Zapier. Pass a connection ID
494
494
 
495
495
  **Options:**
496
496
 
497
- | Option | Type | Required | Default | Possible Values | Description |
498
- | ------------------ | ---------------- | -------- | ------- | ---------------------------------------------------------- | ------------------------------------------------------------ |
499
- | `<url>` | `string` | ✅ | — | — | Request URL |
500
- | `--request` | `string` | ❌ | — | `GET`, `POST`, `PUT`, `DELETE`, `PATCH`, `HEAD`, `OPTIONS` | HTTP method (defaults to GET, or POST if data is provided) |
501
- | `--header` | `array` | ❌ | — | — | HTTP headers in 'Key: Value' format (repeatable) |
502
- | `--data` | `array` | ❌ | — | — | HTTP POST data (repeatable, joined with &) |
503
- | `--data-raw` | `array` | ❌ | — | — | HTTP POST data without special interpretation (repeatable) |
504
- | `--data-ascii` | `array` | ❌ | — | — | HTTP POST ASCII data (repeatable) |
505
- | `--data-binary` | `array` | ❌ | — | — | HTTP POST binary data (repeatable) |
506
- | `--data-urlencode` | `array` | ❌ | — | — | HTTP POST data, URL-encoded (repeatable) |
507
- | `--json` | `string` | ❌ | — | — | Send JSON body (sets Content-Type and Accept headers) |
508
- | `--form` | `array` | ❌ | — | — | Multipart form data as 'name=value' (repeatable) |
509
- | `--form-string` | `array` | ❌ | — | — | Multipart form string field (repeatable) |
510
- | `--get` | `boolean` | ❌ | — | — | Force GET method and append data to query string |
511
- | `--head` | `boolean` | ❌ | — | — | Fetch headers only (HEAD request) |
512
- | `--location` | `boolean` | ❌ | — | — | Follow redirects |
513
- | `--include` | `boolean` | ❌ | — | — | Include response headers in output |
514
- | `--output` | `string` | ❌ | — | — | Write output to file instead of stdout |
515
- | `--remote-name` | `boolean` | ❌ | — | — | Write output to file named like the remote file |
516
- | `--verbose` | `boolean` | ❌ | — | — | Verbose output (show request/response headers on stderr) |
517
- | `--silent` | `boolean` | ❌ | — | — | Silent mode (suppress errors) |
518
- | `--show-error` | `boolean` | ❌ | — | — | Show errors even when in silent mode |
519
- | `--fail` | `boolean` | ❌ | — | — | Fail silently on HTTP errors (exit code 22) |
520
- | `--fail-with-body` | `boolean` | ❌ | — | — | Fail on HTTP errors but still output the body |
521
- | `--write-out` | `string` | ❌ | — | — | Output format string after completion (e.g., '%{http_code}') |
522
- | `--max-time` | `number` | ❌ | — | — | Maximum time in seconds for the request |
523
- | `--user` | `string` | ❌ | — | — | Basic auth credentials as 'user:password' |
524
- | `--compressed` | `boolean` | ❌ | — | — | Request compressed response (sends Accept-Encoding header) |
525
- | `--connection` | `string, number` | ❌ | — | — | Zapier connection ID or alias for authentication |
497
+ | Option | Type | Required | Default | Possible Values | Description |
498
+ | ------------------ | ---------------- | -------- | ------- | ---------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
499
+ | `<url>` | `string` | ✅ | — | — | Request URL |
500
+ | `--request` | `string` | ❌ | — | `GET`, `POST`, `PUT`, `DELETE`, `PATCH`, `HEAD`, `OPTIONS` | HTTP method (defaults to GET, or POST if data is provided) |
501
+ | `--header` | `array` | ❌ | — | — | HTTP headers in 'Key: Value' format (repeatable) |
502
+ | `--data` | `array` | ❌ | — | — | HTTP POST data (repeatable, joined with &) |
503
+ | `--data-raw` | `array` | ❌ | — | — | HTTP POST data without special interpretation (repeatable) |
504
+ | `--data-ascii` | `array` | ❌ | — | — | HTTP POST ASCII data (repeatable) |
505
+ | `--data-binary` | `array` | ❌ | — | — | HTTP POST binary data (repeatable) |
506
+ | `--data-urlencode` | `array` | ❌ | — | — | HTTP POST data, URL-encoded (repeatable) |
507
+ | `--json` | `string` | ❌ | — | — | Send JSON body (sets Content-Type and Accept headers) |
508
+ | `--form` | `array` | ❌ | — | — | Multipart form data as 'name=value' (repeatable) |
509
+ | `--form-string` | `array` | ❌ | — | — | Multipart form string field (repeatable) |
510
+ | `--get` | `boolean` | ❌ | — | — | Force GET method and append data to query string |
511
+ | `--head` | `boolean` | ❌ | — | — | Fetch headers only (HEAD request) |
512
+ | `--location` | `boolean` | ❌ | — | — | Follow redirects |
513
+ | `--include` | `boolean` | ❌ | — | — | Include response headers in output |
514
+ | `--output` | `string` | ❌ | — | — | Write output to file instead of stdout |
515
+ | `--remote-name` | `boolean` | ❌ | — | — | Write output to file named like the remote file |
516
+ | `--verbose` | `boolean` | ❌ | — | — | Verbose output (show request/response headers on stderr) |
517
+ | `--silent` | `boolean` | ❌ | — | — | Silent mode (suppress errors) |
518
+ | `--show-error` | `boolean` | ❌ | — | — | Show errors even when in silent mode |
519
+ | `--fail` | `boolean` | ❌ | — | — | Fail silently on HTTP errors (exit code 22) |
520
+ | `--fail-with-body` | `boolean` | ❌ | — | — | Fail on HTTP errors but still output the body |
521
+ | `--write-out` | `string` | ❌ | — | — | Output format string after completion (e.g., '%{http_code}') |
522
+ | `--max-time` | `number` | ❌ | — | — | Maximum seconds to wait for a response. Honored on a best-effort basis; the server may silently enforce a lower ceiling. |
523
+ | `--user` | `string` | ❌ | — | — | Basic auth credentials as 'user:password' |
524
+ | `--compressed` | `boolean` | ❌ | — | — | Request compressed response (sends Accept-Encoding header) |
525
+ | `--connection` | `string, number` | ❌ | — | — | Zapier connection ID or alias for authentication |
526
526
 
527
527
  **Usage:**
528
528
 
package/dist/cli.cjs CHANGED
@@ -477,7 +477,7 @@ var SchemaParameterResolver = class {
477
477
  });
478
478
  }
479
479
  if (!hasMore && promptConfig.choices && dynamicResolver.requireCapabilities) {
480
- const capContext = context.sdk.getContext();
480
+ const capContext = context.sdk.context;
481
481
  if (capContext.hasCapability) {
482
482
  for (const cap of dynamicResolver.requireCapabilities) {
483
483
  const enabled = await capContext.hasCapability(cap);
@@ -1103,7 +1103,7 @@ var SHARED_COMMAND_CLI_OPTIONS = [
1103
1103
 
1104
1104
  // package.json
1105
1105
  var package_default = {
1106
- version: "0.39.11"};
1106
+ version: "0.40.1"};
1107
1107
 
1108
1108
  // src/telemetry/builders.ts
1109
1109
  function createCliBaseEvent(context = {}) {
@@ -2070,7 +2070,10 @@ ${confirmMessageAfter}`));
2070
2070
  selected_api: resolvedParams.app ?? null
2071
2071
  }
2072
2072
  });
2073
- sdk2.getContext().eventEmission.emit(CLI_COMMAND_EXECUTED_EVENT_SUBJECT, event);
2073
+ sdk2.context.eventEmission.emit(
2074
+ CLI_COMMAND_EXECUTED_EVENT_SUBJECT,
2075
+ event
2076
+ );
2074
2077
  } catch {
2075
2078
  }
2076
2079
  }
@@ -2510,22 +2513,20 @@ function toPkceCredentials(credentials2) {
2510
2513
  }
2511
2514
  return void 0;
2512
2515
  }
2513
- var loginPlugin = ({
2514
- context
2515
- }) => {
2516
+ var loginPlugin = (sdk2) => {
2516
2517
  const loginFn = async (options) => {
2517
2518
  const timeoutSeconds = options.timeout ? parseInt(options.timeout, 10) : 300;
2518
2519
  if (isNaN(timeoutSeconds) || timeoutSeconds <= 0) {
2519
2520
  throw new Error("Timeout must be a positive number");
2520
2521
  }
2521
- const resolvedCredentials = await context.resolveCredentials();
2522
+ const resolvedCredentials = await sdk2.context.resolveCredentials();
2522
2523
  const pkceCredentials = toPkceCredentials(resolvedCredentials);
2523
2524
  await login_default({
2524
2525
  timeoutMs: timeoutSeconds * 1e3,
2525
2526
  credentials: pkceCredentials
2526
2527
  });
2527
2528
  const user = await cliLogin.getLoggedInUser();
2528
- context.eventEmission.emit(
2529
+ sdk2.context.eventEmission.emit(
2529
2530
  "platform.sdk.ApplicationLifecycleEvent",
2530
2531
  zapierSdk.buildApplicationLifecycleEvent(
2531
2532
  { lifecycle_event_type: "login_success" },
@@ -2571,11 +2572,11 @@ var McpSchema = zod.z.object({
2571
2572
  }).describe("Start MCP server for Zapier SDK");
2572
2573
 
2573
2574
  // src/plugins/mcp/index.ts
2574
- var mcpPlugin = ({ context }) => {
2575
+ var mcpPlugin = (sdk2) => {
2575
2576
  const mcpWithSdk = zapierSdk.createFunction(async function mcpWithSdk2(options) {
2576
2577
  const mcpOptions = {
2577
2578
  ...options,
2578
- debug: context.options.debug
2579
+ debug: sdk2.context.options?.debug
2579
2580
  };
2580
2581
  return await zapierSdkMcp.startMcpServer(mcpOptions);
2581
2582
  }, McpSchema);
@@ -2729,7 +2730,7 @@ async function detectTypesOutputDirectory() {
2729
2730
  }
2730
2731
  return "./zapier/apps/";
2731
2732
  }
2732
- var addPlugin = ({ sdk: sdk2 }) => {
2733
+ var addPlugin = (sdk2) => {
2733
2734
  const add = zapierSdk.createFunction(async function add2(options) {
2734
2735
  const {
2735
2736
  apps: appKeys,
@@ -3440,7 +3441,7 @@ function createManifestEntry(app) {
3440
3441
  version: app.version
3441
3442
  };
3442
3443
  }
3443
- var generateAppTypesPlugin = ({ sdk: sdk2 }) => {
3444
+ var generateAppTypesPlugin = (sdk2) => {
3444
3445
  const generateAppTypes = zapierSdk.createFunction(async function generateAppTypes2(options) {
3445
3446
  const {
3446
3447
  apps: appKeys,
@@ -3599,7 +3600,7 @@ var BuildManifestSchema = zod.z.object({
3599
3600
  );
3600
3601
 
3601
3602
  // src/plugins/buildManifest/index.ts
3602
- var buildManifestPlugin = ({ sdk: sdk2, context }) => {
3603
+ var buildManifestPlugin = (sdk2) => {
3603
3604
  const buildManifest = zapierSdk.createFunction(async function buildManifest2(options) {
3604
3605
  const {
3605
3606
  apps: appKeys,
@@ -3633,7 +3634,7 @@ var buildManifestPlugin = ({ sdk: sdk2, context }) => {
3633
3634
  manifestKey: manifestEntry.implementationName,
3634
3635
  version: manifestEntry.version || ""
3635
3636
  });
3636
- const { key: updatedManifestKey, manifest } = await context.updateManifestEntry({
3637
+ const { key: updatedManifestKey, manifest } = await sdk2.context.updateManifestEntry({
3637
3638
  appKey: app.key,
3638
3639
  entry: manifestEntry,
3639
3640
  configPath,
@@ -3712,10 +3713,8 @@ async function postWithRetry({
3712
3713
  }
3713
3714
  return response;
3714
3715
  }
3715
- var feedbackPlugin = ({
3716
- context
3717
- }) => {
3718
- const debug = context.options.debug;
3716
+ var feedbackPlugin = (sdk2) => {
3717
+ const debug = sdk2.context.options?.debug;
3719
3718
  const feedbackWithSdk = zapierSdk.createFunction(async function feedback(options) {
3720
3719
  const user = await cliLogin.getLoggedInUser();
3721
3720
  const body = JSON.stringify({
@@ -3769,7 +3768,9 @@ var CurlSchema = zod.z.object({
3769
3768
  fail: zod.z.boolean().optional().describe("Fail silently on HTTP errors (exit code 22)"),
3770
3769
  failWithBody: zod.z.boolean().optional().describe("Fail on HTTP errors but still output the body"),
3771
3770
  writeOut: zod.z.string().optional().describe("Output format string after completion (e.g., '%{http_code}')"),
3772
- maxTime: zod.z.number().optional().describe("Maximum time in seconds for the request"),
3771
+ maxTime: zod.z.number().int().positive().optional().describe(
3772
+ "Maximum seconds to wait for a response. Honored on a best-effort basis; the server may silently enforce a lower ceiling."
3773
+ ),
3773
3774
  user: zod.z.string().optional().describe("Basic auth credentials as 'user:password'"),
3774
3775
  compressed: zod.z.boolean().optional().describe("Request compressed response (sends Accept-Encoding header)"),
3775
3776
  connection: zod.z.union([zod.z.string(), zod.z.number()]).optional().describe("Zapier connection ID or alias for authentication"),
@@ -3918,9 +3919,7 @@ async function buildFormData(formArgs, formStringArgs) {
3918
3919
  }
3919
3920
 
3920
3921
  // src/plugins/curl/index.ts
3921
- var curlPlugin = ({
3922
- sdk: sdk2
3923
- }) => {
3922
+ var curlPlugin = (sdk2) => {
3924
3923
  async function curl(options) {
3925
3924
  const {
3926
3925
  url: rawUrl,
@@ -4052,15 +4051,14 @@ var curlPlugin = ({
4052
4051
  }
4053
4052
  process.stderr.write(">\n");
4054
4053
  }
4055
- const signal = maxTime ? AbortSignal.timeout(maxTime * 1e3) : void 0;
4056
4054
  const start = performance.now();
4057
4055
  const response = await sdk2.fetch(effectiveUrl.toString(), {
4058
4056
  method,
4059
4057
  headers,
4060
4058
  body,
4061
4059
  redirect,
4062
- signal,
4063
- connection
4060
+ connection,
4061
+ maxTime
4064
4062
  });
4065
4063
  const timeTotalSeconds = (performance.now() - start) / 1e3;
4066
4064
  if (verbose && !silent) {
@@ -4167,16 +4165,19 @@ ${Array.from(
4167
4165
  };
4168
4166
 
4169
4167
  // src/plugins/cliOverrides/index.ts
4170
- var cliOverridesPlugin = ({ context }) => {
4171
- if (!context.meta.fetch) {
4168
+ var cliOverridesPlugin = (sdk2) => {
4169
+ if (!sdk2.context.meta.fetch) {
4172
4170
  return { context: { meta: {} } };
4173
4171
  }
4174
4172
  return {
4175
4173
  context: {
4176
4174
  meta: {
4177
4175
  fetch: {
4178
- ...context.meta.fetch,
4179
- categories: [...context.meta.fetch.categories || [], "deprecated"],
4176
+ ...sdk2.context.meta.fetch,
4177
+ categories: [
4178
+ ...sdk2.context.meta.fetch.categories || [],
4179
+ "deprecated"
4180
+ ],
4180
4181
  deprecation: {
4181
4182
  message: "This command is deprecated and will be removed soon. Use `curl` instead. Learn more: https://docs.zapier.com/sdk/cli-reference#curl"
4182
4183
  }
@@ -4696,7 +4697,7 @@ function createZapierCliSdk(options = {}) {
4696
4697
  // package.json with { type: 'json' }
4697
4698
  var package_default2 = {
4698
4699
  name: "@zapier/zapier-sdk-cli",
4699
- version: "0.39.11"};
4700
+ version: "0.40.1"};
4700
4701
  var ONE_DAY_MS = 24 * 60 * 60 * 1e3;
4701
4702
  var CACHE_RESET_INTERVAL_MS = (() => {
4702
4703
  const { ZAPIER_SDK_UPDATE_CHECK_INTERVAL_MS = `${ONE_DAY_MS}` } = process.env;
@@ -4956,7 +4957,7 @@ program.exitOverride();
4956
4957
  }
4957
4958
  }
4958
4959
  await versionCheckPromise;
4959
- await sdk.getContext().eventEmission.close(exitCode);
4960
+ await sdk.context.eventEmission.close(exitCode);
4960
4961
  const exitTimeout = setTimeout(
4961
4962
  () => process.exit(exitCode),
4962
4963
  EXIT_GRACE_PERIOD_MS
package/dist/cli.mjs CHANGED
@@ -439,7 +439,7 @@ var SchemaParameterResolver = class {
439
439
  });
440
440
  }
441
441
  if (!hasMore && promptConfig.choices && dynamicResolver.requireCapabilities) {
442
- const capContext = context.sdk.getContext();
442
+ const capContext = context.sdk.context;
443
443
  if (capContext.hasCapability) {
444
444
  for (const cap of dynamicResolver.requireCapabilities) {
445
445
  const enabled = await capContext.hasCapability(cap);
@@ -1065,7 +1065,7 @@ var SHARED_COMMAND_CLI_OPTIONS = [
1065
1065
 
1066
1066
  // package.json
1067
1067
  var package_default = {
1068
- version: "0.39.11"};
1068
+ version: "0.40.1"};
1069
1069
 
1070
1070
  // src/telemetry/builders.ts
1071
1071
  function createCliBaseEvent(context = {}) {
@@ -2032,7 +2032,10 @@ ${confirmMessageAfter}`));
2032
2032
  selected_api: resolvedParams.app ?? null
2033
2033
  }
2034
2034
  });
2035
- sdk2.getContext().eventEmission.emit(CLI_COMMAND_EXECUTED_EVENT_SUBJECT, event);
2035
+ sdk2.context.eventEmission.emit(
2036
+ CLI_COMMAND_EXECUTED_EVENT_SUBJECT,
2037
+ event
2038
+ );
2036
2039
  } catch {
2037
2040
  }
2038
2041
  }
@@ -2472,22 +2475,20 @@ function toPkceCredentials(credentials2) {
2472
2475
  }
2473
2476
  return void 0;
2474
2477
  }
2475
- var loginPlugin = ({
2476
- context
2477
- }) => {
2478
+ var loginPlugin = (sdk2) => {
2478
2479
  const loginFn = async (options) => {
2479
2480
  const timeoutSeconds = options.timeout ? parseInt(options.timeout, 10) : 300;
2480
2481
  if (isNaN(timeoutSeconds) || timeoutSeconds <= 0) {
2481
2482
  throw new Error("Timeout must be a positive number");
2482
2483
  }
2483
- const resolvedCredentials = await context.resolveCredentials();
2484
+ const resolvedCredentials = await sdk2.context.resolveCredentials();
2484
2485
  const pkceCredentials = toPkceCredentials(resolvedCredentials);
2485
2486
  await login_default({
2486
2487
  timeoutMs: timeoutSeconds * 1e3,
2487
2488
  credentials: pkceCredentials
2488
2489
  });
2489
2490
  const user = await getLoggedInUser();
2490
- context.eventEmission.emit(
2491
+ sdk2.context.eventEmission.emit(
2491
2492
  "platform.sdk.ApplicationLifecycleEvent",
2492
2493
  buildApplicationLifecycleEvent(
2493
2494
  { lifecycle_event_type: "login_success" },
@@ -2533,11 +2534,11 @@ var McpSchema = z.object({
2533
2534
  }).describe("Start MCP server for Zapier SDK");
2534
2535
 
2535
2536
  // src/plugins/mcp/index.ts
2536
- var mcpPlugin = ({ context }) => {
2537
+ var mcpPlugin = (sdk2) => {
2537
2538
  const mcpWithSdk = createFunction(async function mcpWithSdk2(options) {
2538
2539
  const mcpOptions = {
2539
2540
  ...options,
2540
- debug: context.options.debug
2541
+ debug: sdk2.context.options?.debug
2541
2542
  };
2542
2543
  return await startMcpServer(mcpOptions);
2543
2544
  }, McpSchema);
@@ -2691,7 +2692,7 @@ async function detectTypesOutputDirectory() {
2691
2692
  }
2692
2693
  return "./zapier/apps/";
2693
2694
  }
2694
- var addPlugin = ({ sdk: sdk2 }) => {
2695
+ var addPlugin = (sdk2) => {
2695
2696
  const add = createFunction(async function add2(options) {
2696
2697
  const {
2697
2698
  apps: appKeys,
@@ -3402,7 +3403,7 @@ function createManifestEntry(app) {
3402
3403
  version: app.version
3403
3404
  };
3404
3405
  }
3405
- var generateAppTypesPlugin = ({ sdk: sdk2 }) => {
3406
+ var generateAppTypesPlugin = (sdk2) => {
3406
3407
  const generateAppTypes = createFunction(async function generateAppTypes2(options) {
3407
3408
  const {
3408
3409
  apps: appKeys,
@@ -3561,7 +3562,7 @@ var BuildManifestSchema = z.object({
3561
3562
  );
3562
3563
 
3563
3564
  // src/plugins/buildManifest/index.ts
3564
- var buildManifestPlugin = ({ sdk: sdk2, context }) => {
3565
+ var buildManifestPlugin = (sdk2) => {
3565
3566
  const buildManifest = createFunction(async function buildManifest2(options) {
3566
3567
  const {
3567
3568
  apps: appKeys,
@@ -3595,7 +3596,7 @@ var buildManifestPlugin = ({ sdk: sdk2, context }) => {
3595
3596
  manifestKey: manifestEntry.implementationName,
3596
3597
  version: manifestEntry.version || ""
3597
3598
  });
3598
- const { key: updatedManifestKey, manifest } = await context.updateManifestEntry({
3599
+ const { key: updatedManifestKey, manifest } = await sdk2.context.updateManifestEntry({
3599
3600
  appKey: app.key,
3600
3601
  entry: manifestEntry,
3601
3602
  configPath,
@@ -3674,10 +3675,8 @@ async function postWithRetry({
3674
3675
  }
3675
3676
  return response;
3676
3677
  }
3677
- var feedbackPlugin = ({
3678
- context
3679
- }) => {
3680
- const debug = context.options.debug;
3678
+ var feedbackPlugin = (sdk2) => {
3679
+ const debug = sdk2.context.options?.debug;
3681
3680
  const feedbackWithSdk = createFunction(async function feedback(options) {
3682
3681
  const user = await getLoggedInUser();
3683
3682
  const body = JSON.stringify({
@@ -3731,7 +3730,9 @@ var CurlSchema = z.object({
3731
3730
  fail: z.boolean().optional().describe("Fail silently on HTTP errors (exit code 22)"),
3732
3731
  failWithBody: z.boolean().optional().describe("Fail on HTTP errors but still output the body"),
3733
3732
  writeOut: z.string().optional().describe("Output format string after completion (e.g., '%{http_code}')"),
3734
- maxTime: z.number().optional().describe("Maximum time in seconds for the request"),
3733
+ maxTime: z.number().int().positive().optional().describe(
3734
+ "Maximum seconds to wait for a response. Honored on a best-effort basis; the server may silently enforce a lower ceiling."
3735
+ ),
3735
3736
  user: z.string().optional().describe("Basic auth credentials as 'user:password'"),
3736
3737
  compressed: z.boolean().optional().describe("Request compressed response (sends Accept-Encoding header)"),
3737
3738
  connection: z.union([z.string(), z.number()]).optional().describe("Zapier connection ID or alias for authentication"),
@@ -3880,9 +3881,7 @@ async function buildFormData(formArgs, formStringArgs) {
3880
3881
  }
3881
3882
 
3882
3883
  // src/plugins/curl/index.ts
3883
- var curlPlugin = ({
3884
- sdk: sdk2
3885
- }) => {
3884
+ var curlPlugin = (sdk2) => {
3886
3885
  async function curl(options) {
3887
3886
  const {
3888
3887
  url: rawUrl,
@@ -4014,15 +4013,14 @@ var curlPlugin = ({
4014
4013
  }
4015
4014
  process.stderr.write(">\n");
4016
4015
  }
4017
- const signal = maxTime ? AbortSignal.timeout(maxTime * 1e3) : void 0;
4018
4016
  const start = performance.now();
4019
4017
  const response = await sdk2.fetch(effectiveUrl.toString(), {
4020
4018
  method,
4021
4019
  headers,
4022
4020
  body,
4023
4021
  redirect,
4024
- signal,
4025
- connection
4022
+ connection,
4023
+ maxTime
4026
4024
  });
4027
4025
  const timeTotalSeconds = (performance.now() - start) / 1e3;
4028
4026
  if (verbose && !silent) {
@@ -4129,16 +4127,19 @@ ${Array.from(
4129
4127
  };
4130
4128
 
4131
4129
  // src/plugins/cliOverrides/index.ts
4132
- var cliOverridesPlugin = ({ context }) => {
4133
- if (!context.meta.fetch) {
4130
+ var cliOverridesPlugin = (sdk2) => {
4131
+ if (!sdk2.context.meta.fetch) {
4134
4132
  return { context: { meta: {} } };
4135
4133
  }
4136
4134
  return {
4137
4135
  context: {
4138
4136
  meta: {
4139
4137
  fetch: {
4140
- ...context.meta.fetch,
4141
- categories: [...context.meta.fetch.categories || [], "deprecated"],
4138
+ ...sdk2.context.meta.fetch,
4139
+ categories: [
4140
+ ...sdk2.context.meta.fetch.categories || [],
4141
+ "deprecated"
4142
+ ],
4142
4143
  deprecation: {
4143
4144
  message: "This command is deprecated and will be removed soon. Use `curl` instead. Learn more: https://docs.zapier.com/sdk/cli-reference#curl"
4144
4145
  }
@@ -4658,7 +4659,7 @@ function createZapierCliSdk(options = {}) {
4658
4659
  // package.json with { type: 'json' }
4659
4660
  var package_default2 = {
4660
4661
  name: "@zapier/zapier-sdk-cli",
4661
- version: "0.39.11"};
4662
+ version: "0.40.1"};
4662
4663
  var ONE_DAY_MS = 24 * 60 * 60 * 1e3;
4663
4664
  var CACHE_RESET_INTERVAL_MS = (() => {
4664
4665
  const { ZAPIER_SDK_UPDATE_CHECK_INTERVAL_MS = `${ONE_DAY_MS}` } = process.env;
@@ -4918,7 +4919,7 @@ program.exitOverride();
4918
4919
  }
4919
4920
  }
4920
4921
  await versionCheckPromise;
4921
- await sdk.getContext().eventEmission.close(exitCode);
4922
+ await sdk.context.eventEmission.close(exitCode);
4922
4923
  const exitTimeout = setTimeout(
4923
4924
  () => process.exit(exitCode),
4924
4925
  EXIT_GRACE_PERIOD_MS
package/dist/index.cjs CHANGED
@@ -354,22 +354,20 @@ function toPkceCredentials(credentials) {
354
354
  }
355
355
  return void 0;
356
356
  }
357
- var loginPlugin = ({
358
- context
359
- }) => {
357
+ var loginPlugin = (sdk) => {
360
358
  const loginFn = async (options) => {
361
359
  const timeoutSeconds = options.timeout ? parseInt(options.timeout, 10) : 300;
362
360
  if (isNaN(timeoutSeconds) || timeoutSeconds <= 0) {
363
361
  throw new Error("Timeout must be a positive number");
364
362
  }
365
- const resolvedCredentials = await context.resolveCredentials();
363
+ const resolvedCredentials = await sdk.context.resolveCredentials();
366
364
  const pkceCredentials = toPkceCredentials(resolvedCredentials);
367
365
  await login_default({
368
366
  timeoutMs: timeoutSeconds * 1e3,
369
367
  credentials: pkceCredentials
370
368
  });
371
369
  const user = await cliLogin.getLoggedInUser();
372
- context.eventEmission.emit(
370
+ sdk.context.eventEmission.emit(
373
371
  "platform.sdk.ApplicationLifecycleEvent",
374
372
  zapierSdk.buildApplicationLifecycleEvent(
375
373
  { lifecycle_event_type: "login_success" },
@@ -415,11 +413,11 @@ var McpSchema = zod.z.object({
415
413
  }).describe("Start MCP server for Zapier SDK");
416
414
 
417
415
  // src/plugins/mcp/index.ts
418
- var mcpPlugin = ({ context }) => {
416
+ var mcpPlugin = (sdk) => {
419
417
  const mcpWithSdk = zapierSdk.createFunction(async function mcpWithSdk2(options) {
420
418
  const mcpOptions = {
421
419
  ...options,
422
- debug: context.options.debug
420
+ debug: sdk.context.options?.debug
423
421
  };
424
422
  return await zapierSdkMcp.startMcpServer(mcpOptions);
425
423
  }, McpSchema);
@@ -573,7 +571,7 @@ async function detectTypesOutputDirectory() {
573
571
  }
574
572
  return "./zapier/apps/";
575
573
  }
576
- var addPlugin = ({ sdk }) => {
574
+ var addPlugin = (sdk) => {
577
575
  const add = zapierSdk.createFunction(async function add2(options) {
578
576
  const {
579
577
  apps: appKeys,
@@ -1284,7 +1282,7 @@ function createManifestEntry(app) {
1284
1282
  version: app.version
1285
1283
  };
1286
1284
  }
1287
- var generateAppTypesPlugin = ({ sdk }) => {
1285
+ var generateAppTypesPlugin = (sdk) => {
1288
1286
  const generateAppTypes = zapierSdk.createFunction(async function generateAppTypes2(options) {
1289
1287
  const {
1290
1288
  apps: appKeys,
@@ -1443,7 +1441,7 @@ var BuildManifestSchema = zod.z.object({
1443
1441
  );
1444
1442
 
1445
1443
  // src/plugins/buildManifest/index.ts
1446
- var buildManifestPlugin = ({ sdk, context }) => {
1444
+ var buildManifestPlugin = (sdk) => {
1447
1445
  const buildManifest = zapierSdk.createFunction(async function buildManifest2(options) {
1448
1446
  const {
1449
1447
  apps: appKeys,
@@ -1477,7 +1475,7 @@ var buildManifestPlugin = ({ sdk, context }) => {
1477
1475
  manifestKey: manifestEntry.implementationName,
1478
1476
  version: manifestEntry.version || ""
1479
1477
  });
1480
- const { key: updatedManifestKey, manifest } = await context.updateManifestEntry({
1478
+ const { key: updatedManifestKey, manifest } = await sdk.context.updateManifestEntry({
1481
1479
  appKey: app.key,
1482
1480
  entry: manifestEntry,
1483
1481
  configPath,
@@ -1556,10 +1554,8 @@ async function postWithRetry({
1556
1554
  }
1557
1555
  return response;
1558
1556
  }
1559
- var feedbackPlugin = ({
1560
- context
1561
- }) => {
1562
- const debug = context.options.debug;
1557
+ var feedbackPlugin = (sdk) => {
1558
+ const debug = sdk.context.options?.debug;
1563
1559
  const feedbackWithSdk = zapierSdk.createFunction(async function feedback(options) {
1564
1560
  const user = await cliLogin.getLoggedInUser();
1565
1561
  const body = JSON.stringify({
@@ -1613,7 +1609,9 @@ var CurlSchema = zod.z.object({
1613
1609
  fail: zod.z.boolean().optional().describe("Fail silently on HTTP errors (exit code 22)"),
1614
1610
  failWithBody: zod.z.boolean().optional().describe("Fail on HTTP errors but still output the body"),
1615
1611
  writeOut: zod.z.string().optional().describe("Output format string after completion (e.g., '%{http_code}')"),
1616
- maxTime: zod.z.number().optional().describe("Maximum time in seconds for the request"),
1612
+ maxTime: zod.z.number().int().positive().optional().describe(
1613
+ "Maximum seconds to wait for a response. Honored on a best-effort basis; the server may silently enforce a lower ceiling."
1614
+ ),
1617
1615
  user: zod.z.string().optional().describe("Basic auth credentials as 'user:password'"),
1618
1616
  compressed: zod.z.boolean().optional().describe("Request compressed response (sends Accept-Encoding header)"),
1619
1617
  connection: zod.z.union([zod.z.string(), zod.z.number()]).optional().describe("Zapier connection ID or alias for authentication"),
@@ -1762,9 +1760,7 @@ async function buildFormData(formArgs, formStringArgs) {
1762
1760
  }
1763
1761
 
1764
1762
  // src/plugins/curl/index.ts
1765
- var curlPlugin = ({
1766
- sdk
1767
- }) => {
1763
+ var curlPlugin = (sdk) => {
1768
1764
  async function curl(options) {
1769
1765
  const {
1770
1766
  url: rawUrl,
@@ -1896,15 +1892,14 @@ var curlPlugin = ({
1896
1892
  }
1897
1893
  process.stderr.write(">\n");
1898
1894
  }
1899
- const signal = maxTime ? AbortSignal.timeout(maxTime * 1e3) : void 0;
1900
1895
  const start = performance.now();
1901
1896
  const response = await sdk.fetch(effectiveUrl.toString(), {
1902
1897
  method,
1903
1898
  headers,
1904
1899
  body,
1905
1900
  redirect,
1906
- signal,
1907
- connection
1901
+ connection,
1902
+ maxTime
1908
1903
  });
1909
1904
  const timeTotalSeconds = (performance.now() - start) / 1e3;
1910
1905
  if (verbose && !silent) {
@@ -2011,16 +2006,19 @@ ${Array.from(
2011
2006
  };
2012
2007
 
2013
2008
  // src/plugins/cliOverrides/index.ts
2014
- var cliOverridesPlugin = ({ context }) => {
2015
- if (!context.meta.fetch) {
2009
+ var cliOverridesPlugin = (sdk) => {
2010
+ if (!sdk.context.meta.fetch) {
2016
2011
  return { context: { meta: {} } };
2017
2012
  }
2018
2013
  return {
2019
2014
  context: {
2020
2015
  meta: {
2021
2016
  fetch: {
2022
- ...context.meta.fetch,
2023
- categories: [...context.meta.fetch.categories || [], "deprecated"],
2017
+ ...sdk.context.meta.fetch,
2018
+ categories: [
2019
+ ...sdk.context.meta.fetch.categories || [],
2020
+ "deprecated"
2021
+ ],
2024
2022
  deprecation: {
2025
2023
  message: "This command is deprecated and will be removed soon. Use `curl` instead. Learn more: https://docs.zapier.com/sdk/cli-reference#curl"
2026
2024
  }
@@ -2512,7 +2510,7 @@ function createZapierCliSdk(options = {}) {
2512
2510
 
2513
2511
  // package.json
2514
2512
  var package_default = {
2515
- version: "0.39.11"};
2513
+ version: "0.40.1"};
2516
2514
 
2517
2515
  // src/telemetry/builders.ts
2518
2516
  function createCliBaseEvent(context = {}) {