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

serverless-api-gateway-caching

Package Overview
Dependencies
Maintainers
1
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 1.3.5 to 1.3.6

2

package.json
{
"name": "serverless-api-gateway-caching",
"version": "1.3.5",
"version": "1.3.6",
"description": "A plugin for the serverless framework which helps with configuring caching for API Gateway endpoints.",

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

const isEmpty = require('lodash.isempty');
const { retrieveRestApiId } = require('./restApiId');
const MAX_PATCH_OPERATIONS_PER_STAGE_UPDATE = 80;

@@ -136,2 +137,27 @@ String.prototype.replaceAll = function (search, replacement) {

const updateStageFor = async (serverless, params, stage, region) => {
const chunkSize = MAX_PATCH_OPERATIONS_PER_STAGE_UPDATE;
const { patchOperations } = params;
const paramsInChunks = [];
if (patchOperations.length > chunkSize) {
for (let i = 0; i < patchOperations.length; i += chunkSize) {
paramsInChunks.push({
restApiId: params.restApiId,
stageName: params.stageName,
patchOperations: patchOperations.slice(i, i + chunkSize)
});
}
}
else {
paramsInChunks.push(params);
}
for (let index in paramsInChunks) {
serverless.cli.log(`[serverless-api-gateway-caching] Updating API Gateway cache settings (${index + 1} of ${paramsInChunks.length}).`);
await serverless.providers.aws.request('APIGateway', 'updateStage', paramsInChunks[index], stage, region);
}
serverless.cli.log(`[serverless-api-gateway-caching] Done updating API Gateway cache settings.`);
}
const updateStageCacheSettings = async (settings, serverless) => {

@@ -162,7 +188,5 @@ // do nothing if caching settings are not defined

serverless.cli.log(`[serverless-api-gateway-caching] Updating API Gateway cache settings.`);
await serverless.providers.aws.request('APIGateway', 'updateStage', params, settings.stage, settings.region);
serverless.cli.log(`[serverless-api-gateway-caching] Done updating API Gateway cache settings.`);
await updateStageFor(serverless, params, settings.stage, settings.region);
}
module.exports = updateStageCacheSettings;
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