@zapier/zapier-sdk-cli 0.13.11 → 0.13.12
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 +10 -0
- package/dist/cli.cjs +50 -38
- package/dist/cli.mjs +51 -39
- package/dist/index.cjs +49 -37
- package/dist/index.mjs +50 -38
- package/dist/package.json +1 -1
- package/dist/src/generators/ast-generator.js +33 -29
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/generators/ast-generator.test.ts +908 -0
- package/src/generators/ast-generator.ts +54 -46
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @zapier/zapier-sdk-cli
|
|
2
2
|
|
|
3
|
+
## 0.13.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 492e2f9: - Add new `batch` utility method to handle concurency limits, retries, timeouts and exponential backoffs.
|
|
8
|
+
- Refactor `generateAppTypes` in CLI to use the new `batch` utility
|
|
9
|
+
- Updated dependencies [492e2f9]
|
|
10
|
+
- @zapier/zapier-sdk@0.13.9
|
|
11
|
+
- @zapier/zapier-sdk-mcp@0.3.22
|
|
12
|
+
|
|
3
13
|
## 0.13.11
|
|
4
14
|
|
|
5
15
|
### 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.
|
|
1413
|
+
version: "0.13.12"};
|
|
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
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
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
|
-
}
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
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.
|
|
2685
|
+
version: "0.13.12"};
|
|
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.
|
|
1380
|
+
version: "0.13.12"};
|
|
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
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
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
|
-
}
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
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.
|
|
2652
|
+
version: "0.13.12"};
|
|
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.
|
|
269
|
+
version: "0.13.12"};
|
|
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
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
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
|
-
}
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
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.
|
|
238
|
+
version: "0.13.12"};
|
|
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
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
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
|
-
}
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
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,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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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
|
-
|
|
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
|