@aws-sdk/find-v2 0.2.0 → 0.3.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.
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Lambda, paginateListFunctions } from "@aws-sdk/client-lambda";
|
|
2
|
+
import { cpus } from "node:os";
|
|
3
|
+
import pLimit from "p-limit";
|
|
2
4
|
import { JS_SDK_V2_MARKER } from "./constants.js";
|
|
3
5
|
import { scanLambdaFunction } from "./scanLambdaFunction.js";
|
|
4
6
|
const getNodeJsFunctionNames = (functions) => (functions ?? [])
|
|
@@ -23,8 +25,7 @@ export const scanLambdaFunctions = async (region) => {
|
|
|
23
25
|
console.log(`- ${JS_SDK_V2_MARKER.UNKNOWN} means script was not able to proceed, and it emits reason.\n`);
|
|
24
26
|
const clientRegion = await client.config.region();
|
|
25
27
|
console.log(`Reading ${functionsLength} function${functionsLength > 1 ? "s" : ""} from "${clientRegion}" region.`);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
28
|
+
const limit = pLimit(Math.min(functionsLength, cpus().length || 1));
|
|
29
|
+
await Promise.all(functions.map((fn) => limit(() => scanLambdaFunction(client, fn))));
|
|
29
30
|
console.log("\nDone.");
|
|
30
31
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/find-v2",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "CLI to find resources which call AWS using JavaScript SDK v2",
|
|
5
5
|
"main": "dist/cli.js",
|
|
6
6
|
"types": "dist/cli.d.ts",
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@aws-sdk/client-lambda": "^3.942.0",
|
|
10
10
|
"commander": "^14.0.2",
|
|
11
|
-
"node-stream-zip": "^1.15.0"
|
|
11
|
+
"node-stream-zip": "^1.15.0",
|
|
12
|
+
"p-limit": "^7.2.0"
|
|
12
13
|
},
|
|
13
14
|
"devDependencies": {
|
|
14
15
|
"@aws-sdk/client-sts": "^3.946.0",
|