Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

awsass

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

awsass - npm Package Compare versions

Comparing version 0.0.13 to 0.0.14

5

awsass.js

@@ -38,2 +38,3 @@ const { program } = require("commander");

.option("--cpu-units <cpu-units>", "cpu-units", "256")
.option("--remove-smallest-version", "remove smallest version")
.option("--memory-units <memory-units>", "memory-units", "512")

@@ -97,3 +98,3 @@ .option("--rest-api-id <rest-api-id>", "api gateway rest api id")

if (options["apiGatewayDeployLambdaProxySubRoute"])
Lib.apiGatewayDeployLambdaProxySubRoute(options["restApiId"], options["stageName"], options["apiGatewayBasePath"], options["apiGatewaySubPath"], options["lambdaFunction"], options["lambdaFunctionVersion"], resultFunc);
Lib.apiGatewayDeployLambdaProxySubRoute(options["restApiId"], options["stageName"], options["apiGatewayBasePath"], options["apiGatewaySubPath"], options["lambdaFunction"], options["lambdaFunctionVersion"], options["removeSmallestVersion"], resultFunc);

@@ -104,2 +105,2 @@ if (options["apiGatewayAddLambdaPermission"])

if (options["apiGatewayLambdaDeploySub"])
Lib.apiGatewayLambdaDeploySub(options["restApiId"], options["stageName"], options["apiGatewayBasePath"], options["apiGatewaySubPath"], options["lambdaFunction"], options["s3Bucket"], options["s3Key"], resultFunc);
Lib.apiGatewayLambdaDeploySub(options["restApiId"], options["stageName"], options["apiGatewayBasePath"], options["apiGatewaySubPath"], options["lambdaFunction"], options["s3Bucket"], options["s3Key"], options["removeSmallestVersion"], resultFunc);

2

package.json
{
"name": "awsass",
"description": "AWSASS is an assistant to AWS, mostly for running better scripts.",
"version": "0.0.13",
"version": "0.0.14",
"author": "Jsonize",

@@ -6,0 +6,0 @@ "repository": "https://github.com/jsonize/awsass",

@@ -414,3 +414,3 @@ const AWS = require("aws-sdk");

apiGatewayDeployLambdaProxySubRoute: function (restApiId, stageName, apiGatewayBasePath, apiGatewaySubPath, lambdaFunction, lambdaFunctionVersion, callback) {
apiGatewayDeployLambdaProxySubRoute: function (restApiId, stageName, apiGatewayBasePath, apiGatewaySubPath, lambdaFunction, lambdaFunctionVersion, removeSmallestVersion, callback) {
const apigateway = new AWS.APIGateway({apiVersion: "2015-07-09"});

@@ -474,8 +474,59 @@ apigateway.getExport({

stageName: stageName
}, callback);
})
}, function (err, result) {
if (err) {
callback(err);
return;
}
if (removeSmallestVersion) {
const swaggerBase = JSON.parse(exportResponse.body);
const subIntegration = swaggerBase.paths[apiGatewayBasePath]["x-amazon-apigateway-any-method"]["x-amazon-apigateway-integration"];
let smallestVersion = null;
const subIntegrationBase = (subIntegration.uri.split("/invocations"))[0];
for (let proxyKey in swaggerBase.paths) {
const lambdaUri = swaggerBase.paths[proxyKey]["x-amazon-apigateway-any-method"]["x-amazon-apigateway-integration"].uri;
if (lambdaUri.indexOf(subIntegrationBase) === 0) {
const lambdaVersion = parseInt(lambdaUri.substring(subIntegrationBase.length + 1), 10);
if (!isNaN(lambdaVersion)) {
if (!smallestVersion || smallestVersion.version > lambdaVersion) {
smallestVersion = {
proxyKey: proxyKey,
version: lambdaVersion
};
}
}
}
}
if (smallestVersion) {
apigateway.getResources({
restApiId: restApiId,
limit: 500
}, function (err, resourcesResponse) {
if (err !== null) {
callback(err);
return;
}
let smallestVersionId = resourcesResponse.items.find(item => item.path === smallestVersion.proxyKey);
if (smallestVersionId) {
console.log("Removing smallest version", smallestVersion, smallestVersionId);
apigateway.deleteResource({
restApiId: restApiId,
resourceId: smallestVersionId.id
}, function (err) {
if (err !== null) {
callback(err);
return;
}
callback(undefined, result);
});
}
});
}
} else
callback(undefined, result);
});
});
});
},
apiGatewayLambdaDeploySub: function (restApiId, stageName, apiGatewayBasePath, apiGatewaySubPath, lambdaFunction, s3Bucket, s3Key, callback) {
apiGatewayLambdaDeploySub: function (restApiId, stageName, apiGatewayBasePath, apiGatewaySubPath, lambdaFunction, s3Bucket, s3Key, removeSmallestVersion, callback) {
Module.lambdaUpdatePublishS3(lambdaFunction, s3Bucket, s3Key, function (err, lambdaResult) {

@@ -495,3 +546,3 @@ if (err) {

}
Module.apiGatewayDeployLambdaProxySubRoute(restApiId, stageName, apiGatewayBasePath, apiGatewaySubPath, lambdaFunction, lambdaFunctionVersion, callback);
Module.apiGatewayDeployLambdaProxySubRoute(restApiId, stageName, apiGatewayBasePath, apiGatewaySubPath, lambdaFunction, lambdaFunctionVersion, removeSmallestVersion, callback);
});

@@ -498,0 +549,0 @@ });

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc