@gradientedge/cdk-utils 6.3.0 → 6.5.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.
@@ -31,10 +31,9 @@ export declare class StaticSite extends CommonConstruct {
31
31
  siteHostedZone: route53.IHostedZone;
32
32
  siteCertificate: certificateManager.ICertificate;
33
33
  siteARecord: route53.ARecord;
34
- siteARecordAlt: route53.ARecord;
35
34
  siteBucket: s3.IBucket;
36
35
  siteOrigin: origins.S3Origin;
37
- siteDistribution: cloudfront.Distribution;
36
+ siteDistribution: cloudfront.IDistribution;
38
37
  siteLogBucket: s3.IBucket;
39
38
  siteOriginAccessIdentity: cloudfront.OriginAccessIdentity;
40
39
  siteCloudfrontFunction: cloudfront.Function;
@@ -77,15 +76,15 @@ export declare class StaticSite extends CommonConstruct {
77
76
  */
78
77
  protected resolveSiteFunctionAssociations(): void;
79
78
  /**
80
- * @summary Method to create a site cloudfront distribution
79
+ * @summary Method to create a site origin access identity
81
80
  * @protected
82
81
  */
83
- protected createSiteDistribution(): void;
82
+ protected createSiteOriginAccessIdentity(): void;
84
83
  /**
85
- * Method to invalidation the cloudfront distribution cache after a deployment
84
+ * @summary Method to create a site cloudfront distribution
86
85
  * @protected
87
86
  */
88
- protected invalidateDistributionCache(): void;
87
+ protected createSiteDistribution(): void;
89
88
  /**
90
89
  * @summary Method to create route53 records for static site
91
90
  * @protected
@@ -96,4 +95,9 @@ export declare class StaticSite extends CommonConstruct {
96
95
  * @protected
97
96
  */
98
97
  protected deploySite(): void;
98
+ /**
99
+ * Method to invalidation the cloudfront distribution cache after a deployment
100
+ * @protected
101
+ */
102
+ protected invalidateDistributionCache(): void;
99
103
  }
@@ -54,7 +54,6 @@ class StaticSite extends common_1.CommonConstruct {
54
54
  siteHostedZone;
55
55
  siteCertificate;
56
56
  siteARecord;
57
- siteARecordAlt;
58
57
  siteBucket;
59
58
  siteOrigin;
60
59
  siteDistribution;
@@ -79,10 +78,11 @@ class StaticSite extends common_1.CommonConstruct {
79
78
  this.createSiteOrigin();
80
79
  this.createSiteCloudfrontFunction();
81
80
  this.resolveSiteFunctionAssociations();
81
+ this.createSiteOriginAccessIdentity();
82
82
  this.createSiteDistribution();
83
- this.invalidateDistributionCache();
84
83
  this.createSiteRouteAssets();
85
84
  this.deploySite();
85
+ this.invalidateDistributionCache();
86
86
  }
87
87
  /**
88
88
  * @summary Method to resolve a hosted zone based on domain attributes
@@ -143,6 +143,11 @@ class StaticSite extends common_1.CommonConstruct {
143
143
  ];
144
144
  }
145
145
  }
146
+ /**
147
+ * @summary Method to create a site origin access identity
148
+ * @protected
149
+ */
150
+ createSiteOriginAccessIdentity() { }
146
151
  /**
147
152
  * @summary Method to create a site cloudfront distribution
148
153
  * @protected
@@ -152,15 +157,6 @@ class StaticSite extends common_1.CommonConstruct {
152
157
  throw 'SiteDistribution props undefined';
153
158
  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);
154
159
  }
155
- /**
156
- * Method to invalidation the cloudfront distribution cache after a deployment
157
- * @protected
158
- */
159
- invalidateDistributionCache() {
160
- if (this.props.siteCacheInvalidationDockerFilePath) {
161
- this.cloudFrontManager.invalidateCache(`${this.id}-cache-invalidation`, this, this.props.siteCacheInvalidationDockerFilePath, this.siteDistribution.distributionId);
162
- }
163
- }
164
160
  /**
165
161
  * @summary Method to create route53 records for static site
166
162
  * @protected
@@ -175,5 +171,14 @@ class StaticSite extends common_1.CommonConstruct {
175
171
  deploySite() {
176
172
  this.s3Manager.doBucketDeployment(`${this.id}-deployment`, this, this.siteBucket, this.siteDistribution, [this.props.siteSource], '', true);
177
173
  }
174
+ /**
175
+ * Method to invalidation the cloudfront distribution cache after a deployment
176
+ * @protected
177
+ */
178
+ invalidateDistributionCache() {
179
+ if (this.props.siteCacheInvalidationDockerFilePath) {
180
+ this.cloudFrontManager.invalidateCache(`${this.id}-cache-invalidation`, this, this.props.siteCacheInvalidationDockerFilePath, this.siteDistribution.distributionId);
181
+ }
182
+ }
178
183
  }
179
184
  exports.StaticSite = StaticSite;
@@ -38,8 +38,6 @@ import * as types from '../../types';
38
38
  export declare class CloudFrontManager {
39
39
  createOriginAccessIdentity(id: string, scope: common.CommonConstruct, accessBucket?: s3.IBucket): cdk.aws_cloudfront.OriginAccessIdentity;
40
40
  /**
41
- * @deprecated Use `createDistributionWithS3Origin` instead
42
- *
43
41
  * @summary Method to create a cloudfront distribution
44
42
  * @param {string} id scoped id of the resource
45
43
  * @param {common.CommonConstruct} scope scope in which this resource is defined
@@ -67,8 +67,6 @@ class CloudFrontManager {
67
67
  return oai;
68
68
  }
69
69
  /**
70
- * @deprecated Use `createDistributionWithS3Origin` instead
71
- *
72
70
  * @summary Method to create a cloudfront distribution
73
71
  * @param {string} id scoped id of the resource
74
72
  * @param {common.CommonConstruct} scope scope in which this resource is defined
@@ -103,6 +103,7 @@ class LambdaManager {
103
103
  deadLetterQueue: deadLetterQueue,
104
104
  environment: {
105
105
  REGION: scope.props.region,
106
+ LAST_MODIFIED_TS: new Date().toISOString(),
106
107
  ...environment,
107
108
  },
108
109
  filesystem: accessPoint
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradientedge/cdk-utils",
3
- "version": "6.3.0",
3
+ "version": "6.5.0",
4
4
  "description": "Utilities for AWS CDK provisioning",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -45,12 +45,12 @@
45
45
  }
46
46
  },
47
47
  "dependencies": {
48
- "@types/lodash": "^4.14.182",
49
- "@types/node": "^18.7.6",
48
+ "@types/lodash": "^4.14.184",
49
+ "@types/node": "^18.7.9",
50
50
  "app-root-path": "^3.1.0",
51
- "aws-cdk-lib": "^2.37.1",
52
- "aws-sdk": "^2.1195.0",
53
- "constructs": "^10.1.77",
51
+ "aws-cdk-lib": "^2.38.1",
52
+ "aws-sdk": "^2.1199.0",
53
+ "constructs": "^10.1.83",
54
54
  "lodash": "^4.17.21",
55
55
  "moment": "^2.29.4",
56
56
  "nconf": "^0.12.0",
@@ -78,11 +78,11 @@
78
78
  "jsdoc": "^3.6.11",
79
79
  "jsdoc-babel": "^0.5.0",
80
80
  "jsdoc-mermaid": "^1.0.0",
81
- "lerna": "^5.4.2",
81
+ "lerna": "^5.4.3",
82
82
  "prettier": "^2.7.1",
83
- "prettier-plugin-organize-imports": "^3.0.3",
83
+ "prettier-plugin-organize-imports": "^3.1.0",
84
84
  "rimraf": "^3.0.2",
85
- "semantic-release": "^19.0.3",
85
+ "semantic-release": "^19.0.4",
86
86
  "ts-jest": "^28.0.8",
87
87
  "ts-node": "^10.9.1",
88
88
  "typescript": "4.7.4"
@@ -35,10 +35,9 @@ export class StaticSite extends CommonConstruct {
35
35
  siteHostedZone: route53.IHostedZone
36
36
  siteCertificate: certificateManager.ICertificate
37
37
  siteARecord: route53.ARecord
38
- siteARecordAlt: route53.ARecord
39
38
  siteBucket: s3.IBucket
40
39
  siteOrigin: origins.S3Origin
41
- siteDistribution: cloudfront.Distribution
40
+ siteDistribution: cloudfront.IDistribution
42
41
  siteLogBucket: s3.IBucket
43
42
  siteOriginAccessIdentity: cloudfront.OriginAccessIdentity
44
43
  siteCloudfrontFunction: cloudfront.Function
@@ -63,10 +62,11 @@ export class StaticSite extends CommonConstruct {
63
62
  this.createSiteOrigin()
64
63
  this.createSiteCloudfrontFunction()
65
64
  this.resolveSiteFunctionAssociations()
65
+ this.createSiteOriginAccessIdentity()
66
66
  this.createSiteDistribution()
67
- this.invalidateDistributionCache()
68
67
  this.createSiteRouteAssets()
69
68
  this.deploySite()
69
+ this.invalidateDistributionCache()
70
70
  }
71
71
 
72
72
  /**
@@ -154,6 +154,12 @@ export class StaticSite extends CommonConstruct {
154
154
  }
155
155
  }
156
156
 
157
+ /**
158
+ * @summary Method to create a site origin access identity
159
+ * @protected
160
+ */
161
+ protected createSiteOriginAccessIdentity() {}
162
+
157
163
  /**
158
164
  * @summary Method to create a site cloudfront distribution
159
165
  * @protected
@@ -175,21 +181,6 @@ export class StaticSite extends CommonConstruct {
175
181
  )
176
182
  }
177
183
 
178
- /**
179
- * Method to invalidation the cloudfront distribution cache after a deployment
180
- * @protected
181
- */
182
- protected invalidateDistributionCache() {
183
- if (this.props.siteCacheInvalidationDockerFilePath) {
184
- this.cloudFrontManager.invalidateCache(
185
- `${this.id}-cache-invalidation`,
186
- this,
187
- this.props.siteCacheInvalidationDockerFilePath,
188
- this.siteDistribution.distributionId
189
- )
190
- }
191
- }
192
-
193
184
  /**
194
185
  * @summary Method to create route53 records for static site
195
186
  * @protected
@@ -220,4 +211,19 @@ export class StaticSite extends CommonConstruct {
220
211
  true
221
212
  )
222
213
  }
214
+
215
+ /**
216
+ * Method to invalidation the cloudfront distribution cache after a deployment
217
+ * @protected
218
+ */
219
+ protected invalidateDistributionCache() {
220
+ if (this.props.siteCacheInvalidationDockerFilePath) {
221
+ this.cloudFrontManager.invalidateCache(
222
+ `${this.id}-cache-invalidation`,
223
+ this,
224
+ this.props.siteCacheInvalidationDockerFilePath,
225
+ this.siteDistribution.distributionId
226
+ )
227
+ }
228
+ }
223
229
  }
@@ -50,8 +50,6 @@ export class CloudFrontManager {
50
50
  }
51
51
 
52
52
  /**
53
- * @deprecated Use `createDistributionWithS3Origin` instead
54
- *
55
53
  * @summary Method to create a cloudfront distribution
56
54
  * @param {string} id scoped id of the resource
57
55
  * @param {common.CommonConstruct} scope scope in which this resource is defined
@@ -102,6 +102,7 @@ export class LambdaManager {
102
102
  deadLetterQueue: deadLetterQueue,
103
103
  environment: {
104
104
  REGION: scope.props.region,
105
+ LAST_MODIFIED_TS: new Date().toISOString(),
105
106
  ...environment,
106
107
  },
107
108
  filesystem: accessPoint