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

serverless-plugin-additional-stacks

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

serverless-plugin-additional-stacks - npm Package Compare versions

Comparing version 1.4.0 to 1.5.0

test/service/tertiary-meta.yml

32

index.js
'use strict'
const path = require('path')
const merge = require('lodash.merge')

@@ -99,4 +100,25 @@ class AdditionalStacksPlugin {

mergeAdditionalStacks() {
// For each key in the additionalStacks, check if it's an array or not.
// If it is an array, merge the keys together. Else, return the original value.
return Object.fromEntries(Object.entries(this.serverless.service.custom.additionalStacks).map(([k, v], i) => {
if (Array.isArray(v)) {
return [k, v.reduce((memo, value) => {
if (value) {
if (typeof value === 'object') {
return merge(memo, value);
}
throw new Error(`Non-object value specified in ${key} array: ${value}`);
}
return memo;
}, {})];
} else {
return [k, v];
}
}));
}
getAdditionalStacks() {
return this.serverless.service.custom && this.serverless.service.custom.additionalStacks || {}
return (this.serverless.service.custom && this.serverless.service.custom.additionalStacks && this.mergeAdditionalStacks()) || {}
}

@@ -337,2 +359,6 @@

}
// If the CloudFormation Template has the Transform tag, an additional capability is needed.
if (compiledCloudFormationTemplate.Transform) {
params.Capabilities.push("CAPABILITY_AUTO_EXPAND")
}

@@ -375,2 +401,6 @@ this.serverless.cli.log('Creating additional stack ' + stackName + '...')

}
// If the CloudFormation Template has the Transform tag, an additional capability is needed.
if (compiledCloudFormationTemplate.Transform) {
params.Capabilities.push("CAPABILITY_AUTO_EXPAND")
}

@@ -377,0 +407,0 @@ return this.provider.request(

5

package.json
{
"name": "serverless-plugin-additional-stacks",
"version": "1.4.0",
"version": "1.5.0",
"main": "index.js",

@@ -9,3 +9,6 @@ "repository": {},

"test": "cd test && npm run test"
},
"dependencies": {
"lodash.merge": "^4.6.2"
}
}

@@ -18,2 +18,9 @@ 'use strict'

// set region if not set (as not set by the SDK by default)
if (!AWS.config.region) {
AWS.config.update({
region: 'us-east-1'
});
}
const cloudformation = new AWS.CloudFormation()

@@ -29,2 +36,4 @@ chai.use(chaiAsPromised)

const SECONDARY_STACK_FULLNAME = 'additional-stacks-plugin-service-test-customname-secondary'
const TERTIARY_STACK = 'tertiary'
const TERTIARY_STACK_FULLNAME = 'additional-stacks-plugin-service-test-customname-tertiary'

@@ -100,2 +109,3 @@ function sls(args) {

describeStack(SECONDARY_STACK_FULLNAME),
describeStack(TERTIARY_STACK_FULLNAME),
])

@@ -122,2 +132,5 @@ }

})
.then(() => {
return deleteStack(TERTIARY_STACK_FULLNAME)
})
}

@@ -143,8 +156,11 @@

assert.isOk(responses[2], 'secondary stack')
assert.isOk(responses[3], 'tertiary stack')
assert.equal(responses[0].StackStatus, 'UPDATE_COMPLETE', 'serverless stack')
assert.equal(responses[1].StackStatus, 'CREATE_COMPLETE', 'primary stack')
assert.equal(responses[2].StackStatus, 'CREATE_COMPLETE', 'secondary stack')
assert.equal(responses[3].StackStatus, 'CREATE_COMPLETE', 'tertiary stack')
assert.equal(responses[0].Tags.filter(tag => tag.Key === 'Owner')[0].Value, 'owner@example.org', 'serverless stack custom tag')
assert.equal(responses[1].Tags.filter(tag => tag.Key === 'Owner')[0].Value, 'owner@example.org', 'primary stack custom tag')
assert.equal(responses[2].Tags.filter(tag => tag.Key === 'Owner')[0].Value, 'another@example.org', 'secondary stack custom tag')
assert.equal(responses[3].Tags.filter(tag => tag.Key === 'Owner')[0].Value, 'yetanother@example.org', 'tertiary stack custom tag')
})

