@gradientedge/cdk-utils 6.2.0 → 6.3.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.
@@ -81,6 +81,11 @@ export declare class StaticSite extends CommonConstruct {
81
81
  * @protected
82
82
  */
83
83
  protected createSiteDistribution(): void;
84
+ /**
85
+ * Method to invalidation the cloudfront distribution cache after a deployment
86
+ * @protected
87
+ */
88
+ protected invalidateDistributionCache(): void;
84
89
  /**
85
90
  * @summary Method to create route53 records for static site
86
91
  * @protected
@@ -80,6 +80,7 @@ class StaticSite extends common_1.CommonConstruct {
80
80
  this.createSiteCloudfrontFunction();
81
81
  this.resolveSiteFunctionAssociations();
82
82
  this.createSiteDistribution();
83
+ this.invalidateDistributionCache();
83
84
  this.createSiteRouteAssets();
84
85
  this.deploySite();
85
86
  }
@@ -151,6 +152,15 @@ class StaticSite extends common_1.CommonConstruct {
151
152
  throw 'SiteDistribution props undefined';
152
153
  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);
153
154
  }
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
+ }
154
164
  /**
155
165
  * @summary Method to create route53 records for static site
156
166
  * @protected
@@ -82,6 +82,7 @@ export interface SiteWithEcsBackendProps extends CommonStackProps {
82
82
  * @subcategory Properties
83
83
  */
84
84
  export interface StaticSiteProps extends CommonStackProps {
85
+ siteCacheInvalidationDockerFilePath?: string;
85
86
  siteCreateAltARecord: boolean;
86
87
  siteCertificate: AcmProps;
87
88
  siteBucket: S3BucketProps;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradientedge/cdk-utils",
3
- "version": "6.2.0",
3
+ "version": "6.3.0",
4
4
  "description": "Utilities for AWS CDK provisioning",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -46,11 +46,11 @@
46
46
  },
47
47
  "dependencies": {
48
48
  "@types/lodash": "^4.14.182",
49
- "@types/node": "^18.6.4",
50
- "app-root-path": "^3.0.0",
51
- "aws-cdk-lib": "^2.35.0",
52
- "aws-sdk": "^2.1189.0",
53
- "constructs": "^10.1.67",
49
+ "@types/node": "^18.7.6",
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",
54
54
  "lodash": "^4.17.21",
55
55
  "moment": "^2.29.4",
56
56
  "nconf": "^0.12.0",
@@ -59,16 +59,16 @@
59
59
  },
60
60
  "devDependencies": {
61
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",
62
+ "@types/jest": "^28.1.7",
63
+ "@typescript-eslint/eslint-plugin": "^5.33.1",
64
+ "@typescript-eslint/parser": "^5.33.1",
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
69
  "commitizen": "^4.2.5",
70
70
  "dotenv": "^16.0.1",
71
- "eslint": "^8.21.0",
71
+ "eslint": "^8.22.0",
72
72
  "eslint-config-prettier": "^8.5.0",
73
73
  "eslint-plugin-import": "^2.26.0",
74
74
  "husky": "^8.0.1",
@@ -78,12 +78,12 @@
78
78
  "jsdoc": "^3.6.11",
79
79
  "jsdoc-babel": "^0.5.0",
80
80
  "jsdoc-mermaid": "^1.0.0",
81
- "lerna": "^5.3.0",
81
+ "lerna": "^5.4.2",
82
82
  "prettier": "^2.7.1",
83
- "prettier-plugin-organize-imports": "^3.0.1",
83
+ "prettier-plugin-organize-imports": "^3.0.3",
84
84
  "rimraf": "^3.0.2",
85
85
  "semantic-release": "^19.0.3",
86
- "ts-jest": "^28.0.7",
86
+ "ts-jest": "^28.0.8",
87
87
  "ts-node": "^10.9.1",
88
88
  "typescript": "4.7.4"
89
89
  },
@@ -64,6 +64,7 @@ export class StaticSite extends CommonConstruct {
64
64
  this.createSiteCloudfrontFunction()
65
65
  this.resolveSiteFunctionAssociations()
66
66
  this.createSiteDistribution()
67
+ this.invalidateDistributionCache()
67
68
  this.createSiteRouteAssets()
68
69
  this.deploySite()
69
70
  }
@@ -174,6 +175,21 @@ export class StaticSite extends CommonConstruct {
174
175
  )
175
176
  }
176
177
 
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
+
177
193
  /**
178
194
  * @summary Method to create route53 records for static site
179
195
  * @protected
@@ -86,6 +86,7 @@ export interface SiteWithEcsBackendProps extends CommonStackProps {
86
86
  * @subcategory Properties
87
87
  */
88
88
  export interface StaticSiteProps extends CommonStackProps {
89
+ siteCacheInvalidationDockerFilePath?: string
89
90
  siteCreateAltARecord: boolean
90
91
  siteCertificate: AcmProps
91
92
  siteBucket: S3BucketProps