@zapier/zapier-sdk-cli 0.40.0 → 0.41.0

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 (35) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/cli.cjs +29 -29
  3. package/dist/cli.mjs +29 -29
  4. package/dist/index.cjs +20 -23
  5. package/dist/index.d.mts +2 -3
  6. package/dist/index.d.ts +2 -3
  7. package/dist/index.mjs +20 -23
  8. package/dist/package.json +1 -1
  9. package/dist/src/cli.js +3 -3
  10. package/dist/src/generators/ast-generator.d.ts +2 -2
  11. package/dist/src/plugins/add/index.d.ts +2 -2
  12. package/dist/src/plugins/add/index.js +1 -1
  13. package/dist/src/plugins/buildManifest/index.d.ts +2 -2
  14. package/dist/src/plugins/buildManifest/index.js +2 -2
  15. package/dist/src/plugins/bundleCode/index.d.ts +0 -1
  16. package/dist/src/plugins/cliOverrides/index.d.ts +5 -3
  17. package/dist/src/plugins/cliOverrides/index.js +7 -4
  18. package/dist/src/plugins/curl/index.d.ts +1 -1
  19. package/dist/src/plugins/curl/index.js +1 -1
  20. package/dist/src/plugins/feedback/index.d.ts +7 -1
  21. package/dist/src/plugins/feedback/index.js +2 -2
  22. package/dist/src/plugins/generateAppTypes/index.d.ts +2 -2
  23. package/dist/src/plugins/generateAppTypes/index.js +1 -1
  24. package/dist/src/plugins/getLoginConfigPath/index.d.ts +0 -1
  25. package/dist/src/plugins/init/index.d.ts +1 -1
  26. package/dist/src/plugins/login/index.d.ts +5 -3
  27. package/dist/src/plugins/login/index.js +3 -3
  28. package/dist/src/plugins/logout/index.d.ts +1 -1
  29. package/dist/src/plugins/mcp/index.d.ts +7 -1
  30. package/dist/src/plugins/mcp/index.js +2 -2
  31. package/dist/src/types/sdk.d.ts +2 -3
  32. package/dist/src/utils/cli-generator.js +1 -3
  33. package/dist/src/utils/parameter-resolver.js +1 -1
  34. package/dist/tsconfig.tsbuildinfo +1 -1
  35. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @zapier/zapier-sdk-cli
2
2
 
3
+ ## 0.41.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 8df8761: Add an experimental interactive approval flow for policy-gated actions. When an action requires approval, the SDK detects the `approval_required` response, prompts for approval in interactive sessions, and automatically retries the original request once approved. Non-interactive sessions receive a clear error explaining that approval is required. This flow is experimental and its behavior may change in future releases.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [8df8761]
12
+ - @zapier/zapier-sdk-mcp@0.11.0
13
+ - @zapier/zapier-sdk@0.43.0
14
+
15
+ ## 0.40.1
16
+
17
+ ### Patch Changes
18
+
19
+ - 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.
20
+ - Updated dependencies [707c57a]
21
+ - @zapier/zapier-sdk@0.42.1
22
+ - @zapier/zapier-sdk-mcp@0.10.15
23
+
3
24
  ## 0.40.0
4
25
 