@@ -165,5 +181,7 @@ })

assert.isOk(responses[2], 'secondary stack')
assert.isOk(responses[3], 'tertiary stack')
assert.equal(responses[0].StackStatus, 'UPDATE_COMPLETE', 'serverless stack')
assert.equal(responses[1].StackStatus, 'CREATE_COMPLETE', 'primary stack')
assert.equal(responses[2].StackStatus, 'CREATE_COMPLETE', 'secondary stack')
assert.equal(responses[3].StackStatus, 'CREATE_COMPLETE', 'tertiary stack')
})

@@ -185,5 +203,7 @@ })

assert.isOk(responses[2], 'secondary stack')
assert.isOk(responses[3], 'tertiary stack')
assert.equal(responses[0].StackStatus, 'UPDATE_COMPLETE', 'serverless stack')
assert.equal(responses[1].StackStatus, 'CREATE_COMPLETE', 'primary stack')
assert.equal(responses[2].StackStatus, 'UPDATE_COMPLETE', 'secondary stack')
assert.equal(responses[3].StackStatus, 'CREATE_COMPLETE', 'tertiary stack')
})

@@ -204,4 +224,6 @@ })

assert.isOk(responses[2], 'secondary stack')
assert.isOk(responses[3], 'tertiary stack')
assert.equal(responses[1].StackStatus, 'CREATE_COMPLETE', 'primary stack')
assert.equal(responses[2].StackStatus, 'UPDATE_COMPLETE', 'secondary stack')
assert.equal(responses[3].StackStatus, 'CREATE_COMPLETE', 'tertiary stack')
})

@@ -229,4 +251,6 @@ })

assert.isOk(responses[2], 'secondary stack')
assert.isOk(responses[3], 'tertiary stack')
assert.equal(responses[1].StackStatus, 'CREATE_COMPLETE', 'primary stack')
assert.equal(responses[2].StackStatus, 'CREATE_COMPLETE', 'secondary stack')
assert.equal(responses[3].StackStatus, 'CREATE_COMPLETE', 'tertiary stack')
})

@@ -247,4 +271,6 @@ })

assert.isOk(responses[2], 'secondary stack')
assert.isOk(responses[3], 'tertiary stack')
assert.equal(responses[1].StackStatus, 'CREATE_COMPLETE', 'primary stack')
assert.equal(responses[2].StackStatus, 'CREATE_COMPLETE', 'secondary stack')
assert.equal(responses[3].StackStatus, 'CREATE_COMPLETE', 'tertiary stack')
})

@@ -266,4 +292,6 @@ })

assert.isOk(responses[2], 'secondary stack')
assert.isOk(responses[3], 'tertiary stack')
assert.equal(responses[1].StackStatus, 'CREATE_COMPLETE', 'primary stack')
assert.equal(responses[2].StackStatus, 'UPDATE_COMPLETE', 'secondary stack')
assert.equal(responses[3].StackStatus, 'CREATE_COMPLETE', 'tertiary stack')
})

@@ -288,2 +316,3 @@ })

assert.isNull(responses[2], 'secondary stack')
assert.isNull(responses[3], 'tertiary stack')
assert.equal(responses[0].StackStatus, 'UPDATE_COMPLETE', 'serverless stack')

@@ -312,3 +341,4 @@ })

assert.isOk(responses[2], 'secondary stack')
assert.equal(responses[2].StackStatus, 'CREATE_COMPLETE', 'primary stack')
assert.equal(responses[2].StackStatus, 'CREATE_COMPLETE', 'secondary stack')
assert.isNull(responses[3], 'tertiary stack')
})

@@ -330,2 +360,3 @@ })

assert.equal(responses[2].StackStatus, 'CREATE_COMPLETE', 'secondary stack')
assert.isNull(responses[3], 'tertiary stack')
})

@@ -347,2 +378,3 @@ })

assert.equal(responses[2].StackStatus, 'UPDATE_COMPLETE', 'secondary stack')
assert.isNull(responses[3], 'tertiary stack')
})

@@ -363,2 +395,3 @@ })

assert.isNull(responses[2], 'secondary stack')
assert.isNull(responses[3], 'tertiary stack')
})

@@ -365,0 +398,0 @@ })

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