@mapbox/cloudfriend 8.1.0-dev.2 → 8.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,10 +26,27 @@ const Lambda = require('./lambda');
26
26
  * S3Bucket: 'my-code-bucket',
27
27
  * S3Key: 'path/to/code.zip'
28
28
  * },
29
- * EventSourceArn: cf.getAtt('MyStream', 'Arn')
29
+ * EventSourceArn: cf.getAtt('MyStream', 'Arn'),
30
30
  * });
31
31
  *
32
- * module.exports = cf.merge(myTemplate, lambda);
32
+ * // This lambda only gets invoked for 'INSERT' events for the DynamoDb event source
33
+ * const lambdaWithFilterCriteria = new cf.shortcuts.StreamLambda({
34
+ * LogicalName: 'MyLambdaWithFilterCriteria',
35
+ * Code: {
36
+ * S3Bucket: 'my-code-bucket',
37
+ * S3Key: 'path/to/code.zip'
38
+ * },
39
+ * EventSourceArn: cf.getAtt('MyDynamoDbStream', 'Arn'),
40
+ * FilterCriteria: {
41
+ * Filters: [
42
+ * {
43
+ * Pattern: JSON.stringify({ eventName: ['INSERT'] }),
44
+ * }
45
+ * ]
46
+ * }
47
+ * });
48
+ *
49
+ * module.exports = cf.merge(myTemplate, lambda, lambdaWithFilterCriteria);
33
50
  */
34
51
  class StreamLambda extends Lambda {
35
52
  constructor(options) {
@@ -68,9 +85,6 @@ class StreamLambda extends Lambda {
68
85
  if (!(FilterCriteria.Filters && Array.isArray(FilterCriteria.Filters))){
69
86
  throw new Error('`FilterCriteria` must contain property `Filter` of type array');
70
87
  }
71
- if (FilterCriteria.Filters.length > 5){
72
- throw new Error('`FilterCriteria.Filter` cannot contain more than 5 items, you may request a quota increase with AWS support if required.');
73
- }
74
88
  for (const filter of FilterCriteria.Filters){
75
89
  if (!filter.Pattern){
76
90
  throw new Error('An object in `FilterCriteria.Filter` was missing the required property `Pattern`');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mapbox/cloudfriend",
3
- "version": "8.1.0-dev.2",
3
+ "version": "8.1.0",
4
4
  "description": "Helper functions for assembling CloudFormation templates in JavaScript",
5
5
  "main": "index.js",
6
6
  "engines": {
@@ -538,39 +538,6 @@ test('[shortcuts] StreamLambda FilterCriteria', (assert) => {
538
538
  }),
539
539
  '`FilterCriteria` must contain property `Filter` of type array',
540
540
  );
541
- assert.throws(
542
- () => new cf.shortcuts.StreamLambda({
543
- LogicalName: 'MyLambda',
544
- Code: {
545
- S3Bucket: 'my-code-bucket',
546
- S3Key: 'path/to/code.zip'
547
- },
548
- EventSourceArn: 'arn:aws:kinesis:us-east-1:123456789012:stream/fake',
549
- FilterCriteria: {
550
- Filters: [
551
- {
552
- Pattern: JSON.stringify({ eventName: ['1'] })
553
- },
554
- {
555
- Pattern: JSON.stringify({ eventName: ['2'] })
556
- },
557
- {
558
- Pattern: JSON.stringify({ eventName: ['3'] })
559
- },
560
- {
561
- Pattern: JSON.stringify({ eventName: ['4'] })
562
- },
563
- {
564
- Pattern: JSON.stringify({ eventName: ['5'] })
565
- },
566
- {
567
- Pattern: JSON.stringify({ eventName: ['6'] })
568
- }
569
- ]
570
- }
571
- }),
572
- '`FilterCriteria.Filter` cannot contain more than 5 items, you may request a quota increase with AWS support if required.',
573
- );
574
541
  assert.throws(
575
542
  () => new cf.shortcuts.StreamLambda({
576
543
  LogicalName: 'MyLambda',
@@ -1,12 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="WEB_MODULE" version="4">
3
- <component name="NewModuleRootManager">
4
- <content url="file://$MODULE_DIR$">
5
- <excludeFolder url="file://$MODULE_DIR$/temp" />
6
- <excludeFolder url="file://$MODULE_DIR$/.tmp" />
7
- <excludeFolder url="file://$MODULE_DIR$/tmp" />
8
- </content>
9
- <orderEntry type="inheritedJdk" />
10
- <orderEntry type="sourceFolder" forTests="false" />
11
- </component>
12
- </module>
@@ -1,6 +0,0 @@
1
- <component name="InspectionProjectProfileManager">
2
- <profile version="1.0">
3
- <option name="myName" value="Project Default" />
4
- <inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
5
- </profile>
6
- </component>
package/.idea/modules.xml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/cloudfriend.iml" filepath="$PROJECT_DIR$/.idea/cloudfriend.iml" />
6
- </modules>
7
- </component>
8
- </project>
package/.idea/vcs.xml DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
- </component>
6
- </project>