5
26
  ### Minor Changes
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.40.0"};
1106
+ version: "0.41.0"};
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({
@@ -3920,9 +3919,7 @@ async function buildFormData(formArgs, formStringArgs) {
3920
3919
  }
3921
3920
 
3922
3921
  // src/plugins/curl/index.ts
3923
- var curlPlugin = ({
3924
- sdk: sdk2
3925
- }) => {
3922
+ var curlPlugin = (sdk2) => {
3926
3923
  async function curl(options) {
3927
3924
  const {
3928
3925
  url: rawUrl,
@@ -4168,16 +4165,19 @@ ${Array.from(
4168
4165
  };
4169
4166
 
4170
4167
  // src/plugins/cliOverrides/index.ts
4171
- var cliOverridesPlugin = ({ context }) => {
4172
- if (!context.meta.fetch) {
4168
+ var cliOverridesPlugin = (sdk2) => {
4169
+ if (!sdk2.context.meta.fetch) {
4173
4170
  return { context: { meta: {} } };
4174
4171
  }
4175
4172
  return {
4176
4173
  context: {
4177
4174
  meta: {
4178
4175
  fetch: {
4179
- ...context.meta.fetch,
4180
- categories: [...context.meta.fetch.categories || [], "deprecated"],
4176
+ ...sdk2.context.meta.fetch,
4177
+ categories: [
4178
+ ...sdk2.context.meta.fetch.categories || [],
4179
+ "deprecated"
4180
+ ],
4181
4181
  deprecation: {
4182
4182
  message: "This command is deprecated and will be removed soon. Use `curl` instead. Learn more: https://docs.zapier.com/sdk/cli-reference#curl"
4183
4183
  }
@@ -4697,7 +4697,7 @@ function createZapierCliSdk(options = {}) {
4697
4697
  // package.json with { type: 'json' }
4698
4698
  var package_default2 = {
4699
4699
  name: "@zapier/zapier-sdk-cli",
4700
- version: "0.40.0"};
4700
+ version: "0.41.0"};
4701
4701
  var ONE_DAY_MS = 24 * 60 * 60 * 1e3;
4702
4702
  var CACHE_RESET_INTERVAL_MS = (() => {
4703
4703
  const { ZAPIER_SDK_UPDATE_CHECK_INTERVAL_MS = `${ONE_DAY_MS}` } = process.env;
@@ -4908,13 +4908,13 @@ function buildCredentialsFromFlags() {
4908
4908
  type: "client_credentials",
4909
4909
  clientId: credentialsClientId,
4910
4910
  clientSecret: credentialsClientSecret,
4911
- baseUrl: credentialsBaseUrl
4911
+ ...credentialsBaseUrl && { baseUrl: credentialsBaseUrl }
4912
4912
  };
4913
4913
  } else {
4914
4914
  return {
4915
4915
  type: "pkce",
4916
4916
  clientId: credentialsClientId,
4917
- baseUrl: credentialsBaseUrl
4917
+ ...credentialsBaseUrl && { baseUrl: credentialsBaseUrl }
4918
4918
  };
4919
4919
  }
4920
4920
  }
@@ -4957,7 +4957,7 @@ program.exitOverride();
4957
4957
  }
4958
4958
  }
4959
4959
  await versionCheckPromise;
4960
- await sdk.getContext().eventEmission.close(exitCode);
4960
+ await sdk.context.eventEmission.close(exitCode);
4961
4961
  const exitTimeout = setTimeout(
4962
4962
  () => process.exit(exitCode),
4963
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.40.0"};
1068
+ version: "0.41.0"};
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({
@@ -3882,9 +3881,7 @@ async function buildFormData(formArgs, formStringArgs) {
3882
3881
  }
3883
3882
 
3884
3883
  // src/plugins/curl/index.ts
3885
- var curlPlugin = ({
3886
- sdk: sdk2
3887
- }) => {
3884
+ var curlPlugin = (sdk2) => {
3888
3885
  async function curl(options) {
3889
3886
  const {
3890
3887
  url: rawUrl,
@@ -4130,16 +4127,19 @@ ${Array.from(
4130
4127
  };
4131
4128
 
4132
4129
  // src/plugins/cliOverrides/index.ts
4133
- var cliOverridesPlugin = ({ context }) => {
4134
- if (!context.meta.fetch) {
4130
+ var cliOverridesPlugin = (sdk2) => {
4131
+ if (!sdk2.context.meta.fetch) {
4135
4132
  return { context: { meta: {} } };
4136
4133
  }
4137
4134
  return {
4138
4135
  context: {
4139
4136
  meta: {
4140
4137
  fetch: {
4141
- ...context.meta.fetch,
4142
- categories: [...context.meta.fetch.categories || [], "deprecated"],
4138
+ ...sdk2.context.meta.fetch,
4139
+ categories: [
4140
+ ...sdk2.context.meta.fetch.categories || [],
4141
+ "deprecated"
4142
+ ],
4143
4143
  deprecation: {
4144
4144
  message: "This command is deprecated and will be removed soon. Use `curl` instead. Learn more: https://docs.zapier.com/sdk/cli-reference#curl"
4145
4145
  }
@@ -4659,7 +4659,7 @@ function createZapierCliSdk(options = {}) {
4659
4659
  // package.json with { type: 'json' }
4660
4660
  var package_default2 = {
4661
4661
  name: "@zapier/zapier-sdk-cli",
4662
- version: "0.40.0"};
4662
+ version: "0.41.0"};
4663
4663
  var ONE_DAY_MS = 24 * 60 * 60 * 1e3;
4664
4664
  var CACHE_RESET_INTERVAL_MS = (() => {
4665
4665
  const { ZAPIER_SDK_UPDATE_CHECK_INTERVAL_MS = `${ONE_DAY_MS}` } = process.env;
@@ -4870,13 +4870,13 @@ function buildCredentialsFromFlags() {
4870
4870
  type: "client_credentials",
4871
4871
  clientId: credentialsClientId,
4872
4872
  clientSecret: credentialsClientSecret,
4873
- baseUrl: credentialsBaseUrl
4873
+ ...credentialsBaseUrl && { baseUrl: credentialsBaseUrl }
4874
4874
  };
4875
4875
  } else {
4876
4876
  return {
4877
4877
  type: "pkce",
4878
4878
  clientId: credentialsClientId,
4879
- baseUrl: credentialsBaseUrl
4879
+ ...credentialsBaseUrl && { baseUrl: credentialsBaseUrl }
4880
4880
  };
4881
4881
  }
4882
4882
  }
@@ -4919,7 +4919,7 @@ program.exitOverride();
4919
4919
  }
4920
4920
  }
4921
4921
  await versionCheckPromise;
4922
- await sdk.getContext().eventEmission.close(exitCode);
4922
+ await sdk.context.eventEmission.close(exitCode);
4923
4923
  const exitTimeout = setTimeout(
4924
4924
  () => process.exit(exitCode),
4925
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({
@@ -1764,9 +1760,7 @@ async function buildFormData(formArgs, formStringArgs) {
1764
1760
  }
1765
1761
 
1766
1762
  // src/plugins/curl/index.ts
1767
- var curlPlugin = ({
1768
- sdk
1769
- }) => {
1763
+ var curlPlugin = (sdk) => {
1770
1764
  async function curl(options) {
1771
1765
  const {
1772
1766
  url: rawUrl,
@@ -2012,16 +2006,19 @@ ${Array.from(
2012
2006
  };
2013
2007
 
2014
2008
  // src/plugins/cliOverrides/index.ts
2015
- var cliOverridesPlugin = ({ context }) => {
2016
- if (!context.meta.fetch) {
2009
+ var cliOverridesPlugin = (sdk) => {
2010
+ if (!sdk.context.meta.fetch) {
2017
2011
  return { context: { meta: {} } };
2018
2012
  }
2019
2013
  return {
2020
2014
  context: {
2021
2015
  meta: {
2022
2016
  fetch: {
2023
- ...context.meta.fetch,
2024
- categories: [...context.meta.fetch.categories || [], "deprecated"],
2017
+ ...sdk.context.meta.fetch,
2018
+ categories: [
2019
+ ...sdk.context.meta.fetch.categories || [],
2020
+ "deprecated"
2021
+ ],
2025
2022
  deprecation: {
2026
2023
  message: "This command is deprecated and will be removed soon. Use `curl` instead. Learn more: https://docs.zapier.com/sdk/cli-reference#curl"
2027
2024
  }
@@ -2513,7 +2510,7 @@ function createZapierCliSdk(options = {}) {
2513
2510
 
2514
2511
  // package.json
2515
2512
  var package_default = {
2516
- version: "0.40.0"};
2513
+ version: "0.41.0"};
2517
2514
 
2518
2515
  // src/telemetry/builders.ts
2519
2516
  function createCliBaseEvent(context = {}) {
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { AppItem, Manifest, GetSdkType, ZapierSdk, ZapierSdkOptions, BaseEvent } from '@zapier/zapier-sdk';
1
+ import { AppItem, Manifest, ZapierSdk, ZapierSdkOptions, BaseEvent } from '@zapier/zapier-sdk';
2
2
  import { z } from 'zod';
3
3
 
4
4
  declare const BuildManifestSchema: z.ZodObject<{
@@ -139,8 +139,7 @@ interface GenerateAppTypesPluginProvides {
139
139
  };
140
140
  }
141
141
 
142
- interface ZapierSdkCli extends GetSdkType<ZapierSdk & BuildManifestPluginProvides & FeedbackPluginProvides & GenerateAppTypesPluginProvides> {
143
- }
142
+ type ZapierSdkCli = ZapierSdk & BuildManifestPluginProvides & FeedbackPluginProvides & GenerateAppTypesPluginProvides;
144
143
 
145
144
  interface ZapierCliSdkOptions extends ZapierSdkOptions {
146
145
  }
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { AppItem, Manifest, GetSdkType, ZapierSdk, ZapierSdkOptions, BaseEvent } from '@zapier/zapier-sdk';
1
+ import { AppItem, Manifest, ZapierSdk, ZapierSdkOptions, BaseEvent } from '@zapier/zapier-sdk';
2
2
  import { z } from 'zod';
3
3
 
4
4
  declare const BuildManifestSchema: z.ZodObject<{
@@ -139,8 +139,7 @@ interface GenerateAppTypesPluginProvides {
139
139
  };
140
140
  }
141
141
 
142
- interface ZapierSdkCli extends GetSdkType<ZapierSdk & BuildManifestPluginProvides & FeedbackPluginProvides & GenerateAppTypesPluginProvides> {
143
- }
142
+ type ZapierSdkCli = ZapierSdk & BuildManifestPluginProvides & FeedbackPluginProvides & GenerateAppTypesPluginProvides;
144
143
 
145
144
  interface ZapierCliSdkOptions extends ZapierSdkOptions {
146
145
  }
package/dist/index.mjs CHANGED
@@ -321,22 +321,20 @@ function toPkceCredentials(credentials) {
321
321
  }
322
322
  return void 0;
323
323
  }
324
- var loginPlugin = ({
325
- context
326
- }) => {
324
+ var loginPlugin = (sdk) => {
327
325
  const loginFn = async (options) => {
328
326
  const timeoutSeconds = options.timeout ? parseInt(options.timeout, 10) : 300;
329
327
  if (isNaN(timeoutSeconds) || timeoutSeconds <= 0) {
330
328
  throw new Error("Timeout must be a positive number");
331
329
  }
332
- const resolvedCredentials = await context.resolveCredentials();
330
+ const resolvedCredentials = await sdk.context.resolveCredentials();
333
331
  const pkceCredentials = toPkceCredentials(resolvedCredentials);
334
332
  await login_default({
335
333
  timeoutMs: timeoutSeconds * 1e3,
336
334
  credentials: pkceCredentials
337
335
  });
338
336
  const user = await getLoggedInUser();
339
- context.eventEmission.emit(
337
+ sdk.context.eventEmission.emit(
340
338
  "platform.sdk.ApplicationLifecycleEvent",
341
339
  buildApplicationLifecycleEvent(
342
340
  { lifecycle_event_type: "login_success" },
@@ -382,11 +380,11 @@ var McpSchema = z.object({
382
380
  }).describe("Start MCP server for Zapier SDK");
383
381
 
384
382
  // src/plugins/mcp/index.ts
385
- var mcpPlugin = ({ context }) => {
383
+ var mcpPlugin = (sdk) => {
386
384
  const mcpWithSdk = createFunction(async function mcpWithSdk2(options) {
387
385
  const mcpOptions = {
388
386
  ...options,
389
- debug: context.options.debug
387
+ debug: sdk.context.options?.debug
390
388
  };
391
389
  return await startMcpServer(mcpOptions);
392
390
  }, McpSchema);
@@ -540,7 +538,7 @@ async function detectTypesOutputDirectory() {
540
538
  }
541
539
  return "./zapier/apps/";
542
540
  }
543
- var addPlugin = ({ sdk }) => {
541
+ var addPlugin = (sdk) => {
544
542
  const add = createFunction(async function add2(options) {
545
543
  const {
546
544
  apps: appKeys,
@@ -1251,7 +1249,7 @@ function createManifestEntry(app) {
1251
1249
  version: app.version
1252
1250
  };
1253
1251
  }
1254
- var generateAppTypesPlugin = ({ sdk }) => {
1252
+ var generateAppTypesPlugin = (sdk) => {
1255
1253
  const generateAppTypes = createFunction(async function generateAppTypes2(options) {
1256
1254
  const {
1257
1255
  apps: appKeys,
@@ -1410,7 +1408,7 @@ var BuildManifestSchema = z.object({
1410
1408
  );
1411
1409
 
1412
1410
  // src/plugins/buildManifest/index.ts
1413
- var buildManifestPlugin = ({ sdk, context }) => {
1411
+ var buildManifestPlugin = (sdk) => {
1414
1412
  const buildManifest = createFunction(async function buildManifest2(options) {
1415
1413
  const {
1416
1414
  apps: appKeys,
@@ -1444,7 +1442,7 @@ var buildManifestPlugin = ({ sdk, context }) => {
1444
1442
  manifestKey: manifestEntry.implementationName,
1445
1443
  version: manifestEntry.version || ""
1446
1444
  });
1447
- const { key: updatedManifestKey, manifest } = await context.updateManifestEntry({
1445
+ const { key: updatedManifestKey, manifest } = await sdk.context.updateManifestEntry({
1448
1446
  appKey: app.key,
1449
1447
  entry: manifestEntry,
1450
1448
  configPath,
@@ -1523,10 +1521,8 @@ async function postWithRetry({
1523
1521
  }
1524
1522
  return response;
1525
1523
  }
1526
- var feedbackPlugin = ({
1527
- context
1528
- }) => {
1529
- const debug = context.options.debug;
1524
+ var feedbackPlugin = (sdk) => {
1525
+ const debug = sdk.context.options?.debug;
1530
1526
  const feedbackWithSdk = createFunction(async function feedback(options) {
1531
1527
  const user = await getLoggedInUser();
1532
1528
  const body = JSON.stringify({
@@ -1731,9 +1727,7 @@ async function buildFormData(formArgs, formStringArgs) {
1731
1727
  }
1732
1728
 
1733
1729
  // src/plugins/curl/index.ts
1734
- var curlPlugin = ({
1735
- sdk
1736
- }) => {
1730
+ var curlPlugin = (sdk) => {
1737
1731
  async function curl(options) {
1738
1732
  const {
1739
1733
  url: rawUrl,
@@ -1979,16 +1973,19 @@ ${Array.from(
1979
1973
  };
1980
1974
 
1981
1975
  // src/plugins/cliOverrides/index.ts
1982
- var cliOverridesPlugin = ({ context }) => {
1983
- if (!context.meta.fetch) {
1976
+ var cliOverridesPlugin = (sdk) => {
1977
+ if (!sdk.context.meta.fetch) {
1984
1978
  return { context: { meta: {} } };
1985
1979
  }
1986
1980
  return {
1987
1981
  context: {
1988
1982
  meta: {
1989
1983
  fetch: {
1990
- ...context.meta.fetch,
1991
- categories: [...context.meta.fetch.categories || [], "deprecated"],
1984
+ ...sdk.context.meta.fetch,
1985
+ categories: [
1986
+ ...sdk.context.meta.fetch.categories || [],
1987
+ "deprecated"
1988
+ ],
1992
1989
  deprecation: {
1993
1990
  message: "This command is deprecated and will be removed soon. Use `curl` instead. Learn more: https://docs.zapier.com/sdk/cli-reference#curl"
1994
1991
  }
@@ -2480,7 +2477,7 @@ function createZapierCliSdk(options = {}) {
2480
2477
 
2481
2478
  // package.json
2482
2479
  var package_default = {
2483
- version: "0.40.0"};
2480
+ version: "0.41.0"};
2484
2481
 
2485
2482
  // src/telemetry/builders.ts
2486
2483
  function createCliBaseEvent(context = {}) {