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

serverless-api-gateway-throttling

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

serverless-api-gateway-throttling - npm Package Compare versions

Comparing version 2.0.1-rc1 to 2.0.1-rc2

2

package.json
{
"name": "serverless-api-gateway-throttling",
"version": "2.0.1-rc1",
"version": "2.0.1-rc2",
"description": "A plugin for the Serverless framework which configures throttling for API Gateway endpoints.",

@@ -5,0 +5,0 @@ "main": "src/apiGatewayThrottlingPlugin.js",

@@ -16,11 +16,8 @@ 'use strict';

if (serverless.service.provider.compiledCloudFormationTemplate) {
const resource = serverless.service.provider.compiledCloudFormationTemplate.Resources['HttpApi'];
if (resource) {
return true;
}
if (httpApiExistsInCloudFormationTemplate(serverless)) {
return true;
}
if (settings) {
const httpApiIdFromAlreadyDeployedStack = await retrieveHttpApiId(serverless, settings);
const httpApiIdFromAlreadyDeployedStack = await retrieveHttpApiIdFromAlreadyDeployedStack(serverless, settings);
if (httpApiIdFromAlreadyDeployedStack) {

@@ -33,2 +30,14 @@ return true;

const retrieveHttpApiId = async (serverless, settings) => {
const configuredHttpApiId = getConfiguredHttpApiId(serverless);
if (configuredHttpApiId) {
return configuredHttpApiId;
}
const HttpApiId = await retrieveHttpApiIdFromAlreadyDeployedStack(serverless, settings);
if (!HttpApiId) {
serverless.cli.log(`[serverless-api-gateway-throttling] Could not find stack output variable named ${HTTP_API_ID_KEY}.`);
}
};
const outputHttpApiIdTo = (serverless) => {

@@ -44,2 +53,21 @@ const configuredHttpApiId = getConfiguredHttpApiId(serverless);

const httpApiExistsInCloudFormationTemplate = (serverless) => {
if (serverless.service.provider.compiledCloudFormationTemplate) {
const resource = serverless.service.provider.compiledCloudFormationTemplate.Resources['HttpApi'];
if (resource) {
return true;
}
}
return false;
}
const retrieveHttpApiIdFromAlreadyDeployedStack = async (serverless, settings) => {
const stack = await getAlreadyDeployedStack(serverless, settings);
const outputs = stack.Stacks[0].Outputs;
const HttpApiKey = outputs.find(({ OutputKey }) => OutputKey === HTTP_API_ID_KEY)
if (HttpApiKey) {
return HttpApiKey.OutputValue;
}
}
const getAlreadyDeployedStack = async (serverless, settings) => {

@@ -60,19 +88,2 @@ const stackName = serverless.providers.aws.naming.getStackName(settings.stage);

const retrieveHttpApiId = async (serverless, settings) => {
const configuredHttpApiId = getConfiguredHttpApiId(serverless);
if (configuredHttpApiId) {
return configuredHttpApiId;
}
const stack = await getAlreadyDeployedStack(serverless, settings);
const outputs = stack.Stacks[0].Outputs;
const restApiKey = outputs.find(({ OutputKey }) => OutputKey === HTTP_API_ID_KEY)
if (restApiKey) {
return restApiKey.OutputValue;
}
else {
serverless.cli.log(`[serverless-api-gateway-throttling] Could not find stack output variable named ${HTTP_API_ID_KEY}.`);
}
};
module.exports = {

@@ -79,0 +90,0 @@ httpApiExists,

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