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

@mapbox/cloudfriend

Package Overview
Dependencies
Maintainers
28
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 8.1.0-dev to 8.1.0-dev.2

.nyc_output/35aa325a-f140-4f80-9616-95761c59175e.json

2

.nyc_output/processinfo/index.json

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

{"processes":{"3eb8bb63-d72c-4c53-9b7a-2c08ffed873e":{"parent":null,"children":["4cebf8b0-d44d-49b5-b0f8-c5d917495961"]},"4cebf8b0-d44d-49b5-b0f8-c5d917495961":{"parent":"3eb8bb63-d72c-4c53-9b7a-2c08ffed873e","children":[]}},"files":{"/Users/branyip/src/cloudfriend/index.js":["3eb8bb63-d72c-4c53-9b7a-2c08ffed873e","4cebf8b0-d44d-49b5-b0f8-c5d917495961"],"/Users/branyip/src/cloudfriend/lib/intrinsic.js":["3eb8bb63-d72c-4c53-9b7a-2c08ffed873e","4cebf8b0-d44d-49b5-b0f8-c5d917495961"],"/Users/branyip/src/cloudfriend/lib/conditions.js":["3eb8bb63-d72c-4c53-9b7a-2c08ffed873e","4cebf8b0-d44d-49b5-b0f8-c5d917495961"],"/Users/branyip/src/cloudfriend/lib/rules.js":["3eb8bb63-d72c-4c53-9b7a-2c08ffed873e","4cebf8b0-d44d-49b5-b0f8-c5d917495961"],"/Users/branyip/src/cloudfriend/lib/pseudo.js":["3eb8bb63-d72c-4c53-9b7a-2c08ffed873e","4cebf8b0-d44d-49b5-b0f8-c5d917495961"],"/Users/branyip/src/cloudfriend/lib/build.js":["3eb8bb63-d72c-4c53-9b7a-2c08ffed873e","4cebf8b0-d44d-49b5-b0f8-c5d917495961"],"/Users/branyip/src/cloudfriend/lib/validate.js":["3eb8bb63-d72c-4c53-9b7a-2c08ffed873e","4cebf8b0-d44d-49b5-b0f8-c5d917495961"],"/Users/branyip/src/cloudfriend/lib/merge.js":["3eb8bb63-d72c-4c53-9b7a-2c08ffed873e","4cebf8b0-d44d-49b5-b0f8-c5d917495961"],"/Users/branyip/src/cloudfriend/lib/shortcuts/index.js":["3eb8bb63-d72c-4c53-9b7a-2c08ffed873e","4cebf8b0-d44d-49b5-b0f8-c5d917495961"],"/Users/branyip/src/cloudfriend/lib/shortcuts/lambda.js":["3eb8bb63-d72c-4c53-9b7a-2c08ffed873e","4cebf8b0-d44d-49b5-b0f8-c5d917495961"],"/Users/branyip/src/cloudfriend/lib/shortcuts/service-role.js":["3eb8bb63-d72c-4c53-9b7a-2c08ffed873e","4cebf8b0-d44d-49b5-b0f8-c5d917495961"],"/Users/branyip/src/cloudfriend/lib/shortcuts/role.js":["3eb8bb63-d72c-4c53-9b7a-2c08ffed873e","4cebf8b0-d44d-49b5-b0f8-c5d917495961"],"/Users/branyip/src/cloudfriend/lib/shortcuts/scheduled-lambda.js":["3eb8bb63-d72c-4c53-9b7a-2c08ffed873e","4cebf8b0-d44d-49b5-b0f8-c5d917495961"],"/Users/branyip/src/cloudfriend/lib/shortcuts/event-lambda.js":["3eb8bb63-d72c-4c53-9b7a-2c08ffed873e","4cebf8b0-d44d-49b5-b0f8-c5d917495961"],"/Users/branyip/src/cloudfriend/lib/shortcuts/queue-lambda.js":["3eb8bb63-d72c-4c53-9b7a-2c08ffed873e","4cebf8b0-d44d-49b5-b0f8-c5d917495961"],"/Users/branyip/src/cloudfriend/lib/shortcuts/stream-lambda.js":["3eb8bb63-d72c-4c53-9b7a-2c08ffed873e","4cebf8b0-d44d-49b5-b0f8-c5d917495961"],"/Users/branyip/src/cloudfriend/lib/shortcuts/cross-account-role.js":["3eb8bb63-d72c-4c53-9b7a-2c08ffed873e","4cebf8b0-d44d-49b5-b0f8-c5d917495961"],"/Users/branyip/src/cloudfriend/lib/shortcuts/queue.js":["3eb8bb63-d72c-4c53-9b7a-2c08ffed873e","4cebf8b0-d44d-49b5-b0f8-c5d917495961"],"/Users/branyip/src/cloudfriend/lib/shortcuts/s3-kinesis-firehose.js":["3eb8bb63-d72c-4c53-9b7a-2c08ffed873e","4cebf8b0-d44d-49b5-b0f8-c5d917495961"],"/Users/branyip/src/cloudfriend/lib/shortcuts/kinesis-firehose-base.js":["3eb8bb63-d72c-4c53-9b7a-2c08ffed873e","4cebf8b0-d44d-49b5-b0f8-c5d917495961"],"/Users/branyip/src/cloudfriend/lib/shortcuts/glue-database.js":["3eb8bb63-d72c-4c53-9b7a-2c08ffed873e","4cebf8b0-d44d-49b5-b0f8-c5d917495961"],"/Users/branyip/src/cloudfriend/lib/shortcuts/glue-table.js":["3eb8bb63-d72c-4c53-9b7a-2c08ffed873e","4cebf8b0-d44d-49b5-b0f8-c5d917495961"],"/Users/branyip/src/cloudfriend/lib/shortcuts/glue-json-table.js":["3eb8bb63-d72c-4c53-9b7a-2c08ffed873e","4cebf8b0-d44d-49b5-b0f8-c5d917495961"],"/Users/branyip/src/cloudfriend/lib/shortcuts/glue-orc-table.js":["3eb8bb63-d72c-4c53-9b7a-2c08ffed873e","4cebf8b0-d44d-49b5-b0f8-c5d917495961"],"/Users/branyip/src/cloudfriend/lib/shortcuts/glue-parquet-table.js":["3eb8bb63-d72c-4c53-9b7a-2c08ffed873e","4cebf8b0-d44d-49b5-b0f8-c5d917495961"],"/Users/branyip/src/cloudfriend/lib/shortcuts/glue-presto-view.js":["3eb8bb63-d72c-4c53-9b7a-2c08ffed873e","4cebf8b0-d44d-49b5-b0f8-c5d917495961"],"/Users/branyip/src/cloudfriend/lib/shortcuts/glue-spark-view.js":["3eb8bb63-d72c-4c53-9b7a-2c08ffed873e","4cebf8b0-d44d-49b5-b0f8-c5d917495961"],"/Users/branyip/src/cloudfriend/lib/shortcuts/hookshot.js":["3eb8bb63-d72c-4c53-9b7a-2c08ffed873e","4cebf8b0-d44d-49b5-b0f8-c5d917495961"],"/Users/branyip/src/cloudfriend/lib/shortcuts/log-subscription-lambda.js":["3eb8bb63-d72c-4c53-9b7a-2c08ffed873e","4cebf8b0-d44d-49b5-b0f8-c5d917495961"],"/Users/branyip/src/cloudfriend/bin/build-template.js":["4cebf8b0-d44d-49b5-b0f8-c5d917495961"]},"externalIds":{}}
{"processes":{"35aa325a-f140-4f80-9616-95761c59175e":{"parent":"a5f87e50-cfde-4941-8875-256437709f71","children":[]}},"files":{"/Users/branyip/src/cloudfriend/bin/build-template.js":["35aa325a-f140-4f80-9616-95761c59175e"],"/Users/branyip/src/cloudfriend/index.js":["35aa325a-f140-4f80-9616-95761c59175e"],"/Users/branyip/src/cloudfriend/lib/intrinsic.js":["35aa325a-f140-4f80-9616-95761c59175e"],"/Users/branyip/src/cloudfriend/lib/conditions.js":["35aa325a-f140-4f80-9616-95761c59175e"],"/Users/branyip/src/cloudfriend/lib/rules.js":["35aa325a-f140-4f80-9616-95761c59175e"],"/Users/branyip/src/cloudfriend/lib/pseudo.js":["35aa325a-f140-4f80-9616-95761c59175e"],"/Users/branyip/src/cloudfriend/lib/build.js":["35aa325a-f140-4f80-9616-95761c59175e"],"/Users/branyip/src/cloudfriend/lib/validate.js":["35aa325a-f140-4f80-9616-95761c59175e"],"/Users/branyip/src/cloudfriend/lib/merge.js":["35aa325a-f140-4f80-9616-95761c59175e"],"/Users/branyip/src/cloudfriend/lib/shortcuts/index.js":["35aa325a-f140-4f80-9616-95761c59175e"],"/Users/branyip/src/cloudfriend/lib/shortcuts/lambda.js":["35aa325a-f140-4f80-9616-95761c59175e"],"/Users/branyip/src/cloudfriend/lib/shortcuts/service-role.js":["35aa325a-f140-4f80-9616-95761c59175e"],"/Users/branyip/src/cloudfriend/lib/shortcuts/role.js":["35aa325a-f140-4f80-9616-95761c59175e"],"/Users/branyip/src/cloudfriend/lib/shortcuts/scheduled-lambda.js":["35aa325a-f140-4f80-9616-95761c59175e"],"/Users/branyip/src/cloudfriend/lib/shortcuts/event-lambda.js":["35aa325a-f140-4f80-9616-95761c59175e"],"/Users/branyip/src/cloudfriend/lib/shortcuts/queue-lambda.js":["35aa325a-f140-4f80-9616-95761c59175e"],"/Users/branyip/src/cloudfriend/lib/shortcuts/stream-lambda.js":["35aa325a-f140-4f80-9616-95761c59175e"],"/Users/branyip/src/cloudfriend/lib/shortcuts/cross-account-role.js":["35aa325a-f140-4f80-9616-95761c59175e"],"/Users/branyip/src/cloudfriend/lib/shortcuts/queue.js":["35aa325a-f140-4f80-9616-95761c59175e"],"/Users/branyip/src/cloudfriend/lib/shortcuts/s3-kinesis-firehose.js":["35aa325a-f140-4f80-9616-95761c59175e"],"/Users/branyip/src/cloudfriend/lib/shortcuts/kinesis-firehose-base.js":["35aa325a-f140-4f80-9616-95761c59175e"],"/Users/branyip/src/cloudfriend/lib/shortcuts/glue-database.js":["35aa325a-f140-4f80-9616-95761c59175e"],"/Users/branyip/src/cloudfriend/lib/shortcuts/glue-table.js":["35aa325a-f140-4f80-9616-95761c59175e"],"/Users/branyip/src/cloudfriend/lib/shortcuts/glue-json-table.js":["35aa325a-f140-4f80-9616-95761c59175e"],"/Users/branyip/src/cloudfriend/lib/shortcuts/glue-orc-table.js":["35aa325a-f140-4f80-9616-95761c59175e"],"/Users/branyip/src/cloudfriend/lib/shortcuts/glue-parquet-table.js":["35aa325a-f140-4f80-9616-95761c59175e"],"/Users/branyip/src/cloudfriend/lib/shortcuts/glue-presto-view.js":["35aa325a-f140-4f80-9616-95761c59175e"],"/Users/branyip/src/cloudfriend/lib/shortcuts/glue-spark-view.js":["35aa325a-f140-4f80-9616-95761c59175e"],"/Users/branyip/src/cloudfriend/lib/shortcuts/hookshot.js":["35aa325a-f140-4f80-9616-95761c59175e"],"/Users/branyip/src/cloudfriend/lib/shortcuts/log-subscription-lambda.js":["35aa325a-f140-4f80-9616-95761c59175e"]},"externalIds":{}}

