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

@mapbox/cloudfriend

Package Overview
Dependencies
Maintainers
14
Versions
92
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mapbox/cloudfriend - npm Package Compare versions

Comparing version 4.4.0 to 4.5.0

4

changelog.md

@@ -0,1 +1,5 @@

# v4.5.0
- Adds top-level `Transform` section support to `cf.merge`. `Transform` macros from all template arguments are merged into a single array, in order of their appearance in the template arguments, and an error is thrown if any macro is repeated.
# v4.4.0

@@ -2,0 +6,0 @@

@@ -20,2 +20,4 @@ 'use strict';

module.exports = function() {
// This should capture all the top-level keys described in
// https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-anatomy.html
const template = {

@@ -28,3 +30,5 @@ AWSTemplateFormatVersion: '2010-09-09',

Resources: {},
Outputs: {}
Outputs: {},
// An empty array is rejected by CFN validation.
Transform: undefined
};

@@ -38,3 +42,4 @@

Resources: new Set(),
Outputs: new Set()
Outputs: new Set(),
Transform: new Set()
};

@@ -102,2 +107,14 @@

});
if (arg.Transform) {
if (!template.Transform) template.Transform = [];
const transforms = typeof arg.Transform === 'string' ? [arg.Transform] : arg.Transform;
for (const transform of transforms) {
if (names.Transform.has(transform)) {
throw new Error('Transform macro used more than once: ' + transform);
}
template.Transform.push(transform);
names.Transform.add(transform);
}
}
}

@@ -104,0 +121,0 @@

2

