New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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 3.7.0 to 3.8.0

.vscode/settings.json

4

changelog.md

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

# v3.8.0
- Adds `ExistingTopicArn` option to queue shortcut
# v.3.7.0

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

7

lib/shortcuts/api.md

@@ -413,4 +413,5 @@ <!-- Generated by documentation.js. Update this documentation by updating the source code. -->

Creates an SQS queue that can be fed messages through an SNS topic. Creates
an SQS queue, SNS topic, dead-letter queue and policy allowing SNS events
to publish messages to the queue.
an SQS queue and a dead-letter queue for it. Either creates a new SNS
topic that can be used for sending messages into the queue, or subscribes the queue
to an existing SNS topic provided with the `ExistingTopicArn` option.

@@ -440,2 +441,4 @@ ### Parameters

to this SQS queue. See [AWS documentation][71] (optional, default `undefined`)
- `options.ExistingTopicArn` **[String][52]?** Specify an SNS topic ARN to subscribe the queue to.
If this option is provided, TopicName is irrelevant because no new topic is created.
- `options.TopicName` **[String][52]** See [AWS documentation][111] (optional, default `'${stack name}-${logical name}'`)

@@ -442,0 +445,0 @@ - `options.DisplayName` **[String][52]** See [AWS documentation][112] (optional, default `undefined`)

@@ -5,4 +5,5 @@ 'use strict';

* Creates an SQS queue that can be fed messages through an SNS topic. Creates
* an SQS queue, SNS topic, dead-letter queue and policy allowing SNS events
* to publish messages to the queue.
* an SQS queue and a dead-letter queue for it. Either creates a new SNS
* topic that can be used for sending messages into the queue, or subscribes the queue
* to an existing SNS topic provided with the `ExistingTopicArn` option.
*

@@ -32,2 +33,4 @@ * @property {Object} Resources - the CloudFormation resources created by this shortcut.

* to this SQS queue. See [AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-dependson.html)
* @param {String} [options.ExistingTopicArn] Specify an SNS topic ARN to subscribe the queue to.
* If this option is provided, TopicName is irrelevant because no new topic is created.
* @param {String} [options.TopicName='${stack name}-${logical name}'] See [AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sns-topic.html#cfn-sns-topic-name)

@@ -65,2 +68,3 @@ * @param {String} [options.DisplayName=undefined] See [AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sns-topic.html#cfn-sns-topic-displayname)

DependsOn = undefined,
ExistingTopicArn,
TopicName = { 'Fn::Sub': `\${AWS::StackName}-${LogicalName}` },

@@ -110,5 +114,8 @@ DisplayName,

}
},
}
};
[`${LogicalName}Topic`]: {
let subscribedExistingTopicArn = ExistingTopicArn;
if (!subscribedExistingTopicArn) {
this.Resources[`${LogicalName}Topic`] = {
Type: 'AWS::SNS::Topic',

@@ -118,35 +125,39 @@ Condition,

TopicName,
DisplayName,
Subscription: [
{
Endpoint: { 'Fn::GetAtt': [LogicalName, 'Arn'] },
Protocol: 'sqs'
}
]
DisplayName
}
},
};
subscribedExistingTopicArn = { Ref: `${LogicalName}Topic` };
}
[`${LogicalName}Policy`]: {
Type: 'AWS::SQS::QueuePolicy',
Condition,
Properties: {
Queues: [{ Ref: LogicalName }],
PolicyDocument: {
Version: '2008-10-17',
Id: LogicalName,
Statement: [
{
Sid: LogicalName,
Effect: 'Allow',
Action: 'sqs:SendMessage',
Principal: { AWS: '*' },
Resource: { 'Fn::GetAtt': [LogicalName, 'Arn'] },
Condition: {
ArnEquals: {
'aws:SourceArn': { Ref: `${LogicalName}Topic` }
}
this.Resources[`${LogicalName}Subscription`] = {
Type: 'AWS::SNS::Subscription',
Properties: {
Protocol: 'sqs',
ExistingTopicArn: subscribedExistingTopicArn,
Endpoint: { 'Fn::GetAtt': [LogicalName, 'Arn'] }
}
};
this.Resources[`${LogicalName}Policy`] = {
Type: 'AWS::SQS::QueuePolicy',
Condition,
Properties: {
Queues: [{ Ref: LogicalName }],
PolicyDocument: {
Version: '2008-10-17',
Id: LogicalName,
Statement: [
{
Sid: LogicalName,
Effect: 'Allow',
Action: 'sqs:SendMessage',
Principal: { AWS: '*' },
Resource: { 'Fn::GetAtt': [LogicalName, 'Arn'] },
Condition: {
ArnEquals: {
'aws:SourceArn': subscribedExistingTopicArn
}
}
]
}
}
]
}

@@ -153,0 +164,0 @@ }

{
"name": "@mapbox/cloudfriend",
"version": "3.7.0",
"version": "3.8.0",
"description": "Helper functions for assembling CloudFormation templates in JavaScript",

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

@@ -49,16 +49,13 @@ {

"Fn::Sub": "${AWS::StackName}-MyQueue"
},
"Subscription": [
{
"Endpoint": {
"Fn::GetAtt": [
"MyQueue",
"Arn"
]
},
"Protocol": "sqs"
}
]
}
}
},
"MyQueueSubscription": {
"Type": "AWS::SNS::Subscription",
"Properties": {
"Protocol": "sqs",
"ExistingTopicArn": { "Ref": "MyQueueTopic" },
"Endpoint": { "Fn::GetAtt": ["MyQueue", "Arn"]}
}
},
"MyQueuePolicy": {

@@ -103,2 +100,2 @@ "Type": "AWS::SQS::QueuePolicy",

"Outputs": {}
}
}

@@ -64,16 +64,13 @@ {

"TopicName": "my-topic",
"DisplayName": "topic-display-name",
"Subscription": [
{
"Endpoint": {
"Fn::GetAtt": [
"MyQueue",
"Arn"
]
},
"Protocol": "sqs"
}
]
"DisplayName": "topic-display-name"
}
},
"MyQueueSubscription": {
"Type": "AWS::SNS::Subscription",
"Properties": {
"Protocol": "sqs",
"ExistingTopicArn": { "Ref": "MyQueueTopic" },
"Endpoint": { "Fn::GetAtt": ["MyQueue", "Arn"]}
}
},
"MyQueuePolicy": {

@@ -119,2 +116,2 @@ "Type": "AWS::SQS::QueuePolicy",

"Outputs": {}
}
}

@@ -475,2 +475,29 @@ 'use strict';

queue = new cf.shortcuts.Queue({
LogicalName: 'MyQueue',
ExistingTopicArn: 'arn:aws:sns:us-east-1:111122223333:MyTopic'
});
template = cf.merge(queue);
if (update) fixtures.update('queue-external-topic', template);
assert.deepEqual(
noUndefined(template),
fixtures.get('queue-external-topic'),
'expected resources generated for external topic'
);
queue = new cf.shortcuts.Queue({
LogicalName: 'MyQueue',
ExistingTopicArn: { Ref: 'TopicForOtherThing' }
});
template = cf.merge(
{ Resources: { TopicForOtherThing: { Type: 'AWS::SNS::Topic' } } },
queue
);
if (update) fixtures.update('queue-external-topic-ref', template);
assert.deepEqual(
noUndefined(template),
fixtures.get('queue-external-topic-ref'),
'expected resources generated for external topic identified by ref'
);
assert.end();

@@ -477,0 +504,0 @@ });

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