@gradientedge/cdk-utils 5.12.0 → 6.0.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.
Files changed (41) hide show
  1. package/dist/src/lib/construct/api-to-eventbridge-target/index.d.ts +0 -3
  2. package/dist/src/lib/construct/api-to-eventbridge-target/index.js +0 -3
  3. package/dist/src/lib/construct/api-to-eventbridge-target/main.d.ts +23 -68
  4. package/dist/src/lib/construct/api-to-eventbridge-target/main.js +120 -241
  5. package/dist/src/lib/construct/{api-to-eventbridge-target → api-to-eventbridge-target-with-sns}/api-destined-lambda.d.ts +1 -1
  6. package/dist/src/lib/construct/{api-to-eventbridge-target → api-to-eventbridge-target-with-sns}/api-destined-lambda.js +1 -1
  7. package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/index.d.ts +2 -0
  8. package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/index.js +18 -0
  9. package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/main.d.ts +193 -0
  10. package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/main.js +631 -0
  11. package/dist/src/lib/construct/index.d.ts +1 -0
  12. package/dist/src/lib/construct/index.js +1 -0
  13. package/dist/src/lib/construct/site-with-ecs-backend/main.d.ts +0 -7
  14. package/dist/src/lib/construct/site-with-ecs-backend/main.js +1 -12
  15. package/dist/src/lib/construct/static-site/main.d.ts +0 -7
  16. package/dist/src/lib/construct/static-site/main.js +1 -12
  17. package/dist/src/lib/{construct/api-to-eventbridge-target/api-destination-event.d.ts → helper/api-to-eventbridge-target-event.d.ts} +5 -3
  18. package/dist/src/lib/{construct/api-to-eventbridge-target/api-destination-event.js → helper/api-to-eventbridge-target-event.js} +6 -4
  19. package/dist/src/lib/{construct/api-to-eventbridge-target/api-destined-rest-api.d.ts → helper/api-to-eventbridge-target-rest-api.d.ts} +4 -4
  20. package/dist/src/lib/{construct/api-to-eventbridge-target/api-destined-rest-api.js → helper/api-to-eventbridge-target-rest-api.js} +5 -5
  21. package/dist/src/lib/helper/index.d.ts +2 -0
  22. package/dist/src/lib/helper/index.js +18 -0
  23. package/dist/src/lib/manager/aws/cloudfront-manager.d.ts +3 -6
  24. package/dist/src/lib/manager/aws/cloudfront-manager.js +6 -9
  25. package/dist/src/lib/manager/aws/sqs-manager.js +9 -6
  26. package/dist/src/lib/types/aws/index.d.ts +10 -7
  27. package/package.json +24 -24
  28. package/src/lib/construct/api-to-eventbridge-target/index.ts +0 -3
  29. package/src/lib/construct/api-to-eventbridge-target/main.ts +127 -278
  30. package/src/lib/construct/{api-to-eventbridge-target → api-to-eventbridge-target-with-sns}/api-destined-lambda.ts +1 -1
  31. package/src/lib/construct/api-to-eventbridge-target-with-sns/index.ts +2 -0
  32. package/src/lib/construct/api-to-eventbridge-target-with-sns/main.ts +703 -0
  33. package/src/lib/construct/index.ts +1 -0
  34. package/src/lib/construct/site-with-ecs-backend/main.ts +1 -15
  35. package/src/lib/construct/static-site/main.ts +1 -15
  36. package/src/lib/{construct/api-to-eventbridge-target/api-destination-event.ts → helper/api-to-eventbridge-target-event.ts} +5 -3
  37. package/src/lib/{construct/api-to-eventbridge-target/api-destined-rest-api.ts → helper/api-to-eventbridge-target-rest-api.ts} +4 -4
  38. package/src/lib/helper/index.ts +2 -0
  39. package/src/lib/manager/aws/cloudfront-manager.ts +6 -12
  40. package/src/lib/manager/aws/sqs-manager.ts +9 -6
  41. package/src/lib/types/aws/index.ts +10 -7