@@ -397,3 +397,2 @@ ## Classes

| [options.Environment] | <code>Object</code> | | See [AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-environment). |
| [options.FilterCriteria] | <code>Object</code> | | See [AWS documentation](https://docs.aws.amazon.com/lambda/latest/dg/invocation-eventfiltering.html) |
| [options.FunctionName] | <code>String</code> | <code>&#x27;${stack name}-${logical name}&#x27;</code> | See [AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-functionname). |

@@ -787,2 +786,3 @@ | [options.Handler] | <code>String</code> | <code>&#x27;index.handler&#x27;</code> | See [AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-handler). |

| [options.StartingPosition] | <code>String</code> | <code>&#x27;LATEST&#x27;</code> | See [AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-startingposition). |
| [options.FilterCriteria] | <code>Object</code> | | See [AWS documentation](https://docs.aws.amazon.com/lambda/latest/dg/invocation-eventfiltering.html). |

@@ -789,0 +789,0 @@ **Example**

@@ -64,4 +64,22 @@ 'use strict';

};
if (FilterCriteria) {
if (Object.prototype.toString.call(FilterCriteria) !== '[object Object]'){
throw new Error('`FilterCriteria` must be a JSON-like object');
}
if (!(FilterCriteria.Filters && Array.isArray(FilterCriteria.Filters))){
throw new Error('`FilterCriteria` must contain property `Filter` of type array');
}
if (FilterCriteria.Filters.length > 5){
throw new Error('`FilterCriteria.Filter` cannot contain more than 5 items, you may request a quota increase with AWS support if required.');
}
for (const filter of FilterCriteria.Filters){
if (!filter.Pattern){
throw new Error('An object in `FilterCriteria.Filter` was missing the required property `Pattern`');
}
try {
JSON.parse(filter.Pattern);
} catch (error) {
throw new Error('An object in `FilterCriteria.Filter` contains a `Pattern` property that is not a JSON parseable string');
}
}
this.Resources[`${this.LogicalName}EventSource`].Properties.FilterCriteria = FilterCriteria;

@@ -68,0 +86,0 @@ }

{
"name": "@mapbox/cloudfriend",
"version": "8.1.0-dev",
"version": "8.1.0-dev.2",
"description": "Helper functions for assembling CloudFormation templates in JavaScript",

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

@@ -170,2 +170,9 @@ {

"MaximumBatchingWindowInSeconds": 300,
"FilterCriteria": {
"Filters": [
{
"Pattern": "{\"eventName\":[\"INSERT\",\"MODIFY\"]}"
}
]
},
"Enabled": false,

@@ -181,2 +188,2 @@ "EventSourceArn": "arn:aws:kinesis:us-east-1:123456789012:stream/fake",

"Outputs": {}
}
}

@@ -478,2 +478,9 @@ 'use strict';

EventSourceArn: 'arn:aws:kinesis:us-east-1:123456789012:stream/fake',
FilterCriteria: {
Filters: [
{
Pattern: JSON.stringify({ eventName: ['INSERT', 'MODIFY'] })
}
]
},
BatchSize: 10000,

@@ -496,2 +503,119 @@ MaximumBatchingWindowInSeconds: 300,

test('[shortcuts] StreamLambda FilterCriteria', (assert) => {
assert.throws(
() => new cf.shortcuts.StreamLambda({
LogicalName: 'MyLambda',
Code: {
S3Bucket: 'my-code-bucket',
S3Key: 'path/to/code.zip'
},
EventSourceArn: 'arn:aws:kinesis:us-east-1:123456789012:stream/fake',
FilterCriteria: ['test']
}),
'`FilterCriteria` must be a JSON-like object',
);
assert.throws(
() => new cf.shortcuts.StreamLambda({
LogicalName: 'MyLambda',
Code: {
S3Bucket: 'my-code-bucket',
S3Key: 'path/to/code.zip'
},
EventSourceArn: 'arn:aws:kinesis:us-east-1:123456789012:stream/fake',
FilterCriteria: {}
}),
'`FilterCriteria` must contain property `Filter` of type array',
);
assert.throws(
() => new cf.shortcuts.StreamLambda({
LogicalName: 'MyLambda',
Code: {
S3Bucket: 'my-code-bucket',
S3Key: 'path/to/code.zip'
},
EventSourceArn: 'arn:aws:kinesis:us-east-1:123456789012:stream/fake',
FilterCriteria: {
Filter: 613
}
}),
'`FilterCriteria` must contain property `Filter` of type array',
);
assert.throws(
() => new cf.shortcuts.StreamLambda({
LogicalName: 'MyLambda',
Code: {
S3Bucket: 'my-code-bucket',
S3Key: 'path/to/code.zip'
},
EventSourceArn: 'arn:aws:kinesis:us-east-1:123456789012:stream/fake',
FilterCriteria: {
Filters: [
{
Pattern: JSON.stringify({ eventName: ['1'] })
},
{
Pattern: JSON.stringify({ eventName: ['2'] })
},
{
Pattern: JSON.stringify({ eventName: ['3'] })
},
{
Pattern: JSON.stringify({ eventName: ['4'] })
},
{
Pattern: JSON.stringify({ eventName: ['5'] })
},
{
Pattern: JSON.stringify({ eventName: ['6'] })
}
]
}
}),
'`FilterCriteria.Filter` cannot contain more than 5 items, you may request a quota increase with AWS support if required.',
);
assert.throws(
() => new cf.shortcuts.StreamLambda({
LogicalName: 'MyLambda',
Code: {
S3Bucket: 'my-code-bucket',
S3Key: 'path/to/code.zip'
},
EventSourceArn: 'arn:aws:kinesis:us-east-1:123456789012:stream/fake',
FilterCriteria: {
Filters: [
{
NotPattern: JSON.stringify({ eventName: ['INSERT', 'MODIFY'] })
},
{
Pattern: JSON.stringify({ eventName: ['INSERT', 'MODIFY'] })
}
]
}
}),
'An object in `FilterCriteria.Filter` was missing the required property `Pattern`',
);
assert.throws(
() => new cf.shortcuts.StreamLambda({
LogicalName: 'MyLambda',
Code: {
S3Bucket: 'my-code-bucket',
S3Key: 'path/to/code.zip'
},
EventSourceArn: 'arn:aws:kinesis:us-east-1:123456789012:stream/fake',
FilterCriteria: {
Filters: [
{
Pattern: '{"eventName":["INSERT","MODIFY"]}'
},
{
Pattern: { eventName: ['INSERT', 'MODIFY'] }
}
]
}
}),
'An object in `FilterCriteria.Filter` contains a `Pattern` property that is not a JSON parseable string',
);
assert.end();
});
test('[shortcuts] log-subscription-lambda', (assert) => {

@@ -498,0 +622,0 @@ assert.throws(

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