@zapier/zapier-sdk-cli 0.13.11 → 0.13.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @zapier/zapier-sdk-cli
2
2
 
3
+ ## 0.13.13
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [3f2f104]
8
+ - @zapier/zapier-sdk@0.14.0
9
+ - @zapier/zapier-sdk-mcp@0.3.23
10
+
11
+ ## 0.13.12
12
+
13
+ ### Patch Changes
14
+
15
+ - 492e2f9: - Add new `batch` utility method to handle concurency limits, retries, timeouts and exponential backoffs.
16
+ - Refactor `generateAppTypes` in CLI to use the new `batch` utility
17
+ - Updated dependencies [492e2f9]
18
+ - @zapier/zapier-sdk@0.13.9
19
+ - @zapier/zapier-sdk-mcp@0.3.22
20
+
3
21
  ## 0.13.11
4
22
 
5
23
  ### Patch Changes
package/dist/cli.cjs CHANGED
@@ -1410,7 +1410,7 @@ var LoginSchema = zod.z.object({
1410
1410
 
1411
1411
  // package.json
1412
1412
  var package_default = {
1413
- version: "0.13.11"};
1413
+ version: "0.13.13"};
1414
1414
 
1415
1415
  // src/telemetry/builders.ts
1416
1416
  function createCliBaseEvent(context = {}) {
@@ -1861,44 +1861,56 @@ var AstTypeGenerator = class {
1861
1861
  });
1862
1862
  const actions = actionsResult.data;
1863
1863
  const actionsWithFields = [];
1864
- if (authenticationId) {
1865
- for (const action of actions) {
1866
- try {
1867
- const fieldsResult = await sdk2.listInputFields({
1868
- appKey: app.implementation_id,
1869
- actionKey: action.key,
1870
- actionType: action.action_type,
1871
- authenticationId
1872
- });
1873
- const fields = fieldsResult.data;
1874
- actionsWithFields.push({
1875
- ...action,
1876
- inputFields: fields,
1877
- name: action.title || action.key
1878
- });
1879
- } catch {
1880
- actionsWithFields.push({
1881
- ...action,
1882
- inputFields: [],
1883
- name: action.title || action.key
1884
- });
1885
- }
1864
+ const inputFieldsTasks = actions.map(
1865
+ (action) => () => sdk2.listInputFields({
1866
+ appKey: app.implementation_id,
1867
+ actionKey: action.key,
1868
+ actionType: action.action_type,
1869
+ authenticationId
1870
+ })
1871
+ );
1872
+ const results = await zapierSdk.batch(inputFieldsTasks, {
1873
+ concurrency: 50,
1874
+ // Limit to 50 concurrent requests
1875
+ retry: true,
1876
+ // Automatically retry transient failures
1877
+ timeoutMs: 18e4,
1878
+ // 3 minute overall timeout
1879
+ taskTimeoutMs: 3e4
1880
+ // 30 seconds per-task timeout (API calls shouldn't take longer)
1881
+ });
1882
+ const failedActions = [];
1883
+ results.forEach((result, i) => {
1884
+ const action = actions[i];
1885
+ if (result.status === "fulfilled") {
1886
+ actionsWithFields.push({
1887
+ ...action,
1888
+ inputFields: result.value.data,
1889
+ name: action.title || action.key
1890
+ });
1891
+ } else {
1892
+ failedActions.push(
1893
+ `${action.key} (${action.action_type}): ${result.reason?.message || "Unknown error"}`
1894
+ );
1895
+ actionsWithFields.push({
1896
+ ...action,
1897
+ inputFields: [],
1898
+ name: action.title || action.key,
1899
+ app_key: action.app_key || app.implementation_id,
1900
+ action_type: action.action_type || "write",
1901
+ title: action.title || action.key,
1902
+ type: "action",
1903
+ description: action.description || ""
1904
+ });
1886
1905
  }
1887
- } else {
1888
- actions.forEach(
1889
- (action) => {
1890
- actionsWithFields.push({
1891
- ...action,
1892
- inputFields: [],
1893
- name: action.title || action.key,
1894
- app_key: action.app_key || app.implementation_id,
1895
- action_type: action.action_type || "write",
1896
- title: action.title || action.key,
1897
- type: "action",
1898
- description: action.description || ""
1899
- });
1900
- }
1906
+ });
1907
+ if (failedActions.length > 0) {
1908
+ console.warn(
1909
+ `Failed to fetch input fields for ${failedActions.length} action(s):`
1901
1910
  );
1911
+ failedActions.forEach((failedAction) => {
1912
+ console.warn(` - ${failedAction}`);
1913
+ });
1902
1914
  }
1903
1915
  const sourceFile = this.createSourceFile(app, actionsWithFields);
1904
1916
  return this.printer.printFile(sourceFile);
@@ -2670,7 +2682,7 @@ function createZapierCliSdk(options = {}) {
2670
2682
 
2671
2683
  // package.json with { type: 'json' }
2672
2684
  var package_default2 = {
2673
- version: "0.13.11"};
2685
+ version: "0.13.13"};
2674
2686
 
2675
2687
  // src/cli.ts
2676
2688
  var program = new commander.Command();
package/dist/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { Command } from 'commander';
3
3
  import { z } from 'zod';
4
- import { createFunction, OutputPropertySchema, DEFAULT_CONFIG_PATH, createZapierSdkWithoutRegistry, registryPlugin, ZapierValidationError, ZapierUnknownError, toSnakeCase, ZapierError, formatErrorMessage, getOsInfo, getPlatformVersions, getCiPlatform, isCi, isPositional, getReleaseId, getCurrentTimestamp, generateEventId } from '@zapier/zapier-sdk';
4
+ import { createFunction, OutputPropertySchema, DEFAULT_CONFIG_PATH, createZapierSdkWithoutRegistry, registryPlugin, ZapierValidationError, ZapierUnknownError, batch, toSnakeCase, ZapierError, formatErrorMessage, getOsInfo, getPlatformVersions, getCiPlatform, isCi, isPositional, getReleaseId, getCurrentTimestamp, generateEventId } from '@zapier/zapier-sdk';
5
5
  import inquirer from 'inquirer';
6
6
  import chalk3 from 'chalk';
7
7
  import util from 'util';
@@ -1377,7 +1377,7 @@ var LoginSchema = z.object({
1377
1377
 
1378
1378
  // package.json
1379
1379
  var package_default = {
1380
- version: "0.13.11"};
1380
+ version: "0.13.13"};
1381
1381
 
1382
1382
  // src/telemetry/builders.ts
1383
1383
  function createCliBaseEvent(context = {}) {
@@ -1828,44 +1828,56 @@ var AstTypeGenerator = class {
1828
1828
  });
1829
1829
  const actions = actionsResult.data;
1830
1830
  const actionsWithFields = [];
1831
- if (authenticationId) {
1832
- for (const action of actions) {
1833
- try {
1834
- const fieldsResult = await sdk2.listInputFields({
1835
- appKey: app.implementation_id,
1836
- actionKey: action.key,
1837
- actionType: action.action_type,
1838
- authenticationId
1839
- });
1840
- const fields = fieldsResult.data;
1841
- actionsWithFields.push({
1842
- ...action,
1843
- inputFields: fields,
1844
- name: action.title || action.key
1845
- });
1846
- } catch {
1847
- actionsWithFields.push({
1848
- ...action,
1849
- inputFields: [],
1850
- name: action.title || action.key
1851
- });
1852
- }
1831
+ const inputFieldsTasks = actions.map(
1832
+ (action) => () => sdk2.listInputFields({
1833
+ appKey: app.implementation_id,
1834
+ actionKey: action.key,
1835
+ actionType: action.action_type,
1836
+ authenticationId
1837
+ })
1838
+ );
1839
+ const results = await batch(inputFieldsTasks, {
1840
+ concurrency: 50,
1841
+ // Limit to 50 concurrent requests
1842
+ retry: true,
1843
+ // Automatically retry transient failures
1844
+ timeoutMs: 18e4,
1845
+ // 3 minute overall timeout
1846
+ taskTimeoutMs: 3e4
1847
+ // 30 seconds per-task timeout (API calls shouldn't take longer)
1848
+ });
1849
+ const failedActions = [];
1850
+ results.forEach((result, i) => {
1851
+ const action = actions[i];
1852
+ if (result.status === "fulfilled") {
1853
+ actionsWithFields.push({
1854
+ ...action,
1855
+ inputFields: result.value.data,
1856
+ name: action.title || action.key
1857
+ });
1858
+ } else {
1859
+ failedActions.push(
1860
+ `${action.key} (${action.action_type}): ${result.reason?.message || "Unknown error"}`
1861
+ );
1862
+ actionsWithFields.push({
1863
+ ...action,
1864
+ inputFields: [],
1865
+ name: action.title || action.key,
1866
+ app_key: action.app_key || app.implementation_id,
1867
+ action_type: action.action_type || "write",
1868
+ title: action.title || action.key,
1869
+ type: "action",
1870
+ description: action.description || ""
1871
+ });
1853
1872
  }
1854
- } else {
1855
- actions.forEach(
1856
- (action) => {
1857
- actionsWithFields.push({
1858
- ...action,
1859
- inputFields: [],
1860
- name: action.title || action.key,
1861
- app_key: action.app_key || app.implementation_id,
1862
- action_type: action.action_type || "write",
1863
- title: action.title || action.key,
1864
- type: "action",
1865
- description: action.description || ""
1866
- });
1867
- }
1873
+ });
1874
+ if (failedActions.length > 0) {
1875
+ console.warn(
1876
+ `Failed to fetch input fields for ${failedActions.length} action(s):`
1868
1877
  );
1878
+ failedActions.forEach((failedAction) => {
1879
+ console.warn(` - ${failedAction}`);
1880
+ });
1869
1881
  }
1870
1882
  const sourceFile = this.createSourceFile(app, actionsWithFields);
1871
1883
  return this.printer.printFile(sourceFile);
@@ -2637,7 +2649,7 @@ function createZapierCliSdk(options = {}) {
2637
2649
 
2638
2650
  // package.json with { type: 'json' }
2639
2651
  var package_default2 = {
2640
- version: "0.13.11"};
2652
+ version: "0.13.13"};
2641
2653
 
2642
2654
  // src/cli.ts
2643
2655
  var program = new Command();
package/dist/index.cjs CHANGED
@@ -266,7 +266,7 @@ var LoginSchema = zod.z.object({
266
266
 
267
267
  // package.json
268
268
  var package_default = {
269
- version: "0.13.11"};
269
+ version: "0.13.13"};
270
270
 
271
271
  // src/telemetry/builders.ts
272
272
  function createCliBaseEvent(context = {}) {
@@ -717,44 +717,56 @@ var AstTypeGenerator = class {
717
717
  });
718
718
  const actions = actionsResult.data;
719
719
  const actionsWithFields = [];
720
- if (authenticationId) {
721
- for (const action of actions) {
722
- try {
723
- const fieldsResult = await sdk.listInputFields({
724
- appKey: app.implementation_id,
725
- actionKey: action.key,
726
- actionType: action.action_type,
727
- authenticationId
728
- });
729
- const fields = fieldsResult.data;
730
- actionsWithFields.push({
731
- ...action,
732
- inputFields: fields,
733
- name: action.title || action.key
734
- });
735
- } catch {
736
- actionsWithFields.push({
737
- ...action,
738
- inputFields: [],
739
- name: action.title || action.key
740
- });
741
- }
720
+ const inputFieldsTasks = actions.map(
721
+ (action) => () => sdk.listInputFields({
722
+ appKey: app.implementation_id,
723
+ actionKey: action.key,
724
+ actionType: action.action_type,
725
+ authenticationId
726
+ })
727
+ );
728
+ const results = await zapierSdk.batch(inputFieldsTasks, {
729
+ concurrency: 50,
730
+ // Limit to 50 concurrent requests
731
+ retry: true,
732
+ // Automatically retry transient failures
733
+ timeoutMs: 18e4,
734
+ // 3 minute overall timeout
735
+ taskTimeoutMs: 3e4
736
+ // 30 seconds per-task timeout (API calls shouldn't take longer)
737
+ });
738
+ const failedActions = [];
739
+ results.forEach((result, i) => {
740
+ const action = actions[i];
741
+ if (result.status === "fulfilled") {
742
+ actionsWithFields.push({
743
+ ...action,
744
+ inputFields: result.value.data,
745
+ name: action.title || action.key
746
+ });
747
+ } else {
748
+ failedActions.push(
749
+ `${action.key} (${action.action_type}): ${result.reason?.message || "Unknown error"}`
750
+ );
751
+ actionsWithFields.push({
752
+ ...action,
753
+ inputFields: [],
754
+ name: action.title || action.key,
755
+ app_key: action.app_key || app.implementation_id,
756
+ action_type: action.action_type || "write",
757
+ title: action.title || action.key,
758
+ type: "action",
759
+ description: action.description || ""
760
+ });
742
761
  }
743
- } else {
744
- actions.forEach(
745
- (action) => {
746
- actionsWithFields.push({
747
- ...action,
748
- inputFields: [],
749
- name: action.title || action.key,
750
- app_key: action.app_key || app.implementation_id,
751
- action_type: action.action_type || "write",
752
- title: action.title || action.key,
753
- type: "action",
754
- description: action.description || ""
755
- });
756
- }
762
+ });
763
+ if (failedActions.length > 0) {
764
+ console.warn(
765
+ `Failed to fetch input fields for ${failedActions.length} action(s):`
757
766
  );
767
+ failedActions.forEach((failedAction) => {
768
+ console.warn(` - ${failedAction}`);
769
+ });
758
770
  }
759
771
  const sourceFile = this.createSourceFile(app, actionsWithFields);
760
772
  return this.printer.printFile(sourceFile);
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { createFunction, OutputPropertySchema, DEFAULT_CONFIG_PATH, getOsInfo, getPlatformVersions, getCiPlatform, isCi, createZapierSdkWithoutRegistry, registryPlugin, getReleaseId, getCurrentTimestamp, generateEventId, ZapierValidationError, ZapierUnknownError, toSnakeCase } from '@zapier/zapier-sdk';
1
+ import { createFunction, OutputPropertySchema, DEFAULT_CONFIG_PATH, getOsInfo, getPlatformVersions, getCiPlatform, isCi, createZapierSdkWithoutRegistry, registryPlugin, getReleaseId, getCurrentTimestamp, generateEventId, ZapierValidationError, ZapierUnknownError, batch, toSnakeCase } from '@zapier/zapier-sdk';
2
2
  import open from 'open';
3
3
  import crypto from 'crypto';
4
4
  import express from 'express';
@@ -235,7 +235,7 @@ var LoginSchema = z.object({
235
235
 
236
236
  // package.json
237
237
  var package_default = {
238
- version: "0.13.11"};
238
+ version: "0.13.13"};
239
239
 
240
240
  // src/telemetry/builders.ts
241
241
  function createCliBaseEvent(context = {}) {
@@ -686,44 +686,56 @@ var AstTypeGenerator = class {
686
686
  });
687
687
  const actions = actionsResult.data;
688
688
  const actionsWithFields = [];
689
- if (authenticationId) {
690
- for (const action of actions) {
691
- try {
692
- const fieldsResult = await sdk.listInputFields({
693
- appKey: app.implementation_id,
694
- actionKey: action.key,
695
- actionType: action.action_type,
696
- authenticationId
697
- });
698
- const fields = fieldsResult.data;
699
- actionsWithFields.push({
700
- ...action,
701
- inputFields: fields,
702
- name: action.title || action.key
703
- });
704
- } catch {
705
- actionsWithFields.push({
706
- ...action,
707
- inputFields: [],
708
- name: action.title || action.key
709
- });
710
- }
689
+ const inputFieldsTasks = actions.map(
690
+ (action) => () => sdk.listInputFields({
691
+ appKey: app.implementation_id,
692
+ actionKey: action.key,
693
+ actionType: action.action_type,
694
+ authenticationId
695
+ })
696
+ );
697
+ const results = await batch(inputFieldsTasks, {
698
+ concurrency: 50,
699
+ // Limit to 50 concurrent requests
700
+ retry: true,
701
+ // Automatically retry transient failures
702
+ timeoutMs: 18e4,
703
+ // 3 minute overall timeout
704
+ taskTimeoutMs: 3e4
705
+ // 30 seconds per-task timeout (API calls shouldn't take longer)
706
+ });
707
+ const failedActions = [];
708
+ results.forEach((result, i) => {
709
+ const action = actions[i];
710
+ if (result.status === "fulfilled") {
711
+ actionsWithFields.push({
712
+ ...action,
713
+ inputFields: result.value.data,
714
+ name: action.title || action.key
715
+ });
716
+ } else {
717
+ failedActions.push(
718
+ `${action.key} (${action.action_type}): ${result.reason?.message || "Unknown error"}`
719
+ );
720
+ actionsWithFields.push({
721
+ ...action,
722
+ inputFields: [],
723
+ name: action.title || action.key,
724
+ app_key: action.app_key || app.implementation_id,
725
+ action_type: action.action_type || "write",
726
+ title: action.title || action.key,
727
+ type: "action",
728
+ description: action.description || ""
729
+ });
711
730
  }
712
- } else {
713
- actions.forEach(
714
- (action) => {
715
- actionsWithFields.push({
716
- ...action,
717
- inputFields: [],
718
- name: action.title || action.key,
719
- app_key: action.app_key || app.implementation_id,
720
- action_type: action.action_type || "write",
721
- title: action.title || action.key,
722
- type: "action",
723
- description: action.description || ""
724
- });
725
- }
731
+ });
732
+ if (failedActions.length > 0) {
733
+ console.warn(
734
+ `Failed to fetch input fields for ${failedActions.length} action(s):`
726
735
  );
736
+ failedActions.forEach((failedAction) => {
737
+ console.warn(` - ${failedAction}`);
738
+ });
727
739
  }
728
740
  const sourceFile = this.createSourceFile(app, actionsWithFields);
729
741
  return this.printer.printFile(sourceFile);
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zapier/zapier-sdk-cli",
3
- "version": "0.13.11",
3
+ "version": "0.13.13",
4
4
  "description": "Command line interface for Zapier SDK",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
@@ -1,5 +1,5 @@
1
1
  import * as ts from "typescript";
2
- import { toSnakeCase } from "@zapier/zapier-sdk";
2
+ import { toSnakeCase, batch } from "@zapier/zapier-sdk";
3
3
  /**
4
4
  * AST-based TypeScript type generator using the TypeScript Compiler API
5
5
  */
@@ -24,35 +24,33 @@ export class AstTypeGenerator {
24
24
  const actions = actionsResult.data;
25
25
  // Fetch input fields for each action
26
26
  const actionsWithFields = [];
27
- if (authenticationId) {
28
- for (const action of actions) {
29
- try {
30
- const fieldsResult = await sdk.listInputFields({
31
- appKey: app.implementation_id,
32
- actionKey: action.key,
33
- actionType: action.action_type,
34
- authenticationId: authenticationId,
35
- });
36
- const fields = fieldsResult.data;
37
- actionsWithFields.push({
38
- ...action,
39
- inputFields: fields,
40
- name: action.title || action.key,
41
- });
42
- }
43
- catch {
44
- // If we can't get fields for an action, include it without fields
45
- actionsWithFields.push({
46
- ...action,
47
- inputFields: [],
48
- name: action.title || action.key,
49
- });
50
- }
27
+ // Fetch all input fields with concurrency limiting for better reliability
28
+ // Using batch() instead of Promise.allSettled() prevents overwhelming the API
29
+ // and triggering rate limits when apps have many actions
30
+ const inputFieldsTasks = actions.map((action) => () => sdk.listInputFields({
31
+ appKey: app.implementation_id,
32
+ actionKey: action.key,
33
+ actionType: action.action_type,
34
+ authenticationId: authenticationId,
35
+ }));
36
+ const results = await batch(inputFieldsTasks, {
37
+ concurrency: 50, // Limit to 50 concurrent requests
38
+ retry: true, // Automatically retry transient failures
39
+ timeoutMs: 180000, // 3 minute overall timeout
40
+ taskTimeoutMs: 30000, // 30 seconds per-task timeout (API calls shouldn't take longer)
41
+ });
42
+ const failedActions = [];
43
+ results.forEach((result, i) => {
44
+ const action = actions[i];
45
+ if (result.status === "fulfilled") {
46
+ actionsWithFields.push({
47
+ ...action,
48
+ inputFields: result.value.data,
49
+ name: action.title || action.key,
50
+ });
51
51
  }
52
- }
53
- else {
54
- // Convert actions to have empty input fields (will generate generic types)
55
- actions.forEach((action) => {
52
+ else {
53
+ failedActions.push(`${action.key} (${action.action_type}): ${result.reason?.message || "Unknown error"}`);
56
54
  actionsWithFields.push({
57
55
  ...action,
58
56
  inputFields: [],
@@ -63,6 +61,12 @@ export class AstTypeGenerator {
63
61
  type: "action",
64
62
  description: action.description || "",
65
63
  });
64
+ }
65
+ });
66
+ if (failedActions.length > 0) {
67
+ console.warn(`Failed to fetch input fields for ${failedActions.length} action(s):`);
68
+ failedActions.forEach((failedAction) => {
69
+ console.warn(` - ${failedAction}`);
66
70
  });
67
71
  }
68
72
  // Generate TypeScript AST nodes