@@ -80,7 +80,6 @@ class SiteWithEcsBackend extends common_1.CommonConstruct {
80
80
  siteDomainNames;
81
81
  siteCloudfrontFunction;
82
82
  siteFunctionAssociations;
83
- siteWebAcl;
84
83
  constructor(parent, id, props) {
85
84
  super(parent, id, props);
86
85
  this.props = props;
@@ -108,7 +107,6 @@ class SiteWithEcsBackend extends common_1.CommonConstruct {
108
107
  this.createSiteOrigin();
109
108
  this.createSiteCloudfrontFunction();
110
109
  this.resolveSiteFunctionAssociations();
111
- this.createSiteWebAcl();
112
110
  this.createDistribution();
113
111
  this.createNetworkMappings();
114
112
  this.invalidateDistributionCache();
@@ -307,21 +305,12 @@ class SiteWithEcsBackend extends common_1.CommonConstruct {
307
305
  ];
308
306
  }
309
307
  }
310
- /**
311
- * @summary Method to create WAF
312
- * @protected
313
- */
314
- createSiteWebAcl() {
315
- if (!this.props.siteWebAcl)
316
- throw 'SiteWebAcl props undefined';
317
- this.siteWebAcl = this.wafManager.createWebAcl(`${this.id}-waf`, this, this.props.siteWebAcl);
318
- }
319
308
  /**
320
309
  * Method to create Site distribution
321
310
  * @protected
322
311
  */
323
312
  createDistribution() {
324
- this.siteDistribution = this.cloudFrontManager.createDistributionWithHttpOrigin(`${this.id}-distribution`, this, this.props.siteDistribution, this.siteOrigin, this.siteDomainNames, this.siteLogBucket, this.siteCertificate, this.siteFunctionAssociations, this.siteWebAcl.attrId);
313
+ this.siteDistribution = this.cloudFrontManager.createDistributionWithHttpOrigin(`${this.id}-distribution`, this, this.props.siteDistribution, this.siteOrigin, this.siteDomainNames, this.siteLogBucket, this.siteCertificate, this.siteFunctionAssociations);
325
314
  }
326
315
  /**
327
316
  * Method to create Route53 records for distribution
@@ -3,7 +3,6 @@ import * as cloudfront from 'aws-cdk-lib/aws-cloudfront';
3
3
  import * as origins from 'aws-cdk-lib/aws-cloudfront-origins';
4
4
  import * as route53 from 'aws-cdk-lib/aws-route53';
5
5
  import * as s3 from 'aws-cdk-lib/aws-s3';
6
- import * as wafv2 from 'aws-cdk-lib/aws-wafv2';
7
6
  import { Construct } from 'constructs';
8
7
  import { CommonConstruct } from '../../common';
9
8
  import { StaticSiteProps } from '../../types';
@@ -40,7 +39,6 @@ export declare class StaticSite extends CommonConstruct {
40
39
  siteOriginAccessIdentity: cloudfront.OriginAccessIdentity;
41
40
  siteCloudfrontFunction: cloudfront.Function;
42
41
  siteFunctionAssociations: cloudfront.FunctionAssociation[];
43
- siteWebAcl: wafv2.CfnWebACL;
44
42
  constructor(parent: Construct, id: string, props: StaticSiteProps);
45
43
  /**
46
44
  * @summary Initialise and provision resources
@@ -78,11 +76,6 @@ export declare class StaticSite extends CommonConstruct {
78
76
  * @protected
79
77
  */
80
78
  protected resolveSiteFunctionAssociations(): void;
81
- /**
82
- * @summary Method to create WAF
83
- * @protected
84
- */
85
- protected createSiteWebAcl(): void;
86
79
  /**
87
80
  * @summary Method to create a site cloudfront distribution
88
81
  * @protected
@@ -62,7 +62,6 @@ class StaticSite extends common_1.CommonConstruct {
62
62
  siteOriginAccessIdentity;
63
63
  siteCloudfrontFunction;
64
64
  siteFunctionAssociations;
65
- siteWebAcl;
66
65
  constructor(parent, id, props) {
67
66
  super(parent, id, props);
68
67
  this.props = props;
@@ -80,7 +79,6 @@ class StaticSite extends common_1.CommonConstruct {
80
79
  this.createSiteOrigin();
81
80
  this.createSiteCloudfrontFunction();
82
81
  this.resolveSiteFunctionAssociations();
83
- this.createSiteWebAcl();
84
82
  this.createSiteDistribution();
85
83
  this.createSiteRouteAssets();
86
84
  this.deploySite();
@@ -144,15 +142,6 @@ class StaticSite extends common_1.CommonConstruct {
144
142
  ];
145
143
  }
146
144
  }
147
- /**
148
- * @summary Method to create WAF
149
- * @protected
150
- */
151
- createSiteWebAcl() {
152
- if (!this.props.siteWebAcl)
153
- throw 'SiteWebAcl props undefined';
154
- this.siteWebAcl = this.wafManager.createWebAcl(`${this.id}-waf`, this, this.props.siteWebAcl);
155
- }
156
145
  /**
157
146
  * @summary Method to create a site cloudfront distribution
158
147
  * @protected
@@ -160,7 +149,7 @@ class StaticSite extends common_1.CommonConstruct {
160
149
  createSiteDistribution() {
161
150
  if (!this.props.siteDistribution)
162
151
  throw 'SiteDistribution props undefined';
163
- this.siteDistribution = this.cloudFrontManager.createDistributionWithS3Origin(`${this.id}-distribution`, this, this.props.siteDistribution, this.siteOrigin, this.siteBucket, this.siteLogBucket, this.siteOriginAccessIdentity, this.siteCertificate, this.props.siteAliases, this.siteFunctionAssociations, this.siteWebAcl.attrId);
152
+ this.siteDistribution = this.cloudFrontManager.createDistributionWithS3Origin(`${this.id}-distribution`, this, this.props.siteDistribution, this.siteOrigin, this.siteBucket, this.siteLogBucket, this.siteOriginAccessIdentity, this.siteCertificate, this.props.siteAliases, this.siteFunctionAssociations);
164
153
  }
165
154
  /**
166
155
  * @summary Method to create route53 records for static site
@@ -1,16 +1,18 @@
1
1
  import * as events from 'aws-cdk-lib/aws-events';
2
2
  import * as logs from 'aws-cdk-lib/aws-logs';
3
- import * as types from '../../types/aws';
3
+ import * as types from '../types/aws';
4
4
  /**
5
5
  * @stability stable
6
6
  * @category cdk-utils.api-to-eventbridge-target
7
7
  * @subcategory member
8
- * @classdesc Provides a construct to contain event resources for ApiToEventBridgeTarget
8
+ * @classdesc Provides a construct to contain event resources for ApiToEventBridgeTargetWithSns
9
9
  */
10
- export declare class ApiDestinationEvent implements types.ApiDestinationEventType {
10
+ export declare class ApiToEventbridgeTargetEvent implements types.ApiToEventBridgeTargetEventType {
11
11
  eventBus: events.IEventBus;
12
+ logGroup: logs.LogGroup;
12
13
  logGroupFailure: logs.LogGroup;
13
14
  logGroupSuccess: logs.LogGroup;
15
+ rule: events.Rule;
14
16
  ruleFailure: events.Rule;
15
17
  ruleSuccess: events.Rule;
16
18
  }
@@ -1,17 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ApiDestinationEvent = void 0;
3
+ exports.ApiToEventbridgeTargetEvent = void 0;
4
4
  /**
5
5
  * @stability stable
6
6
  * @category cdk-utils.api-to-eventbridge-target
7
7
  * @subcategory member
8
- * @classdesc Provides a construct to contain event resources for ApiToEventBridgeTarget
8
+ * @classdesc Provides a construct to contain event resources for ApiToEventBridgeTargetWithSns
9
9
  */
10
- class ApiDestinationEvent {
10
+ class ApiToEventbridgeTargetEvent {
11
11
  eventBus;
12
+ logGroup;
12
13
  logGroupFailure;
13
14
  logGroupSuccess;
15
+ rule;
14
16
  ruleFailure;
15
17
  ruleSuccess;
16
18
  }
17
- exports.ApiDestinationEvent = ApiDestinationEvent;
19
+ exports.ApiToEventbridgeTargetEvent = ApiToEventbridgeTargetEvent;
@@ -3,14 +3,14 @@ import * as acm from 'aws-cdk-lib/aws-certificatemanager';
3
3
  import * as iam from 'aws-cdk-lib/aws-iam';
4
4
  import * as route53 from 'aws-cdk-lib/aws-route53';
5
5
  import * as sns from 'aws-cdk-lib/aws-sns';
6
- import * as types from '../../types/aws';
6
+ import * as types from '../types/aws';
7
7
  /**
8
8
  * @stability stable
9
9
  * @category cdk-utils.api-to-eventbridge-target
10
10
  * @subcategory member
11
- * @classdesc Provides a construct to contain api resources for ApiToEventBridgeTarget
11
+ * @classdesc Provides a construct to contain api resources for ApiToEventBridgeTargetWithSns
12
12
  */
13
- export declare class ApiDestinedRestApi implements types.ApiDestinedRestApiType {
13
+ export declare class ApiToEventbridgeTargetRestApi implements types.ApiToEventBridgeTargetRestApiType {
14
14
  api: apig.RestApi;
15
15
  certificate: acm.ICertificate;
16
16
  domain: apig.DomainName;
@@ -31,5 +31,5 @@ export declare class ApiDestinedRestApi implements types.ApiDestinedRestApiType
31
31
  resource: apig.Resource;
32
32
  responseModel: apig.Model;
33
33
  topic: sns.Topic;
34
- topicRole: iam.Role;
34
+ role: iam.Role;
35
35
  }
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ApiDestinedRestApi = void 0;
3
+ exports.ApiToEventbridgeTargetRestApi = void 0;
4
4
  /**
5
5
  * @stability stable
6
6
  * @category cdk-utils.api-to-eventbridge-target
7
7
  * @subcategory member
8
- * @classdesc Provides a construct to contain api resources for ApiToEventBridgeTarget
8
+ * @classdesc Provides a construct to contain api resources for ApiToEventBridgeTargetWithSns
9
9
  */
10
- class ApiDestinedRestApi {
10
+ class ApiToEventbridgeTargetRestApi {
11
11
  api;
12
12
  certificate;
13
13
  domain;
@@ -24,6 +24,6 @@ class ApiDestinedRestApi {
24
24
  resource;
25
25
  responseModel;
26
26
  topic;
27
- topicRole;
27
+ role;
28
28
  }
29
- exports.ApiDestinedRestApi = ApiDestinedRestApi;
29
+ exports.ApiToEventbridgeTargetRestApi = ApiToEventbridgeTargetRestApi;
@@ -0,0 +1,2 @@
1
+ export * from './api-to-eventbridge-target-event';
2
+ export * from './api-to-eventbridge-target-rest-api';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./api-to-eventbridge-target-event"), exports);
18
+ __exportStar(require("./api-to-eventbridge-target-rest-api"), exports);
@@ -49,9 +49,8 @@ export declare class CloudFrontManager {
49
49
  * @param {cloudfront.OriginAccessIdentity?} oai
50
50
  * @param {acm.ICertificate?} certificate
51
51
  * @param {string[]?} aliases
52
- * @param {string?} webAclId
53
52
  */
54
- createCloudFrontDistribution(id: string, scope: common.CommonConstruct, props: types.CloudFrontProps, siteBucket?: s3.IBucket, logBucket?: s3.IBucket, oai?: cloudfront.OriginAccessIdentity, certificate?: acm.ICertificate, aliases?: string[], webAclId?: string): cdk.aws_cloudfront.CloudFrontWebDistribution;
53
+ createCloudFrontDistribution(id: string, scope: common.CommonConstruct, props: types.CloudFrontProps, siteBucket?: s3.IBucket, logBucket?: s3.IBucket, oai?: cloudfront.OriginAccessIdentity, certificate?: acm.ICertificate, aliases?: string[]): cdk.aws_cloudfront.CloudFrontWebDistribution;
55
54
  /**
56
55
  * Method to create a CloudFront distribution with S3 Origin
57
56
  * @param {string} id scoped id of the resource
@@ -64,9 +63,8 @@ export declare class CloudFrontManager {
64
63
  * @param {acm.ICertificate?} certificate
65
64
  * @param {string[]?} aliases
66
65
  * @param {cloudfront.FunctionAssociation?} defaultFunctionAssociations
67
- * @param {string?} webAclId
68
66
  */
69
- createDistributionWithS3Origin(id: string, scope: common.CommonConstruct, props: types.DistributionProps, origin: origins.S3Origin, siteBucket: s3.IBucket, logBucket?: s3.IBucket, oai?: cloudfront.OriginAccessIdentity, certificate?: acm.ICertificate, aliases?: string[], defaultFunctionAssociations?: cloudfront.FunctionAssociation[], webAclId?: string): cdk.aws_cloudfront.Distribution;
67
+ createDistributionWithS3Origin(id: string, scope: common.CommonConstruct, props: types.DistributionProps, origin: origins.S3Origin, siteBucket: s3.IBucket, logBucket?: s3.IBucket, oai?: cloudfront.OriginAccessIdentity, certificate?: acm.ICertificate, aliases?: string[], defaultFunctionAssociations?: cloudfront.FunctionAssociation[]): cdk.aws_cloudfront.Distribution;
70
68
  /**
71
69
  * Method to create a CloudFront distribution with HTTP Origin
72
70
  * @param {string} id scoped id of the resource
@@ -77,9 +75,8 @@ export declare class CloudFrontManager {
77
75
  * @param {s3.IBucket?} logBucket
78
76
  * @param {acm.ICertificate?} certificate
79
77
  * @param {cloudfront.FunctionAssociation?} defaultFunctionAssociations
80
- * @param {string?} webAclId
81
78
  */
82
- createDistributionWithHttpOrigin(id: string, scope: common.CommonConstruct, props: types.DistributionProps, origin: origins.HttpOrigin, domainNames: string[], logBucket?: s3.IBucket, certificate?: acm.ICertificate, defaultFunctionAssociations?: cloudfront.FunctionAssociation[], webAclId?: string): cdk.aws_cloudfront.Distribution;
79
+ createDistributionWithHttpOrigin(id: string, scope: common.CommonConstruct, props: types.DistributionProps, origin: origins.HttpOrigin, domainNames: string[], logBucket?: s3.IBucket, certificate?: acm.ICertificate, defaultFunctionAssociations?: cloudfront.FunctionAssociation[]): cdk.aws_cloudfront.Distribution;
83
80
  /**
84
81
  * @summary Method to provision a Lambda@Edge function
85
82
  *
@@ -78,9 +78,8 @@ class CloudFrontManager {
78
78
  * @param {cloudfront.OriginAccessIdentity?} oai
79
79
  * @param {acm.ICertificate?} certificate
80
80
  * @param {string[]?} aliases
81
- * @param {string?} webAclId
82
81
  */
83
- createCloudFrontDistribution(id, scope, props, siteBucket, logBucket, oai, certificate, aliases, webAclId) {
82
+ createCloudFrontDistribution(id, scope, props, siteBucket, logBucket, oai, certificate, aliases) {
84
83
  if (!siteBucket)
85
84
  throw `SiteBucket not defined`;
86
85
  if (!certificate)
@@ -114,7 +113,7 @@ class CloudFrontManager {
114
113
  securityPolicy: cloudfront.SecurityPolicyProtocol.TLS_V1_1_2016,
115
114
  sslMethod: cloudfront.SSLMethod.SNI,
116
115
  }),
117
- webACLId: webAclId,
116
+ webACLId: props.webACLId,
118
117
  });
119
118
  utils.createCfnOutput(`${id}-distributionId`, scope, distribution.distributionId);
120
119
  utils.createCfnOutput(`${id}-distributionDomainName`, scope, distribution.distributionDomainName);
@@ -132,9 +131,8 @@ class CloudFrontManager {
132
131
  * @param {acm.ICertificate?} certificate
133
132
  * @param {string[]?} aliases
134
133
  * @param {cloudfront.FunctionAssociation?} defaultFunctionAssociations
135
- * @param {string?} webAclId
136
134
  */
137
- createDistributionWithS3Origin(id, scope, props, origin, siteBucket, logBucket, oai, certificate, aliases, defaultFunctionAssociations, webAclId) {
135
+ createDistributionWithS3Origin(id, scope, props, origin, siteBucket, logBucket, oai, certificate, aliases, defaultFunctionAssociations) {
138
136
  const distribution = new cloudfront.Distribution(scope, `${id}`, {
139
137
  certificate: certificate,
140
138
  comment: `${id} - ${scope.props.stage} stage`,
@@ -159,7 +157,7 @@ class CloudFrontManager {
159
157
  logFilePrefix: props.logFilePrefix ?? `edge/`,
160
158
  minimumProtocolVersion: props.minimumProtocolVersion ?? cloudfront.SecurityPolicyProtocol.TLS_V1_2_2021,
161
159
  priceClass: props.priceClass ?? cloudfront.PriceClass.PRICE_CLASS_ALL,
162
- webAclId: webAclId,
160
+ webAclId: props.webAclId,
163
161
  });
164
162
  utils.createCfnOutput(`${id}-distributionId`, scope, distribution.distributionId);
165
163
  utils.createCfnOutput(`${id}-distributionDomainName`, scope, distribution.distributionDomainName);
@@ -175,9 +173,8 @@ class CloudFrontManager {
175
173
  * @param {s3.IBucket?} logBucket
176
174
  * @param {acm.ICertificate?} certificate
177
175
  * @param {cloudfront.FunctionAssociation?} defaultFunctionAssociations
178
- * @param {string?} webAclId
179
176
  */
180
- createDistributionWithHttpOrigin(id, scope, props, origin, domainNames, logBucket, certificate, defaultFunctionAssociations, webAclId) {
177
+ createDistributionWithHttpOrigin(id, scope, props, origin, domainNames, logBucket, certificate, defaultFunctionAssociations) {
181
178
  const distribution = new cloudfront.Distribution(scope, `${id}`, {
182
179
  certificate: certificate,
183
180
  comment: `${id} - ${scope.props.stage} stage`,
@@ -202,7 +199,7 @@ class CloudFrontManager {
202
199
  logFilePrefix: props.logFilePrefix ?? `edge/`,
203
200
  minimumProtocolVersion: props.minimumProtocolVersion ?? cloudfront.SecurityPolicyProtocol.TLS_V1_2_2021,
204
201
  priceClass: props.priceClass ?? cloudfront.PriceClass.PRICE_CLASS_ALL,
205
- webAclId: webAclId,
202
+ webAclId: props.webAclId,
206
203
  });
207
204
  utils.createCfnOutput(`${id}-distributionId`, scope, distribution.distributionId);
208
205
  utils.createCfnOutput(`${id}-distributionDomainName`, scope, distribution.distributionDomainName);
@@ -60,10 +60,14 @@ class SqsManager {
60
60
  throw `Queue props undefined`;
61
61
  const queue = new sqs.Queue(scope, id, {
62
62
  queueName: props.queueName,
63
- visibilityTimeout: cdk.Duration.seconds(props.visibilityTimeoutInSecs),
64
- receiveMessageWaitTime: cdk.Duration.seconds(props.receiveMessageWaitTimeInSecs),
63
+ visibilityTimeout: props.visibilityTimeoutInSecs
64
+ ? cdk.Duration.seconds(props.visibilityTimeoutInSecs)
65
+ : undefined,
66
+ receiveMessageWaitTime: props.receiveMessageWaitTimeInSecs
67
+ ? cdk.Duration.seconds(props.receiveMessageWaitTimeInSecs)
68
+ : undefined,
65
69
  contentBasedDeduplication: props.contentBasedDeduplication,
66
- dataKeyReuse: cdk.Duration.seconds(props.dataKeyReuseInSecs),
70
+ dataKeyReuse: props.dataKeyReuseInSecs ? cdk.Duration.seconds(props.dataKeyReuseInSecs) : undefined,
67
71
  deadLetterQueue: !deadLetterQueue
68
72
  ? undefined
69
73
  : {
@@ -71,7 +75,7 @@ class SqsManager {
71
75
  maxReceiveCount: props.maxReceiveCount,
72
76
  },
73
77
  deduplicationScope: props.deduplicationScope,
74
- deliveryDelay: cdk.Duration.seconds(props.deliveryDelayInSecs),
78
+ deliveryDelay: props.deliveryDelayInSecs ? cdk.Duration.seconds(props.deliveryDelayInSecs) : undefined,
75
79
  encryption: props.encryption,
76
80
  encryptionMasterKey: props.encryptionMasterKey,
77
81
  fifo: props.fifo,
@@ -92,10 +96,9 @@ class SqsManager {
92
96
  * @param {types.LambdaProps} props the lambda properties
93
97
  */
94
98
  createRedriveQueueForLambda(id, scope, props) {
95
- if (!props.dlq || !props.redriveq)
99
+ if (!props.redriveq)
96
100
  throw `Redrive queue props for Lambda undefined`;
97
101
  return this.createQueue(`${id}`, scope, {
98
- ...props.dlq,
99
102
  ...props.redriveq,
100
103
  ...{
101
104
  queueName: `${props.functionName}-redriveq-${scope.props.stage}`,
@@ -72,7 +72,6 @@ export interface SiteWithEcsBackendProps extends CommonStackProps {
72
72
  siteSubDomain: string;
73
73
  siteTask: ecsPatterns.ApplicationLoadBalancedFargateServiceProps;
74
74
  siteVpc: ec2.VpcProps;
75
- siteWebAcl?: WafWebACLProps;
76
75
  useExistingHostedZone: boolean;
77
76
  nodeEnv: string;
78
77
  logLevel: string;
@@ -95,7 +94,6 @@ export interface StaticSiteProps extends CommonStackProps {
95
94
  siteRecordName?: string;
96
95
  siteSubDomain?: string;
97
96
  siteAliases?: string[];
98
- siteWebAcl?: WafWebACLProps;
99
97
  useExistingHostedZone: boolean;
100
98
  nodeEnv: string;
101
99
  logLevel: string;
@@ -227,10 +225,12 @@ export interface GraphQlApiLambdaWithCacheProps extends GraphQlApiLambdaProps {
227
225
  * @category cdk-utils.api-to-eventbridge-target
228
226
  * @subcategory Types
229
227
  */
230
- export interface ApiDestinationEventType {
228
+ export interface ApiToEventBridgeTargetEventType {
231
229
  eventBus: events.IEventBus;
230
+ logGroup: logs.LogGroup;
232
231
  logGroupFailure: logs.LogGroup;
233
232
  logGroupSuccess: logs.LogGroup;
233
+ rule: events.Rule;
234
234
  ruleFailure: events.Rule;
235
235
  ruleSuccess: events.Rule;
236
236
  }
@@ -238,7 +238,7 @@ export interface ApiDestinationEventType {
238
238
  * @category cdk-utils.api-to-eventbridge-target
239
239
  * @subcategory Types
240
240
  */
241
- export interface ApiDestinedRestApiType {
241
+ export interface ApiToEventBridgeTargetRestApiType {
242
242
  api: apig.IRestApi;
243
243
  authoriser?: apig.IAuthorizer;
244
244
  certificate: acm.ICertificate;
@@ -259,8 +259,9 @@ export interface ApiDestinedRestApiType {
259
259
  methodResponse: apig.MethodResponse;
260
260
  resource: apig.Resource;
261
261
  responseModel: apig.Model;
262
- topic: sns.ITopic;
263
- topicRole: iam.Role;
262
+ topic?: sns.ITopic;
263
+ role?: iam.Role;
264
+ policy?: iam.PolicyDocument;
264
265
  }
265
266
  /**
266
267
  * @category cdk-utils.api-to-eventbridge-target
@@ -313,8 +314,10 @@ interface ApiToEventBridgeTargetLambdaProps {
313
314
  */
314
315
  interface ApiToEventBridgeTargetEventProps {
315
316
  eventBusName?: string;
317
+ logGroup?: LogProps;
316
318
  logGroupSuccess?: LogProps;
317
319
  logGroupFailure?: LogProps;
320
+ rule: EventRuleProps;
318
321
  ruleSuccess: EventRuleProps;
319
322
  ruleFailure: EventRuleProps;
320
323
  }
@@ -327,7 +330,7 @@ export interface ApiToEventBridgeTargetProps extends CommonStackProps {
327
330
  apiSubDomain: string;
328
331
  api: ApiToEventBridgeTargetRestApiProps;
329
332
  event: ApiToEventBridgeTargetEventProps;
330
- lambda: ApiToEventBridgeTargetLambdaProps;
333
+ lambda?: ApiToEventBridgeTargetLambdaProps;
331
334
  logLevel: string;
332
335
  nodeEnv: string;
333
336
  timezone: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradientedge/cdk-utils",
3
- "version": "5.12.0",
3
+ "version": "6.0.0",
4
4
  "description": "Utilities for AWS CDK provisioning",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -46,52 +46,52 @@
46
46
  },
47
47
  "dependencies": {
48
48
  "@types/lodash": "^4.14.182",
49
- "@types/node": "^18.0.0",
49
+ "@types/node": "^18.6.4",
50
50
  "app-root-path": "^3.0.0",
51
- "aws-cdk-lib": "^2.28.1",
52
- "aws-sdk": "^2.1158.0",
53
- "constructs": "^10.1.42",
51
+ "aws-cdk-lib": "^2.35.0",
52
+ "aws-sdk": "^2.1189.0",
53
+ "constructs": "^10.1.67",
54
54
  "lodash": "^4.17.21",
55
- "moment": "^2.29.3",
55
+ "moment": "^2.29.4",
56
56
  "nconf": "^0.12.0",
57
57
  "pluralize": "^8.0.0",
58
- "ts-node": "^10.8.1"
58
+ "ts-node": "^10.9.1"
59
59
  },
60
60
  "devDependencies": {
61
- "@babel/plugin-proposal-class-properties": "^7.17.12",
62
- "@types/jest": "^28.1.2",
63
- "@typescript-eslint/eslint-plugin": "^5.29.0",
64
- "@typescript-eslint/parser": "^5.29.0",
61
+ "@babel/plugin-proposal-class-properties": "^7.18.6",
62
+ "@types/jest": "^28.1.6",
63
+ "@typescript-eslint/eslint-plugin": "^5.32.0",
64
+ "@typescript-eslint/parser": "^5.32.0",
65
65
  "aws-cdk": "*",
66
66
  "babel-eslint": "^10.1.0",
67
67
  "better-docs": "^2.7.2",
68
68
  "codecov": "^3.8.3",
69
- "commitizen": "^4.2.4",
69
+ "commitizen": "^4.2.5",
70
70
  "dotenv": "^16.0.1",
71
- "eslint": "^8.18.0",
71
+ "eslint": "^8.21.0",
72
72
  "eslint-config-prettier": "^8.5.0",
73
73
  "eslint-plugin-import": "^2.26.0",
74
74
  "husky": "^8.0.1",
75
- "jest": "^28.1.1",
76
- "jest-extended": "^2.0.0",
77
- "jest-junit": "^13.2.0",
78
- "jsdoc": "^3.6.10",
75
+ "jest": "^28.1.3",
76
+ "jest-extended": "^3.0.2",
77
+ "jest-junit": "^14.0.0",
78
+ "jsdoc": "^3.6.11",
79
79
  "jsdoc-babel": "^0.5.0",
80
80
  "jsdoc-mermaid": "^1.0.0",
81
- "lerna": "^5.1.4",
81
+ "lerna": "^5.3.0",
82
82
  "prettier": "^2.7.1",
83
- "prettier-plugin-organize-imports": "^3.0.0",
83
+ "prettier-plugin-organize-imports": "^3.0.1",
84
84
  "rimraf": "^3.0.2",
85
85
  "semantic-release": "^19.0.3",
86
- "ts-jest": "^28.0.5",
87
- "ts-node": "^10.8.1",
86
+ "ts-jest": "^28.0.7",
87
+ "ts-node": "^10.9.1",
88
88
  "typescript": "4.7.4"
89
89
  },
90
90
  "optionalDependencies": {
91
- "@babel/core": "^7.18.5",
91
+ "@babel/core": "^7.18.10",
92
92
  "prop-types": "^15.8.1",
93
- "react": "^17.0.2",
94
- "react-dom": "^17.0.2"
93
+ "react": "^18.2.0",
94
+ "react-dom": "^18.2.0"
95
95
  },
96
96
  "config": {
97
97
  "commitizen": {
@@ -1,4 +1 @@
1
- export * from './api-destination-event'
2
- export * from './api-destined-lambda'
3
- export * from './api-destined-rest-api'
4
1
  export * from './main'