carlin 3.0.0 → 3.0.2
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/index.mjs +42 -5
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -3763,12 +3763,37 @@ const BUCKET_CORS_CONFIGURATION = { CorsRules: [{
|
|
|
3763
3763
|
Id: "OpenCors",
|
|
3764
3764
|
MaxAge: 600
|
|
3765
3765
|
}] };
|
|
3766
|
+
const CLOUDFRONT_CACHE_POLICY_LOGICAL_ID = "CachePolicy";
|
|
3766
3767
|
/**
|
|
3767
|
-
*
|
|
3768
|
-
*
|
|
3769
|
-
*
|
|
3768
|
+
* CloudFront compresses only when the cache policy accepts gzip/brotli, which
|
|
3769
|
+
* `Managed-CachingDisabled` cannot. Each deploy invalidates `/*`.
|
|
3770
|
+
*
|
|
3771
|
+
* `Managed-CachingOptimized` would leave `Origin` and the
|
|
3772
|
+
* `Access-Control-Request-*` headers out of the cache key, so a response cached
|
|
3773
|
+
* for a same-origin request would answer a CORS one without CORS headers when
|
|
3774
|
+
* they come from the bucket (`vary` in `responseHeaders`).
|
|
3775
|
+
*
|
|
3776
|
+
* https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/ServingCompressedFiles.html
|
|
3770
3777
|
*/
|
|
3771
|
-
const
|
|
3778
|
+
const CACHE_POLICY_CONFIG = {
|
|
3779
|
+
DefaultTTL: 3600 * 24,
|
|
3780
|
+
MaxTTL: 3600 * 24 * 365,
|
|
3781
|
+
MinTTL: 0,
|
|
3782
|
+
ParametersInCacheKeyAndForwardedToOrigin: {
|
|
3783
|
+
CookiesConfig: { CookieBehavior: "none" },
|
|
3784
|
+
EnableAcceptEncodingBrotli: true,
|
|
3785
|
+
EnableAcceptEncodingGzip: true,
|
|
3786
|
+
HeadersConfig: {
|
|
3787
|
+
HeaderBehavior: "whitelist",
|
|
3788
|
+
Headers: [
|
|
3789
|
+
"Access-Control-Request-Headers",
|
|
3790
|
+
"Access-Control-Request-Method",
|
|
3791
|
+
"Origin"
|
|
3792
|
+
]
|
|
3793
|
+
},
|
|
3794
|
+
QueryStringsConfig: { QueryStringBehavior: "none" }
|
|
3795
|
+
}
|
|
3796
|
+
};
|
|
3772
3797
|
/**
|
|
3773
3798
|
* Name: Managed-CORS-S3Origin
|
|
3774
3799
|
* ID: 88a5eaf4-2fd4-4709-b370-b4c650ea3fcf
|
|
@@ -3922,7 +3947,7 @@ const getCloudFrontTemplate = ({ acm, aliases = [], appendIndexHtml, redirectToT
|
|
|
3922
3947
|
* CachePolicyId property:
|
|
3923
3948
|
* https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-defaultcachebehavior.html#cfn-cloudfront-distribution-defaultcachebehavior-cachepolicyid
|
|
3924
3949
|
*/
|
|
3925
|
-
CachePolicyId:
|
|
3950
|
+
CachePolicyId: { Ref: CLOUDFRONT_CACHE_POLICY_LOGICAL_ID },
|
|
3926
3951
|
ResponseHeadersPolicyId: getResponseHeadersPolicyId({
|
|
3927
3952
|
responseHeaders,
|
|
3928
3953
|
responseHeadersPolicy
|
|
@@ -3944,6 +3969,18 @@ const getCloudFrontTemplate = ({ acm, aliases = [], appendIndexHtml, redirectToT
|
|
|
3944
3969
|
}]
|
|
3945
3970
|
} }
|
|
3946
3971
|
},
|
|
3972
|
+
[CLOUDFRONT_CACHE_POLICY_LOGICAL_ID]: {
|
|
3973
|
+
Type: "AWS::CloudFront::CachePolicy",
|
|
3974
|
+
Properties: { CachePolicyConfig: {
|
|
3975
|
+
...CACHE_POLICY_CONFIG,
|
|
3976
|
+
Comment: { "Fn::Sub": ["Cache policy for ${Project} project.", { Project: { Ref: "Project" } }] },
|
|
3977
|
+
/**
|
|
3978
|
+
* Cache policy names must be unique per AWS account, like the
|
|
3979
|
+
* response headers policy's.
|
|
3980
|
+
*/
|
|
3981
|
+
Name: { Ref: "AWS::StackName" }
|
|
3982
|
+
} }
|
|
3983
|
+
},
|
|
3947
3984
|
[CLOUDFRONT_ORIGIN_ACCESS_CONTROL_LOGICAL_ID]: {
|
|
3948
3985
|
Type: "AWS::CloudFront::OriginAccessControl",
|
|
3949
3986
|
Properties: { OriginAccessControlConfig: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "carlin",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"homepage": "https://ttoss.dev/docs/carlin/",
|
|
@@ -57,9 +57,9 @@
|
|
|
57
57
|
"ts-node": "^10.9.2",
|
|
58
58
|
"uglify-js": "^3.19.3",
|
|
59
59
|
"yargs": "^17.7.2",
|
|
60
|
-
"@ttoss/
|
|
61
|
-
"@ttoss/
|
|
62
|
-
"@ttoss/read-config-file": "^2.5.
|
|
60
|
+
"@ttoss/config": "^1.41.0",
|
|
61
|
+
"@ttoss/cloudformation": "^0.16.1",
|
|
62
|
+
"@ttoss/read-config-file": "^2.5.1"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@types/adm-zip": "^0.5.6",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"jest": "^30.4.2",
|
|
80
80
|
"tsdown": "^0.22.2",
|
|
81
81
|
"typescript": "~6.0.3",
|
|
82
|
-
"@ttoss/test-utils": "^4.
|
|
82
|
+
"@ttoss/test-utils": "^4.4.0"
|
|
83
83
|
},
|
|
84
84
|
"publishConfig": {
|
|
85
85
|
"access": "public",
|