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.1.1 to 1.1.2-rc1

src/restApiId.js

0

.vscode/launch.json

@@ -0,0 +0,0 @@ {

2

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

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

@@ -0,0 +0,0 @@ # serverless-api-gateway-caching

@@ -6,2 +6,3 @@ 'use strict';

const updateStageCacheSettings = require('./stageCache');
const { outputRestApiIdTo } = require('./restApiId');

@@ -25,13 +26,9 @@ class ApiGatewayCachingPlugin {

updateCloudFormationTemplate() {
let restApiId = {
Ref: 'ApiGatewayRestApi',
};
if (this.serverless.service.provider.apiGateway && this.serverless.service.provider.apiGateway.restApiId) {
restApiId = this.serverless.service.provider.apiGateway.restApiId
this.thereIsARestApi = restApiExists();
if (!this.thereIsARestApi) {
return;
}
this.serverless.service.provider.compiledCloudFormationTemplate.Outputs.RestApiIdForApiGwCaching = {
Description: 'Rest API Id',
Value: restApiId,
};
outputRestApiIdTo(this.serverless);
// if caching is not defined or disabled

@@ -46,6 +43,17 @@ if (!this.settings.cachingEnabled) {

updateStage() {
if (!this.thereIsARestApi) {
return;
}
return updateStageCacheSettings(this.settings, this.serverless);
}
restApiExists() {
let resource = this.serverless.service.provider.compiledCloudFormationTemplate.Resources['ApiGatewayRestApi'];
if (resource) {
return true;
}
return false;
}
}
module.exports = ApiGatewayCachingPlugin;

@@ -0,0 +0,0 @@ const isEmpty = require('lodash.isempty');

@@ -0,0 +0,0 @@ const isEmpty = require('lodash.isempty');

const isEmpty = require('lodash.isempty');
const { retrieveRestApiId } = require('./restApiId');
const getRestApiId = async (settings, serverless) => {
const stackName = serverless.providers.aws.naming.getStackName(settings.stage);
let stack = await serverless.providers.aws.request('CloudFormation', 'describeStacks', { StackName: stackName },
settings.stage,
settings.region
);
return stack.Stacks[0].Outputs
.filter(output => output.OutputKey === 'RestApiIdForApiGwCaching')
.map(output => output.OutputValue)[0];
}
String.prototype.replaceAll = function (search, replacement) {

@@ -122,3 +110,3 @@ let target = this;

let restApiId = await getRestApiId(settings, serverless);
let restApiId = await retrieveRestApiId(serverless, settings);

@@ -125,0 +113,0 @@ let patchOps = createPatchForStage(settings);

@@ -0,0 +0,0 @@ module.exports = {

Sorry, the diff of this file is not supported yet

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