@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.
- package/.nyc_output/c5b5c951-37d5-4058-a3e4-939c91352f33.json +1 -0
- package/.nyc_output/d9683579-e4df-4a8c-916b-585093031713.json +1 -0
- package/.nyc_output/processinfo/c5b5c951-37d5-4058-a3e4-939c91352f33.json +1 -0
- package/.nyc_output/processinfo/d9683579-e4df-4a8c-916b-585093031713.json +1 -0
- package/.nyc_output/processinfo/index.json +1 -1
- package/changelog.md +1 -1
- package/lib/shortcuts/api.md +19 -2
- package/lib/shortcuts/stream-lambda.js +19 -5
- package/package.json +1 -1
- package/test/shortcuts.test.js +0 -33
- package/.idea/cloudfriend.iml +0 -12
- package/.idea/inspectionProfiles/Project_Default.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/vcs.xml +0 -6
- package/.nyc_output/35aa325a-f140-4f80-9616-95761c59175e.json +0 -1
- package/.nyc_output/processinfo/35aa325a-f140-4f80-9616-95761c59175e.json +0 -1
|
@@ -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
|
-
*
|
|
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
package/test/shortcuts.test.js
CHANGED
|
@@ -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',
|
package/.idea/cloudfriend.iml
DELETED
|
@@ -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>
|
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>
|