package.json
{
"name": "@mapbox/cloudfriend",
"version": "4.4.0",
"version": "4.5.0",
"description": "Helper functions for assembling CloudFormation templates in JavaScript",

@@ -5,0 +5,0 @@ "main": "index.js",

# cloudfriend
[![Build Status](https://travis-ci.org/mapbox/cloudfriend.svg?branch=master)](https://travis-ci.org/mapbox/cloudfriend)
[![Build Status](https://travis-ci.com/mapbox/cloudfriend.svg?branch=master)](https://travis-ci.com/mapbox/cloudfriend)
Helper functions for assembling CloudFormation templates in JavaScript
Helper functions for assembling CloudFormation templates in JavaScript.

@@ -60,3 +60,3 @@ ## Shortcuts

validate(file) | Uses the `cloudformation:ValidateTemplate` API call to perform rudimentary template validation
merge(...template) | Merges templates together. Throws errors if logical names are reused
merge(...template) | Merges templates together. Throws errors if logical names are reused. `Transform` macros from all template arguments are merged into a single array, in order of their appearance in the template arguments, and an error is thrown if any macro is repeated.

@@ -63,0 +63,0 @@ ## CLI tools

@@ -30,3 +30,3 @@ {

"DeploymentId": {
"Ref": "PassDeploymentb6246d63"
"Ref": "PassDeployment636bae51"
},

@@ -50,3 +50,3 @@ "StageName": "hookshot",

},
"PassDeploymentb6246d63": {
"PassDeployment636bae51": {
"Type": "AWS::ApiGateway::Deployment",

@@ -53,0 +53,0 @@ "DependsOn": "PassMethod",

@@ -26,3 +26,3 @@ {

"DeploymentId": {
"Ref": "PassDeploymentb6246d63"
"Ref": "PassDeployment636bae51"
},

@@ -46,3 +46,3 @@ "StageName": "hookshot",

},
"PassDeploymentb6246d63": {
"PassDeployment636bae51": {
"Type": "AWS::ApiGateway::Deployment",

@@ -49,0 +49,0 @@ "DependsOn": "PassMethod",

@@ -26,3 +26,3 @@ {

"DeploymentId": {
"Ref": "PassDeploymentb6246d63"
"Ref": "PassDeployment636bae51"
},

@@ -46,3 +46,3 @@ "StageName": "hookshot",

},
"PassDeploymentb6246d63": {
"PassDeployment636bae51": {
"Type": "AWS::ApiGateway::Deployment",

@@ -49,0 +49,0 @@ "DependsOn": "PassMethod",

@@ -26,3 +26,3 @@ {

"DeploymentId": {
"Ref": "PassDeploymentb6246d63"
"Ref": "PassDeployment636bae51"
},

@@ -55,3 +55,3 @@ "StageName": "hookshot",

},
"PassDeploymentb6246d63": {
"PassDeployment636bae51": {
"Type": "AWS::ApiGateway::Deployment",

@@ -58,0 +58,0 @@ "DependsOn": "PassMethod",

@@ -26,3 +26,3 @@ {

"DeploymentId": {
"Ref": "PassDeploymentb6246d63"
"Ref": "PassDeployment636bae51"
},

@@ -46,3 +46,3 @@ "StageName": "hookshot",

},
"PassDeploymentb6246d63": {
"PassDeployment636bae51": {
"Type": "AWS::ApiGateway::Deployment",

@@ -49,0 +49,0 @@ "DependsOn": "PassMethod",

@@ -26,3 +26,3 @@ {

"DeploymentId": {
"Ref": "PassDeploymentb6246d63"
"Ref": "PassDeployment636bae51"
},

@@ -46,3 +46,3 @@ "StageName": "hookshot",

},
"PassDeploymentb6246d63": {
"PassDeployment636bae51": {
"Type": "AWS::ApiGateway::Deployment",

@@ -49,0 +49,0 @@ "DependsOn": "PassMethod",

@@ -26,3 +26,3 @@ {

"DeploymentId": {
"Ref": "PassDeploymentb6246d63"
"Ref": "PassDeployment636bae51"
},

@@ -46,3 +46,3 @@ "StageName": "hookshot",

},
"PassDeploymentb6246d63": {
"PassDeployment636bae51": {
"Type": "AWS::ApiGateway::Deployment",

@@ -49,0 +49,0 @@ "DependsOn": "PassMethod",

@@ -26,3 +26,3 @@ {

"DeploymentId": {
"Ref": "PassDeploymentb6246d63"
"Ref": "PassDeployment636bae51"
},

@@ -46,3 +46,3 @@ "StageName": "hookshot",

},
"PassDeploymentb6246d63": {
"PassDeployment636bae51": {
"Type": "AWS::ApiGateway::Deployment",

@@ -49,0 +49,0 @@ "DependsOn": "PassMethod",

@@ -26,3 +26,3 @@ {

"DeploymentId": {
"Ref": "PassDeploymentb6246d63"
"Ref": "PassDeployment636bae51"
},

@@ -46,3 +46,3 @@ "StageName": "hookshot",

},
"PassDeploymentb6246d63": {
"PassDeployment636bae51": {
"Type": "AWS::ApiGateway::Deployment",

@@ -49,0 +49,0 @@ "DependsOn": "PassMethod",

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

Conditions: { WouldYouLikeBaconWithThat: cloudfriend.equals(cloudfriend.ref('InstanceCount'), 999) },
Transform: ['TransformB'],
Resources: { Instance: { Type: 'AWS::EC2::Instance', Properties: { ImageId: cloudfriend.findInMap('Region', cloudfriend.region, 'AMI') } } },

@@ -124,2 +125,3 @@ Outputs: { Breakfast: { Condition: 'WouldYouLikeBaconWithThat', Value: cloudfriend.ref('Instance') } }

Conditions: { TooMuch: cloudfriend.equals(cloudfriend.ref('DatabasePrefix'), 'bacon') },
Transform: ['TransformA'],
Resources: { Database: { Type: 'AWS::DynamoDB::Table', Properties: { Name: cloudfriend.findInMap('Prefix', cloudfriend.ref('DatabasePrefix'), 'Name') } } },

@@ -152,2 +154,3 @@ Outputs: { GoSomewhereElse: { Condition: 'TooMuch', Value: cloudfriend.ref('Database') } }

},
Transform: ['TransformB', 'TransformA'],
Resources: {

@@ -163,3 +166,26 @@ Instance: { Type: 'AWS::EC2::Instance', Properties: { ImageId: cloudfriend.findInMap('Region', cloudfriend.region, 'AMI') } },

assert.deepEqual(
cloudfriend.merge(
{ Transform: 'foo' },
{ Transform: ['baz', 'bar'] },
{ Parameters: { InstanceCount: { Type: 'Number' } } }
),
{
AWSTemplateFormatVersion: '2010-09-09',
Metadata: {},
Parameters: { InstanceCount: { Type: 'Number' } },
Mappings: {},
Conditions: {},
Transform: ['foo', 'baz', 'bar'],
Resources: {},
Outputs: {}
},
'merge with string, array, and empty Transforms, ignoring duplicates'
);
assert.throws(() => {
cloudfriend.merge({ Transform: ['foo', 'bar'] }, { Transform: ['baz', 'bar'] });
}, /Transform macro used more than once: bar/);
assert.throws(() => {
b = { Metadata: { Instances: { Description: 'Information about the instances different' } } };

@@ -166,0 +192,0 @@ cloudfriend.merge(a, b);

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