@gradientedge/cdk-utils 7.16.0 → 7.17.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/dist/src/lib/construct/api-to-eventbridge-target/main.js +1 -1
- package/dist/src/lib/manager/aws/lambda-manager.js +2 -2
- package/dist/src/lib/manager/aws/sqs-manager.js +22 -15
- package/dist/src/lib/types/aws/index.d.ts +6 -6
- package/package.json +2 -2
- package/src/lib/construct/api-to-eventbridge-target/main.ts +1 -1
- package/src/lib/manager/aws/lambda-manager.ts +2 -2
- package/src/lib/manager/aws/sqs-manager.ts +19 -17
- package/src/lib/types/aws/index.ts +6 -6
|
@@ -220,7 +220,7 @@ class ApiToEventBridgeTarget extends common_1.CommonConstruct {
|
|
|
220
220
|
"EventBusName": "${this.apiEvent.eventBus.eventBusName}",
|
|
221
221
|
"Source": "api-to-eventbridge-target",
|
|
222
222
|
"DetailType": "$util.escapeJavaScript($context.domainName)$util.escapeJavaScript($context.resourcePath)",
|
|
223
|
-
"Detail": "$util.escapeJavaScript($input.body).replaceAll("
|
|
223
|
+
"Detail": "$util.escapeJavaScript($input.body).replaceAll("\\\\'","'")"
|
|
224
224
|
}
|
|
225
225
|
]
|
|
226
226
|
}`,
|
|
@@ -89,7 +89,7 @@ class LambdaManager {
|
|
|
89
89
|
throw `Lambda props undefined for ${id}`;
|
|
90
90
|
const functionName = `${props.functionName}-${scope.props.stage}`;
|
|
91
91
|
let deadLetterQueue;
|
|
92
|
-
if (props.deadLetterQueueEnabled
|
|
92
|
+
if (props.deadLetterQueueEnabled) {
|
|
93
93
|
const redriveQueue = scope.sqsManager.createRedriveQueueForLambda(`${id}-rdq`, scope, props);
|
|
94
94
|
deadLetterQueue = scope.sqsManager.createDeadLetterQueueForLambda(`${id}-dlq`, scope, props, redriveQueue);
|
|
95
95
|
}
|
|
@@ -164,7 +164,7 @@ class LambdaManager {
|
|
|
164
164
|
throw `Lambda props undefined for ${id}`;
|
|
165
165
|
const functionName = `${props.functionName}-${scope.props.stage}`;
|
|
166
166
|
let deadLetterQueue;
|
|
167
|
-
if (props.deadLetterQueueEnabled
|
|
167
|
+
if (props.deadLetterQueueEnabled) {
|
|
168
168
|
const redriveQueue = scope.sqsManager.createRedriveQueueForLambda(`${id}-rdq`, scope, props);
|
|
169
169
|
deadLetterQueue = scope.sqsManager.createDeadLetterQueueForLambda(`${id}-dlq`, scope, props, redriveQueue);
|
|
170
170
|
}
|
|
@@ -62,27 +62,29 @@ class SqsManager {
|
|
|
62
62
|
queueName: props.queueName,
|
|
63
63
|
visibilityTimeout: props.visibilityTimeoutInSecs
|
|
64
64
|
? cdk.Duration.seconds(props.visibilityTimeoutInSecs)
|
|
65
|
-
:
|
|
65
|
+
: props.visibilityTimeout,
|
|
66
66
|
receiveMessageWaitTime: props.receiveMessageWaitTimeInSecs
|
|
67
67
|
? cdk.Duration.seconds(props.receiveMessageWaitTimeInSecs)
|
|
68
|
-
:
|
|
68
|
+
: props.receiveMessageWaitTime,
|
|
69
69
|
contentBasedDeduplication: props.contentBasedDeduplication,
|
|
70
|
-
dataKeyReuse: props.dataKeyReuseInSecs ? cdk.Duration.seconds(props.dataKeyReuseInSecs) :
|
|
70
|
+
dataKeyReuse: props.dataKeyReuseInSecs ? cdk.Duration.seconds(props.dataKeyReuseInSecs) : props.dataKeyReuse,
|
|
71
71
|
deadLetterQueue: !deadLetterQueue
|
|
72
72
|
? undefined
|
|
73
73
|
: {
|
|
74
74
|
queue: deadLetterQueue,
|
|
75
|
-
maxReceiveCount: props.maxReceiveCount,
|
|
75
|
+
maxReceiveCount: props.maxReceiveCount ?? 5,
|
|
76
76
|
},
|
|
77
77
|
deduplicationScope: props.deduplicationScope,
|
|
78
|
-
deliveryDelay: props.deliveryDelayInSecs
|
|
78
|
+
deliveryDelay: props.deliveryDelayInSecs
|
|
79
|
+
? cdk.Duration.seconds(props.deliveryDelayInSecs)
|
|
80
|
+
: cdk.Duration.minutes(15),
|
|
79
81
|
encryption: props.encryption,
|
|
80
82
|
encryptionMasterKey: props.encryptionMasterKey,
|
|
81
83
|
fifo: props.fifo,
|
|
82
84
|
fifoThroughputLimit: props.fifoThroughputLimit,
|
|
83
85
|
maxMessageSizeBytes: props.maxMessageSizeBytes,
|
|
84
86
|
removalPolicy: props.removalPolicy ?? cdk.RemovalPolicy.DESTROY,
|
|
85
|
-
retentionPeriod: cdk.Duration.days(props.retentionInDays),
|
|
87
|
+
retentionPeriod: props.retentionInDays ? cdk.Duration.days(props.retentionInDays) : cdk.Duration.days(7),
|
|
86
88
|
});
|
|
87
89
|
utils.createCfnOutput(`${id}-queueArn`, scope, queue.queueArn);
|
|
88
90
|
utils.createCfnOutput(`${id}-queueName`, scope, queue.queueName);
|
|
@@ -96,8 +98,6 @@ class SqsManager {
|
|
|
96
98
|
* @param {types.LambdaProps} props the lambda properties
|
|
97
99
|
*/
|
|
98
100
|
createRedriveQueueForLambda(id, scope, props) {
|
|
99
|
-
if (!props.redriveq)
|
|
100
|
-
throw `Redrive queue props for Lambda undefined`;
|
|
101
101
|
return this.createQueue(`${id}`, scope, {
|
|
102
102
|
...props.redriveq,
|
|
103
103
|
...{
|
|
@@ -113,14 +113,21 @@ class SqsManager {
|
|
|
113
113
|
* @param {sqs.IQueue} deadLetterQueue
|
|
114
114
|
*/
|
|
115
115
|
createDeadLetterQueueForLambda(id, scope, props, deadLetterQueue) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
116
|
+
let queueProps;
|
|
117
|
+
if (props.dlq) {
|
|
118
|
+
queueProps = {
|
|
119
|
+
...props.dlq,
|
|
120
|
+
...{
|
|
121
|
+
queueName: `${props.functionName}-dlq-${scope.props.stage}`,
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
queueProps = {
|
|
121
127
|
queueName: `${props.functionName}-dlq-${scope.props.stage}`,
|
|
122
|
-
}
|
|
123
|
-
}
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
return this.createQueue(`${id}`, scope, queueProps, deadLetterQueue);
|
|
124
131
|
}
|
|
125
132
|
}
|
|
126
133
|
exports.SqsManager = SqsManager;
|
|
@@ -678,11 +678,11 @@ export interface ElastiCacheProps extends elasticache.CfnCacheClusterProps {
|
|
|
678
678
|
* @subcategory Properties
|
|
679
679
|
*/
|
|
680
680
|
export interface QueueProps extends sqs.QueueProps {
|
|
681
|
-
maxReceiveCount
|
|
682
|
-
visibilityTimeoutInSecs
|
|
683
|
-
receiveMessageWaitTimeInSecs
|
|
684
|
-
dataKeyReuseInSecs
|
|
685
|
-
deliveryDelayInSecs
|
|
686
|
-
retentionInDays
|
|
681
|
+
maxReceiveCount?: number;
|
|
682
|
+
visibilityTimeoutInSecs?: number;
|
|
683
|
+
receiveMessageWaitTimeInSecs?: number;
|
|
684
|
+
dataKeyReuseInSecs?: number;
|
|
685
|
+
deliveryDelayInSecs?: number;
|
|
686
|
+
retentionInDays?: number;
|
|
687
687
|
}
|
|
688
688
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gradientedge/cdk-utils",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.17.0",
|
|
4
4
|
"description": "Utilities for AWS CDK provisioning",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"engines": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"postinstall": "npx lerna run init",
|
|
38
38
|
"prettier": "npx prettier --check \"**/*.{ts,json,md}\"",
|
|
39
39
|
"prettify": "npx prettier --write \"**/*.{ts,json,md}\"",
|
|
40
|
-
"test": "rimraf coverage && npx jest --ci --
|
|
40
|
+
"test": "rimraf coverage && npx jest --ci --maxWorkers=100%",
|
|
41
41
|
"update:deps": "ncu -u -x lerna",
|
|
42
42
|
"validate": "yarn prettier && yarn test"
|
|
43
43
|
},
|
|
@@ -240,7 +240,7 @@ export class ApiToEventBridgeTarget extends CommonConstruct {
|
|
|
240
240
|
"EventBusName": "${this.apiEvent.eventBus.eventBusName}",
|
|
241
241
|
"Source": "api-to-eventbridge-target",
|
|
242
242
|
"DetailType": "$util.escapeJavaScript($context.domainName)$util.escapeJavaScript($context.resourcePath)",
|
|
243
|
-
"Detail": "$util.escapeJavaScript($input.body).replaceAll("
|
|
243
|
+
"Detail": "$util.escapeJavaScript($input.body).replaceAll("\\\\'","'")"
|
|
244
244
|
}
|
|
245
245
|
]
|
|
246
246
|
}`,
|
|
@@ -87,7 +87,7 @@ export class LambdaManager {
|
|
|
87
87
|
const functionName = `${props.functionName}-${scope.props.stage}`
|
|
88
88
|
|
|
89
89
|
let deadLetterQueue
|
|
90
|
-
if (props.deadLetterQueueEnabled
|
|
90
|
+
if (props.deadLetterQueueEnabled) {
|
|
91
91
|
const redriveQueue = scope.sqsManager.createRedriveQueueForLambda(`${id}-rdq`, scope, props)
|
|
92
92
|
deadLetterQueue = scope.sqsManager.createDeadLetterQueueForLambda(`${id}-dlq`, scope, props, redriveQueue)
|
|
93
93
|
}
|
|
@@ -206,7 +206,7 @@ export class LambdaManager {
|
|
|
206
206
|
const functionName = `${props.functionName}-${scope.props.stage}`
|
|
207
207
|
|
|
208
208
|
let deadLetterQueue
|
|
209
|
-
if (props.deadLetterQueueEnabled
|
|
209
|
+
if (props.deadLetterQueueEnabled) {
|
|
210
210
|
const redriveQueue = scope.sqsManager.createRedriveQueueForLambda(`${id}-rdq`, scope, props)
|
|
211
211
|
deadLetterQueue = scope.sqsManager.createDeadLetterQueueForLambda(`${id}-dlq`, scope, props, redriveQueue)
|
|
212
212
|
}
|
|
@@ -39,27 +39,29 @@ export class SqsManager {
|
|
|
39
39
|
queueName: props.queueName,
|
|
40
40
|
visibilityTimeout: props.visibilityTimeoutInSecs
|
|
41
41
|
? cdk.Duration.seconds(props.visibilityTimeoutInSecs)
|
|
42
|
-
:
|
|
42
|
+
: props.visibilityTimeout,
|
|
43
43
|
receiveMessageWaitTime: props.receiveMessageWaitTimeInSecs
|
|
44
44
|
? cdk.Duration.seconds(props.receiveMessageWaitTimeInSecs)
|
|
45
|
-
:
|
|
45
|
+
: props.receiveMessageWaitTime,
|
|
46
46
|
contentBasedDeduplication: props.contentBasedDeduplication,
|
|
47
|
-
dataKeyReuse: props.dataKeyReuseInSecs ? cdk.Duration.seconds(props.dataKeyReuseInSecs) :
|
|
47
|
+
dataKeyReuse: props.dataKeyReuseInSecs ? cdk.Duration.seconds(props.dataKeyReuseInSecs) : props.dataKeyReuse,
|
|
48
48
|
deadLetterQueue: !deadLetterQueue
|
|
49
49
|
? undefined
|
|
50
50
|
: {
|
|
51
51
|
queue: deadLetterQueue,
|
|
52
|
-
maxReceiveCount: props.maxReceiveCount,
|
|
52
|
+
maxReceiveCount: props.maxReceiveCount ?? 5,
|
|
53
53
|
},
|
|
54
54
|
deduplicationScope: props.deduplicationScope,
|
|
55
|
-
deliveryDelay: props.deliveryDelayInSecs
|
|
55
|
+
deliveryDelay: props.deliveryDelayInSecs
|
|
56
|
+
? cdk.Duration.seconds(props.deliveryDelayInSecs)
|
|
57
|
+
: cdk.Duration.minutes(15),
|
|
56
58
|
encryption: props.encryption,
|
|
57
59
|
encryptionMasterKey: props.encryptionMasterKey,
|
|
58
60
|
fifo: props.fifo,
|
|
59
61
|
fifoThroughputLimit: props.fifoThroughputLimit,
|
|
60
62
|
maxMessageSizeBytes: props.maxMessageSizeBytes,
|
|
61
63
|
removalPolicy: props.removalPolicy ?? cdk.RemovalPolicy.DESTROY,
|
|
62
|
-
retentionPeriod: cdk.Duration.days(props.retentionInDays),
|
|
64
|
+
retentionPeriod: props.retentionInDays ? cdk.Duration.days(props.retentionInDays) : cdk.Duration.days(7),
|
|
63
65
|
})
|
|
64
66
|
|
|
65
67
|
utils.createCfnOutput(`${id}-queueArn`, scope, queue.queueArn)
|
|
@@ -76,8 +78,6 @@ export class SqsManager {
|
|
|
76
78
|
* @param {types.LambdaProps} props the lambda properties
|
|
77
79
|
*/
|
|
78
80
|
public createRedriveQueueForLambda(id: string, scope: common.CommonConstruct, props: types.LambdaProps) {
|
|
79
|
-
if (!props.redriveq) throw `Redrive queue props for Lambda undefined`
|
|
80
|
-
|
|
81
81
|
return this.createQueue(`${id}`, scope, {
|
|
82
82
|
...props.redriveq,
|
|
83
83
|
...{
|
|
@@ -99,18 +99,20 @@ export class SqsManager {
|
|
|
99
99
|
props: types.LambdaProps,
|
|
100
100
|
deadLetterQueue: sqs.IQueue
|
|
101
101
|
) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
`${id}`,
|
|
106
|
-
scope,
|
|
107
|
-
{
|
|
102
|
+
let queueProps
|
|
103
|
+
if (props.dlq) {
|
|
104
|
+
queueProps = {
|
|
108
105
|
...props.dlq,
|
|
109
106
|
...{
|
|
110
107
|
queueName: `${props.functionName}-dlq-${scope.props.stage}`,
|
|
111
108
|
},
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
109
|
+
}
|
|
110
|
+
} else {
|
|
111
|
+
queueProps = {
|
|
112
|
+
queueName: `${props.functionName}-dlq-${scope.props.stage}`,
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return this.createQueue(`${id}`, scope, queueProps, deadLetterQueue)
|
|
115
117
|
}
|
|
116
118
|
}
|
|
@@ -721,10 +721,10 @@ export interface ElastiCacheProps extends elasticache.CfnCacheClusterProps {}
|
|
|
721
721
|
* @subcategory Properties
|
|
722
722
|
*/
|
|
723
723
|
export interface QueueProps extends sqs.QueueProps {
|
|
724
|
-
maxReceiveCount
|
|
725
|
-
visibilityTimeoutInSecs
|
|
726
|
-
receiveMessageWaitTimeInSecs
|
|
727
|
-
dataKeyReuseInSecs
|
|
728
|
-
deliveryDelayInSecs
|
|
729
|
-
retentionInDays
|
|
724
|
+
maxReceiveCount?: number
|
|
725
|
+
visibilityTimeoutInSecs?: number
|
|
726
|
+
receiveMessageWaitTimeInSecs?: number
|
|
727
|
+
dataKeyReuseInSecs?: number
|
|
728
|
+
deliveryDelayInSecs?: number
|
|
729
|
+
retentionInDays?: number
|
|
730
730
|
}
|