@gradientedge/cdk-utils 8.66.0 → 8.68.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.
@@ -27,6 +27,7 @@ exports.LambdaManager = void 0;
27
27
  const cdk = __importStar(require("aws-cdk-lib"));
28
28
  const iam = __importStar(require("aws-cdk-lib/aws-iam"));
29
29
  const lambda = __importStar(require("aws-cdk-lib/aws-lambda"));
30
+ const eventSources = __importStar(require("aws-cdk-lib/aws-lambda-event-sources"));
30
31
  const common_1 = require("../../common");
31
32
  const utils = __importStar(require("../../utils"));
32
33
  const cloudfront_manager_1 = require("./cloudfront-manager");
@@ -126,6 +127,12 @@ class LambdaManager {
126
127
  insightsVersion: props.insightsVersion,
127
128
  },
128
129
  });
130
+ if (lambdaFunction.deadLetterQueue && props.dlq?.retriesEnabled) {
131
+ lambdaFunction.addEventSource(new eventSources.SqsEventSource(lambdaFunction.deadLetterQueue, {
132
+ reportBatchItemFailures: true,
133
+ batchSize: props.dlq.retryBatchSize ?? 1,
134
+ }));
135
+ }
129
136
  if (props.lambdaAliases && props.lambdaAliases.length > 0) {
130
137
  props.lambdaAliases.forEach(alias => {
131
138
  const aliasId = alias.id ?? `${id}-${alias.aliasName}`;
@@ -218,6 +225,12 @@ class LambdaManager {
218
225
  insightsVersion: props.insightsVersion,
219
226
  },
220
227
  });
228
+ if (lambdaFunction.deadLetterQueue && props.dlq?.retriesEnabled) {
229
+ lambdaFunction.addEventSource(new eventSources.SqsEventSource(lambdaFunction.deadLetterQueue, {
230
+ reportBatchItemFailures: true,
231
+ batchSize: props.dlq.retryBatchSize ?? 1,
232
+ }));
233
+ }
221
234
  utils.createCfnOutput(`${id}-lambdaArn`, scope, lambdaFunction.functionArn);
222
235
  utils.createCfnOutput(`${id}-lambdaName`, scope, lambdaFunction.functionName);
223
236
  return lambdaFunction;
@@ -845,5 +845,7 @@ export interface QueueProps extends sqs.QueueProps {
845
845
  deliveryDelayInSecs?: number;
846
846
  retentionInDays?: number;
847
847
  tags?: TagProps[];
848
+ retriesEnabled?: boolean;
849
+ retryBatchSize?: number;
848
850
  }
849
851
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradientedge/cdk-utils",
3
- "version": "8.66.0",
3
+ "version": "8.68.0",
4
4
  "description": "Utilities for AWS CDK provisioning",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -46,13 +46,13 @@
46
46
  }
47
47
  },
48
48
  "dependencies": {
49
- "@aws-sdk/client-secrets-manager": "^3.338.0",
49
+ "@aws-sdk/client-secrets-manager": "^3.341.0",
50
50
  "@types/lodash": "^4.14.195",
51
- "@types/node": "^20.2.4",
51
+ "@types/node": "^20.2.5",
52
52
  "@types/uuid": "^9.0.1",
53
53
  "app-root-path": "^3.1.0",
54
54
  "aws-cdk-lib": "^2.81.0",
55
- "constructs": "^10.2.33",
55
+ "constructs": "^10.2.37",
56
56
  "lodash": "^4.17.21",
57
57
  "moment": "^2.29.4",
58
58
  "nconf": "^0.12.0",
@@ -61,12 +61,12 @@
61
61
  "uuid": "^9.0.0"
62
62
  },
63
63
  "devDependencies": {
64
- "@babel/core": "^7.21.8",
64
+ "@babel/core": "^7.22.1",
65
65
  "@babel/eslint-parser": "^7.21.8",
66
66
  "@babel/plugin-proposal-class-properties": "^7.18.6",
67
67
  "@types/jest": "^29.5.1",
68
- "@typescript-eslint/eslint-plugin": "^5.59.7",
69
- "@typescript-eslint/parser": "^5.59.7",
68
+ "@typescript-eslint/eslint-plugin": "^5.59.8",
69
+ "@typescript-eslint/parser": "^5.59.8",
70
70
  "aws-cdk": "^2.81.0",
71
71
  "better-docs": "^2.7.2",
72
72
  "codecov": "^3.8.3",
@@ -76,7 +76,7 @@
76
76
  "eslint": "^8.41.0",
77
77
  "eslint-config-prettier": "^8.8.0",
78
78
  "eslint-plugin-import": "^2.27.5",
79
- "eslint-plugin-jsdoc": "^44.2.5",
79
+ "eslint-plugin-jsdoc": "^45.0.0",
80
80
  "husky": "^8.0.3",
81
81
  "jest": "^29.5.0",
82
82
  "jest-extended": "^3.2.4",
@@ -3,6 +3,7 @@ import * as ec2 from 'aws-cdk-lib/aws-ec2'
3
3
  import * as efs from 'aws-cdk-lib/aws-efs'
4
4
  import * as iam from 'aws-cdk-lib/aws-iam'
5
5
  import * as lambda from 'aws-cdk-lib/aws-lambda'
6
+ import * as eventSources from 'aws-cdk-lib/aws-lambda-event-sources'
6
7
  import * as common from '../../common'
7
8
  import { CommonStack } from '../../common'
8
9
  import * as types from '../../types'
@@ -130,6 +131,15 @@ export class LambdaManager {
130
131
  },
131
132
  })
132
133
 
134
+ if (lambdaFunction.deadLetterQueue && props.dlq?.retriesEnabled) {
135
+ lambdaFunction.addEventSource(
136
+ new eventSources.SqsEventSource(lambdaFunction.deadLetterQueue, {
137
+ reportBatchItemFailures: true,
138
+ batchSize: props.dlq.retryBatchSize ?? 1,
139
+ })
140
+ )
141
+ }
142
+
133
143
  if (props.lambdaAliases && props.lambdaAliases.length > 0) {
134
144
  props.lambdaAliases.forEach(alias => {
135
145
  const aliasId = alias.id ?? `${id}-${alias.aliasName}`
@@ -271,6 +281,15 @@ export class LambdaManager {
271
281
  },
272
282
  })
273
283
 
284
+ if (lambdaFunction.deadLetterQueue && props.dlq?.retriesEnabled) {
285
+ lambdaFunction.addEventSource(
286
+ new eventSources.SqsEventSource(lambdaFunction.deadLetterQueue, {
287
+ reportBatchItemFailures: true,
288
+ batchSize: props.dlq.retryBatchSize ?? 1,
289
+ })
290
+ )
291
+ }
292
+
274
293
  utils.createCfnOutput(`${id}-lambdaArn`, scope, lambdaFunction.functionArn)
275
294
  utils.createCfnOutput(`${id}-lambdaName`, scope, lambdaFunction.functionName)
276
295
 
@@ -906,4 +906,6 @@ export interface QueueProps extends sqs.QueueProps {
906
906
  deliveryDelayInSecs?: number
907
907
  retentionInDays?: number
908
908
  tags?: TagProps[]
909
+ retriesEnabled?: boolean
910
+ retryBatchSize?: number
909
911
  }