New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

serverless-shared-gateway

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

serverless-shared-gateway - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

78

index.js
'use strict';
const fs = require('fs')
const { promisify } = require('util')
const {
promisify
} = require('util')
const writeFile = promisify(fs.writeFile)

@@ -21,2 +23,3 @@

this.outputFilename = null
this.domainManagerCompatible = false

@@ -65,12 +68,16 @@ this.commands = {

createRestApi() {
this.initialSetup()
return this.apiGateway.createRestApi({
name: this.restApiName,
description: 'Generated by the shared Serverless - AWS Api Gateway plugin',
endpointConfiguration: {
types: [
'EDGE'
]
}
}).promise()
this.initialSetup();
if (this.domainManagerCompatible === true) {
return null;
} else {
return this.apiGateway.createRestApi({
name: this.restApiName,
description: 'Generated by the shared Serverless - AWS Api Gateway plugin',
endpointConfiguration: {
types: [
'EDGE'
]
}
}).promise()
}
}

@@ -133,4 +140,4 @@

async writeAndRead (restId, resourceId, outputFilename) {
if(outputFilename === null){
async writeAndRead(restId, resourceId, outputFilename) {
if (outputFilename === null) {
outputFilename = '.output'

@@ -140,20 +147,25 @@ }

}
async compileEvents() {
this.restApiId = this.serverless.service.provider.apiGatewayRestApiId
this.restApiResourceId = this.serverless.service.provider.apiGatewayRestApiResourceId
this.restApiName = this.serverless.service.custom.sharedGateway.gatewayName
this.outputResources = this.serverless.service.custom.sharedGateway.outputResources
this.outputFilename = this.serverless.service.custom.sharedGateway.outputFilename
this.restApiResourceId = this.serverless.service.provider.apiGatewayRestApiResourceId
this.domainManagerCompatible = this.serverless.service.custom.sharedGateway.domainManagerCompatible
if (!this.restApiId && !this.restApiName) throw new Error(`Unable to continue please provide an apiId or apiName`)
if (!this.restApiId && !this.restApiName) throw new Error(`Unable to continue please provide an apiId or apiName`);
await this.findRestApi()
await this.loadResourcesForApi()
await this.findRootResourceId()
await this._updateReferencesInCloudFormation()
await this._findAndRemoveExistingResources()
if(this.outputResources === true){
if (this.domainManagerCompatible === true) {
this.serverless.cli.consoleLog('Serverless Shared Gateway - Domain Manager Driver is enabled')
} else {
await this.findRestApi()
await this.loadResourcesForApi()
await this.findRootResourceId()
await this._updateReferencesInCloudFormation()
await this._findAndRemoveExistingResources()
}
if (this.outputResources === true) {
await this.writeAndRead(this.restApiId, this.restApiResourceId, this.outputFilename)

@@ -205,11 +217,13 @@ }

let matchingRestApi = items.find(api => this._findMatchingRestApi(api))
if (this.restApiName && !matchingRestApi) {
this.serverless.cli.log(`No API Gateway matching '${this.restApiName}' attempting to create it.`)
matchingRestApi = await this.createRestApi()
if (this.domainManagerCompatible === true) {
this.serverless.cli.log(`Usign the compatibility driver ${this.restApiName} `)
} else {
if (this.restApiName && !matchingRestApi) {
this.serverless.cli.log(`No API Gateway matching ${this.restApiName} attempting to create it.`)
matchingRestApi = await this.createRestApi()
}
this.restApiId = matchingRestApi.id
this.restApiName = matchingRestApi.name
}
this.restApiId = matchingRestApi.id
this.restApiName = matchingRestApi.name
// Set as a serverless variable here ++
}

@@ -269,3 +283,3 @@

if (this.restApiId) {
this.serverless.cli.consoleLog('Serverless Shared Gateway - api id created ' + this.restApiId )
this.serverless.cli.consoleLog('Serverless Shared Gateway - api id created ' + this.restApiId)
}

@@ -272,0 +286,0 @@ }

{
"name": "serverless-shared-gateway",
"version": "1.0.0",
"description": "Serverless shared gateway made easier ❤️",
"version": "1.1.0",
"description": "",
"publishConfig":
{
"registry":"https://registry.npmjs.org/"
},
"main": "index.js",

@@ -9,3 +13,3 @@ "scripts": {

},
"author": "FreddyJD",
"author": "",
"license": "ISC",

@@ -12,0 +16,0 @@ "devDependencies": {

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