@kensio/yulin 1.10.2 → 1.10.3
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/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-config.d.ts +8 -17
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-config.d.ts.map +1 -1
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-config.js +24 -102
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-config.js.map +1 -1
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-cors-config.d.ts +13 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-cors-config.d.ts.map +1 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-cors-config.js +76 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-cors-config.js.map +1 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-custom-headers.d.ts +17 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-custom-headers.d.ts.map +1 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-custom-headers.js +45 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-custom-headers.js.map +1 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-field-reader.d.ts +37 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-field-reader.d.ts.map +1 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-field-reader.js +75 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-field-reader.js.map +1 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-security-headers.d.ts +11 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-security-headers.d.ts.map +1 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-security-headers.js +30 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-security-headers.js.map +1 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-security-values.d.ts +19 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-security-values.d.ts.map +1 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-security-values.js +72 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-security-values.js.map +1 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-server-timing.d.ts +13 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-server-timing.d.ts.map +1 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-server-timing.js +24 -0
- package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-server-timing.js.map +1 -0
- package/dist/service/cloudfront/command/create-distribution/create-distribution.handler.d.ts +2 -0
- package/dist/service/cloudfront/command/create-distribution/create-distribution.handler.d.ts.map +1 -1
- package/dist/service/cloudfront/command/create-distribution/create-distribution.handler.js.map +1 -1
- package/dist/service/cloudfront/command/update-distribution/update-distribution.handler.d.ts +2 -0
- package/dist/service/cloudfront/command/update-distribution/update-distribution.handler.d.ts.map +1 -1
- package/dist/service/cloudfront/command/update-distribution/update-distribution.handler.js.map +1 -1
- package/dist/service/cloudfront/controller/response-headers/sim-cf-response-headers-applicator.d.ts +1 -1
- package/dist/service/cloudfront/controller/response-headers/sim-cf-response-headers-applicator.d.ts.map +1 -1
- package/dist/service/cloudfront/controller/response-headers/sim-cf-response-headers-applicator.js +2 -2
- package/dist/service/cloudfront/controller/response-headers/sim-cf-response-headers-applicator.js.map +1 -1
- package/dist/service/cloudfront/controller/sim-cloudfront-controller.d.ts +1 -0
- package/dist/service/cloudfront/controller/sim-cloudfront-controller.d.ts.map +1 -1
- package/dist/service/cloudfront/controller/sim-cloudfront-controller.js +8 -1
- package/dist/service/cloudfront/controller/sim-cloudfront-controller.js.map +1 -1
- package/dist/service/cloudfront/controller/sim-cloudfront-error-response.d.ts +22 -0
- package/dist/service/cloudfront/controller/sim-cloudfront-error-response.d.ts.map +1 -0
- package/dist/service/cloudfront/controller/sim-cloudfront-error-response.js +31 -0
- package/dist/service/cloudfront/controller/sim-cloudfront-error-response.js.map +1 -0
- package/dist/service/cloudfront/controller/sim-cloudfront-request-pipeline.d.ts.map +1 -1
- package/dist/service/cloudfront/controller/sim-cloudfront-request-pipeline.js +1 -1
- package/dist/service/cloudfront/controller/sim-cloudfront-request-pipeline.js.map +1 -1
- package/dist/service/cloudfront/distribution/configurator/sim-cf-behavior-properties.d.ts +9 -0
- package/dist/service/cloudfront/distribution/configurator/sim-cf-behavior-properties.d.ts.map +1 -0
- package/dist/service/cloudfront/distribution/configurator/sim-cf-behavior-properties.js +34 -0
- package/dist/service/cloudfront/distribution/configurator/sim-cf-behavior-properties.js.map +1 -0
- package/dist/service/cloudfront/distribution/configurator/sim-cf-behavior-response-headers-policy.d.ts +29 -0
- package/dist/service/cloudfront/distribution/configurator/sim-cf-behavior-response-headers-policy.d.ts.map +1 -0
- package/dist/service/cloudfront/distribution/configurator/sim-cf-behavior-response-headers-policy.js +51 -0
- package/dist/service/cloudfront/distribution/configurator/sim-cf-behavior-response-headers-policy.js.map +1 -0
- package/dist/service/cloudfront/distribution/configurator/sim-cf-distribution-configurator.factory.d.ts +2 -0
- package/dist/service/cloudfront/distribution/configurator/sim-cf-distribution-configurator.factory.d.ts.map +1 -1
- package/dist/service/cloudfront/distribution/configurator/sim-cf-distribution-configurator.factory.js +3 -1
- package/dist/service/cloudfront/distribution/configurator/sim-cf-distribution-configurator.factory.js.map +1 -1
- package/dist/service/cloudfront/distribution/configurator/sim-cloud-front-behavior-configurator.d.ts +3 -0
- package/dist/service/cloudfront/distribution/configurator/sim-cloud-front-behavior-configurator.d.ts.map +1 -1
- package/dist/service/cloudfront/distribution/configurator/sim-cloud-front-behavior-configurator.js +7 -32
- package/dist/service/cloudfront/distribution/configurator/sim-cloud-front-behavior-configurator.js.map +1 -1
- package/dist/service/cloudfront/distribution/configurator/sim-cloud-front-distribution-configurator.d.ts +14 -1
- package/dist/service/cloudfront/distribution/configurator/sim-cloud-front-distribution-configurator.d.ts.map +1 -1
- package/dist/service/cloudfront/distribution/configurator/sim-cloud-front-distribution-configurator.js +16 -1
- package/dist/service/cloudfront/distribution/configurator/sim-cloud-front-distribution-configurator.js.map +1 -1
- package/dist/service/cloudfront/distribution/sim-cf-distribution-reconfigurer.d.ts +7 -3
- package/dist/service/cloudfront/distribution/sim-cf-distribution-reconfigurer.d.ts.map +1 -1
- package/dist/service/cloudfront/distribution/sim-cf-distribution-reconfigurer.js +6 -3
- package/dist/service/cloudfront/distribution/sim-cf-distribution-reconfigurer.js.map +1 -1
- package/dist/service/cloudfront/error/sim-cloudfront.error.d.ts +11 -0
- package/dist/service/cloudfront/error/sim-cloudfront.error.d.ts.map +1 -1
- package/dist/service/cloudfront/error/sim-cloudfront.error.js +13 -0
- package/dist/service/cloudfront/error/sim-cloudfront.error.js.map +1 -1
- package/dist/service/cloudfront/response-headers-policy/sim-cf-cors-origin-pattern.d.ts +27 -0
- package/dist/service/cloudfront/response-headers-policy/sim-cf-cors-origin-pattern.d.ts.map +1 -0
- package/dist/service/cloudfront/response-headers-policy/sim-cf-cors-origin-pattern.js +70 -0
- package/dist/service/cloudfront/response-headers-policy/sim-cf-cors-origin-pattern.js.map +1 -0
- package/dist/service/cloudfront/response-headers-policy/sim-cf-response-headers-policy-cors.d.ts +44 -0
- package/dist/service/cloudfront/response-headers-policy/sim-cf-response-headers-policy-cors.d.ts.map +1 -0
- package/dist/service/cloudfront/response-headers-policy/sim-cf-response-headers-policy-cors.js +111 -0
- package/dist/service/cloudfront/response-headers-policy/sim-cf-response-headers-policy-cors.js.map +1 -0
- package/dist/service/cloudfront/response-headers-policy/sim-cf-response-headers-policy.d.ts +10 -2
- package/dist/service/cloudfront/response-headers-policy/sim-cf-response-headers-policy.d.ts.map +1 -1
- package/dist/service/cloudfront/response-headers-policy/sim-cf-response-headers-policy.js +14 -2
- package/dist/service/cloudfront/response-headers-policy/sim-cf-response-headers-policy.js.map +1 -1
- package/dist/service/cloudfront/sim-cloudfront-commands.d.ts +3 -0
- package/dist/service/cloudfront/sim-cloudfront-commands.d.ts.map +1 -1
- package/dist/service/cloudfront/sim-cloudfront-commands.js +3 -0
- package/dist/service/cloudfront/sim-cloudfront-commands.js.map +1 -1
- package/dist/service/cloudfront/sim-cloudfront.d.ts.map +1 -1
- package/dist/service/cloudfront/sim-cloudfront.js +1 -0
- package/dist/service/cloudfront/sim-cloudfront.js.map +1 -1
- package/dist/service/rekognition/label/sim-rekognition-label-declaration.d.ts +1 -1
- package/dist/service/rekognition/moderation/sim-rekognition-moderation-taxonomy.d.ts +2 -2
- package/dist/service/rekognition/moderation/sim-rekognition-moderation-taxonomy.js +3 -3
- package/dist/service/rekognition/moderation/sim-rekognition-moderation-taxonomy.js.map +1 -1
- package/dist/service/rekognition/sim-rekognition.d.ts +4 -4
- package/dist/service/rekognition/sim-rekognition.js +4 -4
- package/dist/service/sns/signature/sim-sns-certificate.d.ts +9 -3
- package/dist/service/sns/signature/sim-sns-certificate.d.ts.map +1 -1
- package/dist/service/sns/signature/sim-sns-certificate.js +13 -8
- package/dist/service/sns/signature/sim-sns-certificate.js.map +1 -1
- package/dist/service/sns/signature/sim-sns-der.d.ts +16 -0
- package/dist/service/sns/signature/sim-sns-der.d.ts.map +1 -1
- package/dist/service/sns/signature/sim-sns-der.js +23 -0
- package/dist/service/sns/signature/sim-sns-der.js.map +1 -1
- package/package.json +1 -1
package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-security-values.js
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { requiredBoolean, requiredEnum, requiredInteger, requiredString, } from "./sim-cfn-cf-rh-policy-field-reader.js";
|
|
2
|
+
/** The only two directives CloudFront accepts for `X-Frame-Options`. */
|
|
3
|
+
const frameOptions = ["DENY", "SAMEORIGIN"];
|
|
4
|
+
/** The referrer policy directives CloudFront accepts. */
|
|
5
|
+
const referrerPolicies = [
|
|
6
|
+
"no-referrer",
|
|
7
|
+
"no-referrer-when-downgrade",
|
|
8
|
+
"origin",
|
|
9
|
+
"origin-when-cross-origin",
|
|
10
|
+
"same-origin",
|
|
11
|
+
"strict-origin",
|
|
12
|
+
"strict-origin-when-cross-origin",
|
|
13
|
+
"unsafe-url",
|
|
14
|
+
];
|
|
15
|
+
const contentSecurityPolicyValue = (item, context, refuse) => requiredString(item, "ContentSecurityPolicy", context, refuse);
|
|
16
|
+
const contentTypeOptionsValue = () => "nosniff";
|
|
17
|
+
const frameOptionValue = (item, context, refuse) => requiredEnum(item, "FrameOption", frameOptions, context, refuse);
|
|
18
|
+
const referrerPolicyValue = (item, context, refuse) => requiredEnum(item, "ReferrerPolicy", referrerPolicies, context, refuse);
|
|
19
|
+
const strictTransportSecurityValue = (item, context, refuse) => {
|
|
20
|
+
const directives = [
|
|
21
|
+
`max-age=${requiredInteger(item, "AccessControlMaxAgeSec", context, refuse)}`,
|
|
22
|
+
];
|
|
23
|
+
if (item["IncludeSubdomains"] === true) {
|
|
24
|
+
directives.push("includeSubDomains");
|
|
25
|
+
}
|
|
26
|
+
if (item["Preload"] === true) {
|
|
27
|
+
directives.push("preload");
|
|
28
|
+
}
|
|
29
|
+
return directives.join("; ");
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* CloudFront refuses a reporting URI alongside `ModeBlock`, since the header
|
|
33
|
+
* carries one directive or the other and not both.
|
|
34
|
+
*/
|
|
35
|
+
const xssProtectionValue = (item, context, refuse) => {
|
|
36
|
+
const modeBlock = item["ModeBlock"] === true;
|
|
37
|
+
const reportUri = item["ReportUri"];
|
|
38
|
+
if (reportUri !== undefined && typeof reportUri !== "string") {
|
|
39
|
+
return refuse(`${context} ReportUri must be a string`);
|
|
40
|
+
}
|
|
41
|
+
if (modeBlock && reportUri !== undefined) {
|
|
42
|
+
return refuse(`${context} cannot set both ModeBlock and ReportUri`);
|
|
43
|
+
}
|
|
44
|
+
if (!requiredBoolean(item, "Protection", context, refuse)) {
|
|
45
|
+
return "0";
|
|
46
|
+
}
|
|
47
|
+
if (modeBlock) {
|
|
48
|
+
return "1; mode=block";
|
|
49
|
+
}
|
|
50
|
+
return reportUri === undefined ? "1" : `1; report=${reportUri}`;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Which sub-section of a SecurityHeadersConfig sets which response header,
|
|
54
|
+
* and what builds its value.
|
|
55
|
+
*/
|
|
56
|
+
export const simCfnCfRhPolicySecurityHeaders = [
|
|
57
|
+
[
|
|
58
|
+
"ContentSecurityPolicy",
|
|
59
|
+
"Content-Security-Policy",
|
|
60
|
+
contentSecurityPolicyValue,
|
|
61
|
+
],
|
|
62
|
+
["ContentTypeOptions", "X-Content-Type-Options", contentTypeOptionsValue],
|
|
63
|
+
["FrameOptions", "X-Frame-Options", frameOptionValue],
|
|
64
|
+
["ReferrerPolicy", "Referrer-Policy", referrerPolicyValue],
|
|
65
|
+
[
|
|
66
|
+
"StrictTransportSecurity",
|
|
67
|
+
"Strict-Transport-Security",
|
|
68
|
+
strictTransportSecurityValue,
|
|
69
|
+
],
|
|
70
|
+
["XSSProtection", "X-XSS-Protection", xssProtectionValue],
|
|
71
|
+
];
|
|
72
|
+
//# sourceMappingURL=sim-cfn-cf-rh-policy-security-values.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-cfn-cf-rh-policy-security-values.js","sourceRoot":"","sources":["../../../../../src/service/cloudfront/cf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BAAyB;QACzB,2BAA2B;QAC3B,4BAA4B;KAC7B;IACD,CAAC,eAAe,EAAE,kBAAkB,EAAE,kBAAkB,CAAC;CAC1D,CAAC"}
|
package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-server-timing.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SimCloudFrontResponseHeader } from "../../response-headers-policy/sim-cf-response-header.js";
|
|
2
|
+
import { type SimCfnCfRhPolicyFieldRefuse } from "./sim-cfn-cf-rh-policy-field-reader.js";
|
|
3
|
+
/**
|
|
4
|
+
* Reads a ResponseHeadersPolicyConfig's ServerTimingHeadersConfig section
|
|
5
|
+
* into the Server-Timing header it enables, or nothing when it is absent or
|
|
6
|
+
* disabled.
|
|
7
|
+
*
|
|
8
|
+
* `SamplingRate` decides what share of real responses carry the header; this
|
|
9
|
+
* simulation always adds it once `Enabled` is true rather than sampling, so a
|
|
10
|
+
* test asserting on it does not depend on chance.
|
|
11
|
+
*/
|
|
12
|
+
export declare function simCfnCfResponseHeadersPolicyServerTiming(config: Record<string, unknown>, refuse: SimCfnCfRhPolicyFieldRefuse): SimCloudFrontResponseHeader | undefined;
|
|
13
|
+
//# sourceMappingURL=sim-cfn-cf-rh-policy-server-timing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-cfn-cf-rh-policy-server-timing.d.ts","sourceRoot":"","sources":["../../../../../src/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-server-timing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,yDAAyD,CAAC;AACtG,OAAO,EAGL,KAAK,2BAA2B,EACjC,MAAM,wCAAwC,CAAC;AAEhD;;;;;;;;GAQG;AACH,wBAAgB,yCAAyC,CACvD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,MAAM,EAAE,2BAA2B,GAClC,2BAA2B,GAAG,SAAS,CAoBzC"}
|
package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-server-timing.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { SimCloudFrontResponseHeader } from "../../response-headers-policy/sim-cf-response-header.js";
|
|
2
|
+
import { optionalObject, requiredBoolean, } from "./sim-cfn-cf-rh-policy-field-reader.js";
|
|
3
|
+
/**
|
|
4
|
+
* Reads a ResponseHeadersPolicyConfig's ServerTimingHeadersConfig section
|
|
5
|
+
* into the Server-Timing header it enables, or nothing when it is absent or
|
|
6
|
+
* disabled.
|
|
7
|
+
*
|
|
8
|
+
* `SamplingRate` decides what share of real responses carry the header; this
|
|
9
|
+
* simulation always adds it once `Enabled` is true rather than sampling, so a
|
|
10
|
+
* test asserting on it does not depend on chance.
|
|
11
|
+
*/
|
|
12
|
+
export function simCfnCfResponseHeadersPolicyServerTiming(config, refuse) {
|
|
13
|
+
const section = optionalObject(config, "ServerTimingHeadersConfig", "ServerTimingHeadersConfig", refuse);
|
|
14
|
+
if (section === undefined ||
|
|
15
|
+
!requiredBoolean(section, "Enabled", "ServerTimingHeadersConfig", refuse)) {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
return new SimCloudFrontResponseHeader({
|
|
19
|
+
name: "Server-Timing",
|
|
20
|
+
value: `cdn-upstream-layer;desc="EDGE"`,
|
|
21
|
+
override: true,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=sim-cfn-cf-rh-policy-server-timing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-cfn-cf-rh-policy-server-timing.js","sourceRoot":"","sources":["../../../../../src/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-server-timing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,yDAAyD,CAAC;AACtG,OAAO,EACL,cAAc,EACd,eAAe,GAEhB,MAAM,wCAAwC,CAAC;AAEhD;;;;;;;;GAQG;AACH,MAAM,UAAU,yCAAyC,CACvD,MAA+B,EAC/B,MAAmC;IAEnC,MAAM,OAAO,GAAG,cAAc,CAC5B,MAAM,EACN,2BAA2B,EAC3B,2BAA2B,EAC3B,MAAM,CACP,CAAC;IAEF,IACE,OAAO,KAAK,SAAS;QACrB,CAAC,eAAe,CAAC,OAAO,EAAE,SAAS,EAAE,2BAA2B,EAAE,MAAM,CAAC,EACzE,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,IAAI,2BAA2B,CAAC;QACrC,IAAI,EAAE,eAAe;QACrB,KAAK,EAAE,gCAAgC;QACvC,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;AACL,CAAC"}
|
package/dist/service/cloudfront/command/create-distribution/create-distribution.handler.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import type { SimAwsAccountId } from "../../../aws/sim-aws-account.js";
|
|
|
6
6
|
import type { SimCloudFrontS3OriginResolver } from "../../origin/s3/sim-cloudfront-s3-origin.js";
|
|
7
7
|
import type { SimCfCustomOriginDispatcher } from "../../origin/custom/sim-cf-custom-origin-dispatcher.js";
|
|
8
8
|
import type { SimCloudFrontOriginAccessControlRegistry } from "../../origin-access-control/sim-cf-origin-access-control-registry.js";
|
|
9
|
+
import type { SimCloudFrontResponseHeadersPolicyRegistry } from "../../response-headers-policy/sim-cf-response-headers-policy-registry.js";
|
|
9
10
|
import type { BackgroundScheduler } from "../../../../util/background/background.js";
|
|
10
11
|
import { type SimIamInterServiceAuthZ } from "../../../iam/authorize/sim-iam-inter-service-auth-z.js";
|
|
11
12
|
import type { SimAwsCaller } from "../../../aws/caller/sim-aws-caller.js";
|
|
@@ -17,6 +18,7 @@ interface CreateDistributionCommandHandlerProperties {
|
|
|
17
18
|
readonly s3OriginResolver: SimCloudFrontS3OriginResolver;
|
|
18
19
|
readonly customOriginDispatcher?: SimCfCustomOriginDispatcher | undefined;
|
|
19
20
|
readonly originAccessControls: SimCloudFrontOriginAccessControlRegistry;
|
|
21
|
+
readonly responseHeadersPolicies: SimCloudFrontResponseHeadersPolicyRegistry;
|
|
20
22
|
readonly iam?: SimIamInterServiceAuthZ;
|
|
21
23
|
readonly acmRegistry?: SimAcmRegistry | undefined;
|
|
22
24
|
readonly background: BackgroundScheduler;
|
package/dist/service/cloudfront/command/create-distribution/create-distribution.handler.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-distribution.handler.d.ts","sourceRoot":"","sources":["../../../../../src/service/cloudfront/command/create-distribution/create-distribution.handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,KAAK,EACV,4BAA4B,EAC5B,kCAAkC,EACnC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AACxF,OAAO,EACL,yBAAyB,EACzB,KAAK,2BAA2B,EACjC,MAAM,mDAAmD,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAEvE,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,6CAA6C,CAAC;AACjG,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wDAAwD,CAAC;AAC1G,OAAO,KAAK,EAAE,wCAAwC,EAAE,MAAM,sEAAsE,CAAC;AACrI,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAKrF,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,wDAAwD,CAAC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAE1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAGhF,UAAU,0CAA0C;IAClD,QAAQ,CAAC,SAAS,EAAE,eAAe,CAAC;IACpC,QAAQ,CAAC,aAAa,EAAE,GAAG,CACzB,2BAA2B,EAC3B,yBAAyB,CAC1B,CAAC;IACF,QAAQ,CAAC,kBAAkB,EAAE,qBAAqB,CAAC;IACnD,QAAQ,CAAC,gBAAgB,EAAE,6BAA6B,CAAC;IACzD,QAAQ,CAAC,sBAAsB,CAAC,EAAE,2BAA2B,GAAG,SAAS,CAAC;IAC1E,QAAQ,CAAC,oBAAoB,EAAE,wCAAwC,CAAC;IACxE,QAAQ,CAAC,GAAG,CAAC,EAAE,uBAAuB,CAAC;IACvC,QAAQ,CAAC,WAAW,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC;IAClD,QAAQ,CAAC,UAAU,EAAE,mBAAmB,CAAC;CAC1C;AAED,UAAU,uCAAuC;IAC/C,QAAQ,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC;CAChC;AAED;;;;GAIG;AACH,qBAAa,gCAAiC,YAAW,cAAc,CACrE,4BAA4B,EAC5B,kCAAkC,CACnC;IACC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAkB;IAC5C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAG5B;IACF,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAwB;IAC3D,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAAwC;IACjF,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA+B;IAC1D,OAAO,CAAC,QAAQ,CAAC,0BAA0B,CAA0C;IACrF,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAsB;IAEjD,YAAY,UAAU,EAAE,0CAA0C,EAcjE;IAED;;OAEG;IACG,MAAM,CACV,OAAO,EAAE,4BAA4B,EACrC,OAAO,CAAC,EAAE,uCAAuC,GAChD,OAAO,CAAC,kCAAkC,CAAC,CAqD7C;CACF"}
|
|
1
|
+
{"version":3,"file":"create-distribution.handler.d.ts","sourceRoot":"","sources":["../../../../../src/service/cloudfront/command/create-distribution/create-distribution.handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,KAAK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,CAAC;IAClD,QAAQ,CAAC,UAAU,EAAE,mBAAmB,CAAC;CAC1C;AAED,UAAU,uCAAuC;IAC/C,QAAQ,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC;CAChC;AAED;;;;GAIG;AACH,qBAAa,gCAAiC,YAAW,cAAc,CACrE,4BAA4B,EAC5B,kCAAkC,CACnC;IACC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAkB;IAC5C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAG5B;IACF,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAwB;IAC3D,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAAwC;IACjF,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA+B;IAC1D,OAAO,CAAC,QAAQ,CAAC,0BAA0B,CAA0C;IACrF,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAsB;IAEjD,YAAY,UAAU,EAAE,0CAA0C,EAcjE;IAED;;OAEG;IACG,MAAM,CACV,OAAO,EAAE,4BAA4B,EACrC,OAAO,CAAC,EAAE,uCAAuC,GAChD,OAAO,CAAC,kCAAkC,CAAC,CAqD7C;CACF"}
|
package/dist/service/cloudfront/command/create-distribution/create-distribution.handler.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-distribution.handler.js","sourceRoot":"","sources":["../../../../../src/service/cloudfront/command/create-distribution/create-distribution.handler.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,yBAAyB,GAE1B,MAAM,mDAAmD,CAAC;AAE3D,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"create-distribution.handler.js","sourceRoot":"","sources":["../../../../../src/service/cloudfront/command/create-distribution/create-distribution.handler.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,yBAAyB,GAE1B,MAAM,mDAAmD,CAAC;AAE3D,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAMvE,OAAO,EAAE,yCAA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Q,EAAE,4DAA4D,YAAY,CAAC,cAAc,EAAE;YACnG,SAAS,EAAE,EAAE;SACd,CAAC;IACJ,CAAC;CACF"}
|
package/dist/service/cloudfront/command/update-distribution/update-distribution.handler.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import type { SimCloudFrontDistribution, SimCloudFrontDistributionId } from "../
|
|
|
8
8
|
import type { SimCfCustomOriginDispatcher } from "../../origin/custom/sim-cf-custom-origin-dispatcher.js";
|
|
9
9
|
import type { SimCloudFrontS3OriginResolver } from "../../origin/s3/sim-cloudfront-s3-origin.js";
|
|
10
10
|
import type { SimCloudFrontOriginAccessControlRegistry } from "../../origin-access-control/sim-cf-origin-access-control-registry.js";
|
|
11
|
+
import type { SimCloudFrontResponseHeadersPolicyRegistry } from "../../response-headers-policy/sim-cf-response-headers-policy-registry.js";
|
|
11
12
|
import type { SimCloudFrontRegistry } from "../../registry/sim-cloud-front-registry.js";
|
|
12
13
|
import type { SimUpdateDistributionCommand, SimUpdateDistributionCommandOutput } from "./update-distribution.command.js";
|
|
13
14
|
interface UpdateDistributionCommandHandlerProperties {
|
|
@@ -17,6 +18,7 @@ interface UpdateDistributionCommandHandlerProperties {
|
|
|
17
18
|
readonly s3OriginResolver: SimCloudFrontS3OriginResolver;
|
|
18
19
|
readonly customOriginDispatcher?: SimCfCustomOriginDispatcher | undefined;
|
|
19
20
|
readonly originAccessControls: SimCloudFrontOriginAccessControlRegistry;
|
|
21
|
+
readonly responseHeadersPolicies: SimCloudFrontResponseHeadersPolicyRegistry;
|
|
20
22
|
readonly iam?: SimIamInterServiceAuthZ;
|
|
21
23
|
readonly acmRegistry?: SimAcmRegistry | undefined;
|
|
22
24
|
readonly background?: BackgroundScheduler;
|
package/dist/service/cloudfront/command/update-distribution/update-distribution.handler.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-distribution.handler.d.ts","sourceRoot":"","sources":["../../../../../src/service/cloudfront/command/update-distribution/update-distribution.handler.ts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,CAAC,UAAU,CAAC,EAAE,mBAAmB,CAAC;CAC3C;AAED,UAAU,uCAAuC;IAC/C,QAAQ,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC;CAChC;AAED;;;;GAIG;AACH,qBAAa,gCAAiC,YAAW,cAAc,CACrE,4BAA4B,EAC5B,kCAAkC,CACnC;IACC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAG5B;IACF,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAwC;IACrE,OAAO,CAAC,QAAQ,CAAC,0BAA0B,CAA0C;IACrF,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA+B;IAC1D,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAsB;IAEjD,YAAY,UAAU,EAAE,0CAA0C,EAajE;IAED;;;;;;;OAOG;IACG,MAAM,CACV,OAAO,EAAE,4BAA4B,EACrC,OAAO,CAAC,EAAE,uCAAuC,GAChD,OAAO,CAAC,kCAAkC,CAAC,CAoC7C;CACF"}
|
|
1
|
+
{"version":3,"file":"update-distribution.handler.d.ts","sourceRoot":"","sources":["../../../../../src/service/cloudfront/command/update-distribution/update-distribution.handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EACL,KAAK,mBAAmB,EAEzB,MAAM,2CAA2C,CAAC;AAEnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,wDAAwD,CAAC;AAGhE,OAAO,KAAK,EACV,yBAAyB,EACzB,2BAA2B,EAC5B,MAAM,mDAAmD,CAAC;AAG3D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wDAAwD,CAAC;AAC1G,OAAO,KAAK,EAAE,6BAA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AU,CAAsB;IAEjD,YAAY,UAAU,EAAE,0CAA0C,EAajE;IAED;;;;;;;OAOG;IACG,MAAM,CACV,OAAO,EAAE,4BAA4B,EACrC,OAAO,CAAC,EAAE,uCAAuC,GAChD,OAAO,CAAC,kCAAkC,CAAC,CAoC7C;CACF"}
|
package/dist/service/cloudfront/command/update-distribution/update-distribution.handler.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-distribution.handler.js","sourceRoot":"","sources":["../../../../../src/service/cloudfront/command/update-distribution/update-distribution.handler.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,eAAe,GAChB,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAIvE,OAAO,EACL,kBAAkB,GAEnB,MAAM,wDAAwD,CAAC;AAChE,OAAO,EAAE,qCAAqC,EAAE,MAAM,wDAAwD,CAAC;AAC/G,OAAO,EAAE,6BAA6B,EAAE,MAAM,gDAAgD,CAAC;AAK/F,OAAO,EAAE,uCAAuC,EAAE,MAAM,8EAA8E,CAAC;AACvI,OAAO,EAAE,+BAA+B,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"update-distribution.handler.js","sourceRoot":"","sources":["../../../../../src/service/cloudfront/command/update-distribution/update-distribution.handler.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,eAAe,GAChB,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAIvE,OAAO,EACL,kBAAkB,GAEnB,MAAM,wDAAwD,CAAC;AAChE,OAAO,EAAE,qCAAqC,EAAE,MAAM,wDAAwD,CAAC;AAC/G,OAAO,EAAE,6BAA6B,EAAE,MAAM,gDAAgD,CAAC;AAK/F,OAAO,EAAE,uCAAuC,EAAE,MAAM,8EAA8E,CAAC;AACvI,OAAO,EAAE,+BAA+B,EAAE,MAAM,qCAAqC,CAAC;AAMtF,OAAO,EAAE,y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OAAO,EAAE,MAAM,CAAC,CAAC;QAE3D,MAAM,YAAY,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;QAE5D,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;YAC/B,MAAM,IAAI,+BAA+B,CACvC,0CAA0C,cAAc,EAAE,CAC3D,CAAC;QACJ,CAAC;QAED,mEAAmE;QACnE,oDAAoD;QACpD,IAAI,CAAC,0BAA0B,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;QAE7D,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,YAAY,EAAE,kBAAkB,CAAC,CAAC;QAEhE,2EAA2E;QAC3E,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,kBAAkB,EAAE,CAAC,CAAC;QAElE,OAAO;YACL,YAAY,EAAE,6BAA6B,CAAC,YAAY,CAAC;YACzD,SAAS,EAAE,EAAE;SACd,CAAC;IACJ,CAAC;CACF"}
|
package/dist/service/cloudfront/controller/response-headers/sim-cf-response-headers-applicator.d.ts
CHANGED
|
@@ -14,6 +14,6 @@ export declare class SimCfResponseHeadersApplicator {
|
|
|
14
14
|
* Return the response with the Behavior's policy applied, or the response
|
|
15
15
|
* unchanged when the Behavior names no policy.
|
|
16
16
|
*/
|
|
17
|
-
apply(cloudFront: SimCloudFront, response: Response, behaviour: SimCloudFrontBehavior): Response;
|
|
17
|
+
apply(cloudFront: SimCloudFront, request: Request, response: Response, behaviour: SimCloudFrontBehavior): Response;
|
|
18
18
|
}
|
|
19
19
|
//# sourceMappingURL=sim-cf-response-headers-applicator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-cf-response-headers-applicator.d.ts","sourceRoot":"","sources":["../../../../../src/service/cloudfront/controller/response-headers/sim-cf-response-headers-applicator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AAGzF;;;;;;;;GAQG;AACH,qBAAa,8BAA8B;IACzC;;;OAGG;IACH,KAAK,CACH,UAAU,EAAE,aAAa,EACzB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,qBAAqB,GAC/B,QAAQ,CAmBV;CACF"}
|
|
1
|
+
{"version":3,"file":"sim-cf-response-headers-applicator.d.ts","sourceRoot":"","sources":["../../../../../src/service/cloudfront/controller/response-headers/sim-cf-response-headers-applicator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AAGzF;;;;;;;;GAQG;AACH,qBAAa,8BAA8B;IACzC;;;OAGG;IACH,KAAK,CACH,UAAU,EAAE,aAAa,EACzB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,qBAAqB,GAC/B,QAAQ,CAmBV;CACF"}
|
package/dist/service/cloudfront/controller/response-headers/sim-cf-response-headers-applicator.js
CHANGED
|
@@ -13,7 +13,7 @@ export class SimCfResponseHeadersApplicator {
|
|
|
13
13
|
* Return the response with the Behavior's policy applied, or the response
|
|
14
14
|
* unchanged when the Behavior names no policy.
|
|
15
15
|
*/
|
|
16
|
-
apply(cloudFront, response, behaviour) {
|
|
16
|
+
apply(cloudFront, request, response, behaviour) {
|
|
17
17
|
const policyId = behaviour.responseHeadersPolicyId;
|
|
18
18
|
if (policyId === undefined) {
|
|
19
19
|
return response;
|
|
@@ -25,7 +25,7 @@ export class SimCfResponseHeadersApplicator {
|
|
|
25
25
|
`managed policy ID, which names a policy AWS owns rather than one a ` +
|
|
26
26
|
`template creates, will not be found.`);
|
|
27
27
|
}
|
|
28
|
-
return policy.apply(response);
|
|
28
|
+
return policy.apply(response, request.headers.get("origin"));
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
//# sourceMappingURL=sim-cf-response-headers-applicator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-cf-response-headers-applicator.js","sourceRoot":"","sources":["../../../../../src/service/cloudfront/controller/response-headers/sim-cf-response-headers-applicator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wCAAwC,EAAE,MAAM,qCAAqC,CAAC;AAE/F;;;;;;;;GAQG;AACH,MAAM,OAAO,8BAA8B;IACzC;;;OAGG;IACH,KAAK,CACH,UAAyB,EACzB,QAAkB,EAClB,SAAgC;QAEhC,MAAM,QAAQ,GAAG,SAAS,CAAC,uBAAuB,CAAC;QAEnD,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,OAAO,QAAQ,CAAC;QAClB,CAAC;QAED,MAAM,MAAM,GAAG,UAAU,CAAC,4BAA4B,CAAC,QAAQ,CAAC,CAAC;QAEjE,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,MAAM,IAAI,wCAAwC,CAChD,0CAA0C,QAAQ,mBAAmB;gBACnE,gEAAgE;gBAChE,qEAAqE;gBACrE,sCAAsC,CACzC,CAAC;QACJ,CAAC;QAED,OAAO,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"sim-cf-response-headers-applicator.js","sourceRoot":"","sources":["../../../../../src/service/cloudfront/controller/response-headers/sim-cf-response-headers-applicator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wCAAwC,EAAE,MAAM,qCAAqC,CAAC;AAE/F;;;;;;;;GAQG;AACH,MAAM,OAAO,8BAA8B;IACzC;;;OAGG;IACH,KAAK,CACH,UAAyB,EACzB,OAAgB,EAChB,QAAkB,EAClB,SAAgC;QAEhC,MAAM,QAAQ,GAAG,SAAS,CAAC,uBAAuB,CAAC;QAEnD,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,OAAO,QAAQ,CAAC;QAClB,CAAC;QAED,MAAM,MAAM,GAAG,UAAU,CAAC,4BAA4B,CAAC,QAAQ,CAAC,CAAC;QAEjE,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,MAAM,IAAI,wCAAwC,CAChD,0CAA0C,QAAQ,mBAAmB;gBACnE,gEAAgE;gBAChE,qEAAqE;gBACrE,sCAAsC,CACzC,CAAC;QACJ,CAAC;QAED,OAAO,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC/D,CAAC;CACF"}
|
|
@@ -10,6 +10,7 @@ import { type SimCloudFrontServiceControllerProperties as SimCloudFrontServiceCo
|
|
|
10
10
|
*/
|
|
11
11
|
export declare class SimCloudFrontServiceController implements SimAwsServiceController {
|
|
12
12
|
private readonly pipeline;
|
|
13
|
+
private readonly errors;
|
|
13
14
|
constructor(properties?: SimCloudFrontServiceControllerProperties);
|
|
14
15
|
/**
|
|
15
16
|
* Handle one incoming request for the simulated CloudFront service.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-cloudfront-controller.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudfront/controller/sim-cloudfront-controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,qDAAqD,CAAC;
|
|
1
|
+
{"version":3,"file":"sim-cloudfront-controller.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudfront/controller/sim-cloudfront-controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,qDAAqD,CAAC;AAG7D,OAAO,EAEL,KAAK,wCAAwC,IAAI,wCAAwC,EAC1F,MAAM,8CAA8C,CAAC;AAEtD;;;;;;;GAOG;AACH,qBAAa,8BAA+B,YAAW,uBAAuB;IAC5E,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA+B;IACxD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoC;IAE3D,YAAY,UAAU,GAAE,wCAA6C,EAMpE;IAED;;;;;;OAMG;IACG,aAAa,CAAC,cAAc,EAAE,oBAAoB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAM3E;CACF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SimCloudFrontErrorResponse } from "./sim-cloudfront-error-response.js";
|
|
1
2
|
import { SimCloudFrontRequestPipeline } from "./sim-cloudfront-request-pipeline.js";
|
|
2
3
|
import { SimCloudFrontControllerDependenciesFactory, } from "./dependency/sim-cf-controller-dependency.js";
|
|
3
4
|
/**
|
|
@@ -10,6 +11,7 @@ import { SimCloudFrontControllerDependenciesFactory, } from "./dependency/sim-cf
|
|
|
10
11
|
*/
|
|
11
12
|
export class SimCloudFrontServiceController {
|
|
12
13
|
pipeline;
|
|
14
|
+
errors = new SimCloudFrontErrorResponse();
|
|
13
15
|
constructor(properties = {}) {
|
|
14
16
|
const dependenciesFactory = new SimCloudFrontControllerDependenciesFactory();
|
|
15
17
|
const dependencies = dependenciesFactory.make(properties);
|
|
@@ -23,7 +25,12 @@ export class SimCloudFrontServiceController {
|
|
|
23
25
|
* own, so only the request itself is needed to find and serve it.
|
|
24
26
|
*/
|
|
25
27
|
async handleRequest(serviceRequest) {
|
|
26
|
-
|
|
28
|
+
try {
|
|
29
|
+
return await this.pipeline.handle(serviceRequest.request);
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
return this.errors.build(error);
|
|
33
|
+
}
|
|
27
34
|
}
|
|
28
35
|
}
|
|
29
36
|
//# sourceMappingURL=sim-cloudfront-controller.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-cloudfront-controller.js","sourceRoot":"","sources":["../../../../src/service/cloudfront/controller/sim-cloudfront-controller.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AACpF,OAAO,EACL,0CAA0C,GAE3C,MAAM,8CAA8C,CAAC;AAEtD;;;;;;;GAOG;AACH,MAAM,OAAO,8BAA8B;IACxB,QAAQ,CAA+B;
|
|
1
|
+
{"version":3,"file":"sim-cloudfront-controller.js","sourceRoot":"","sources":["../../../../src/service/cloudfront/controller/sim-cloudfront-controller.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AACpF,OAAO,EACL,0CAA0C,GAE3C,MAAM,8CAA8C,CAAC;AAEtD;;;;;;;GAOG;AACH,MAAM,OAAO,8BAA8B;IACxB,QAAQ,CAA+B;IACvC,MAAM,GAAG,IAAI,0BAA0B,EAAE,CAAC;IAE3D,YAAY,UAAU,GAA6C,EAAE;QACnE,MAAM,mBAAmB,GACvB,IAAI,0CAA0C,EAAE,CAAC;QACnD,MAAM,YAAY,GAAG,mBAAmB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAE1D,IAAI,CAAC,QAAQ,GAAG,IAAI,4BAA4B,CAAC,YAAY,CAAC,CAAC;IACjE,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,aAAa,CAAC,cAAoC;QACtD,IAAI,CAAC;YACH,OAAO,MAAM,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QAC5D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAClC,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turns a refused CloudFront content-serving request into the response real
|
|
3
|
+
* CloudFront answers with.
|
|
4
|
+
*
|
|
5
|
+
* A viewer request is plain HTTP rather than an SDK call, so there is no
|
|
6
|
+
* `$metadata` for a client to read the way an SDK caller would. The status
|
|
7
|
+
* code is the only part of it a viewer can see, and answering the generic 500
|
|
8
|
+
* every unhandled throw already becomes would turn a refusal CloudFront
|
|
9
|
+
* itself treats as a 404, such as a Behavior naming a response headers policy
|
|
10
|
+
* that no longer exists, into a response indistinguishable from a bug here.
|
|
11
|
+
*/
|
|
12
|
+
export declare class SimCloudFrontErrorResponse {
|
|
13
|
+
/**
|
|
14
|
+
* Build the response for an error raised while serving a viewer request.
|
|
15
|
+
*
|
|
16
|
+
* Anything the simulator does not recognise is re-raised rather than
|
|
17
|
+
* flattened into a plausible CloudFront failure, so a bug in the simulation
|
|
18
|
+
* cannot masquerade as an AWS failure a test then asserts on.
|
|
19
|
+
*/
|
|
20
|
+
build(error: unknown): Response;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=sim-cloudfront-error-response.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-cloudfront-error-response.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudfront/controller/sim-cloudfront-error-response.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,qBAAa,0BAA0B;IACrC;;;;;;OAMG;IACH,KAAK,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,CAS9B;CACF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { SimCloudFrontError } from "../error/sim-cloudfront.error.js";
|
|
2
|
+
/**
|
|
3
|
+
* Turns a refused CloudFront content-serving request into the response real
|
|
4
|
+
* CloudFront answers with.
|
|
5
|
+
*
|
|
6
|
+
* A viewer request is plain HTTP rather than an SDK call, so there is no
|
|
7
|
+
* `$metadata` for a client to read the way an SDK caller would. The status
|
|
8
|
+
* code is the only part of it a viewer can see, and answering the generic 500
|
|
9
|
+
* every unhandled throw already becomes would turn a refusal CloudFront
|
|
10
|
+
* itself treats as a 404, such as a Behavior naming a response headers policy
|
|
11
|
+
* that no longer exists, into a response indistinguishable from a bug here.
|
|
12
|
+
*/
|
|
13
|
+
export class SimCloudFrontErrorResponse {
|
|
14
|
+
/**
|
|
15
|
+
* Build the response for an error raised while serving a viewer request.
|
|
16
|
+
*
|
|
17
|
+
* Anything the simulator does not recognise is re-raised rather than
|
|
18
|
+
* flattened into a plausible CloudFront failure, so a bug in the simulation
|
|
19
|
+
* cannot masquerade as an AWS failure a test then asserts on.
|
|
20
|
+
*/
|
|
21
|
+
build(error) {
|
|
22
|
+
if (error instanceof SimCloudFrontError) {
|
|
23
|
+
return new Response(`${error.message}\n`, {
|
|
24
|
+
status: error.$metadata.httpStatusCode ?? 500,
|
|
25
|
+
headers: { "content-type": "text/plain; charset=utf-8" },
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
throw error;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=sim-cloudfront-error-response.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-cloudfront-error-response.js","sourceRoot":"","sources":["../../../../src/service/cloudfront/controller/sim-cloudfront-error-response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAEtE;;;;;;;;;;GAUG;AACH,MAAM,OAAO,0BAA0B;IACrC;;;;;;OAMG;IACH,KAAK,CAAC,KAAc;QAClB,IAAI,KAAK,YAAY,kBAAkB,EAAE,CAAC;YACxC,OAAO,IAAI,QAAQ,CAAC,GAAG,KAAK,CAAC,OAAO,IAAI,EAAE;gBACxC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,IAAI,GAAG;gBAC7C,OAAO,EAAE,EAAE,cAAc,EAAE,2BAA2B,EAAE;aACzD,CAAC,CAAC;QACL,CAAC;QAED,MAAM,KAAK,CAAC;IACd,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-cloudfront-request-pipeline.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudfront/controller/sim-cloudfront-request-pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,8CAA8C,CAAC;AAGxG;;;;;;;;;;;GAWG;AACH,qBAAa,4BAA4B;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM;IAAnC,YAA6B,MAAM,EAAE,mCAAmC,EAAI;IAE5E;;OAEG;IACG,MAAM,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"sim-cloudfront-request-pipeline.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudfront/controller/sim-cloudfront-request-pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,8CAA8C,CAAC;AAGxG;;;;;;;;;;;GAWG;AACH,qBAAa,4BAA4B;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM;IAAnC,YAA6B,MAAM,EAAE,mCAAmC,EAAI;IAE5E;;OAEG;IACG,MAAM,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAoEhD;CACF"}
|
|
@@ -47,7 +47,7 @@ export class SimCloudFrontRequestPipeline {
|
|
|
47
47
|
// does this after the response leaves the cache and before the
|
|
48
48
|
// viewer-response event, so the custom error page above carries the
|
|
49
49
|
// policy's headers and a viewer-response function sees them.
|
|
50
|
-
const response = this.stages.responseHeadersApplicator.apply(cloudFront, errorResponse, behaviour);
|
|
50
|
+
const response = this.stages.responseHeadersApplicator.apply(cloudFront, requestReference, errorResponse, behaviour);
|
|
51
51
|
// Handle viewer-response CFF, if any.
|
|
52
52
|
// A viewer-response CFF can inspect the original request and replace or
|
|
53
53
|
// modify the Origin response before it is returned to the caller.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-cloudfront-request-pipeline.js","sourceRoot":"","sources":["../../../../src/service/cloudfront/controller/sim-cloudfront-request-pipeline.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,qDAAqD,CAAC;AAEpG;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ACf,CAAC;QAEF,4EAA4E;QAC5E,+DAA+D;QAC/D,oEAAoE;QACpE,6DAA6D;QAC7D,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,yBAAyB,CAAC,KAAK,CAC1D,UAAU,EACV,aAAa,EACb,SAAS,CACV,CAAC;QAEF,sCAAsC;QACtC,wEAAwE;QACxE,kEAAkE;QAClE,OAAO,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,mBAAmB,CAClD,UAAU,EACV,gBAAgB,EAChB,QAAQ,EACR,SAAS,CACV,CAAC;IACJ,CAAC;CACF"}
|
|
1
|
+
{"version":3,"file":"sim-cloudfront-request-pipeline.js","sourceRoot":"","sources":["../../../../src/service/cloudfront/controller/sim-cloudfront-request-pipeline.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,qDAAqD,CAAC;AAEpG;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,4BAA4B;IACV,MAAM;IAAnC,YAA6B,MAA2C;sBAA3C,MAAM;IAAwC,CAAC;IAE5E;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,OAAgB;QAC3B,IAAI,gBAAgB,GAAG,OAAO,CAAC;QAE/B,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,eAAe,CAAC,gBAAgB,CAAC,CAAC;QAEzE,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,OAAO,IAAI,QAAQ,CAAC,gDAAgD,EAAE;gBACpE,MAAM,EAAE,GAAG;aACZ,CAAC,CAAC;QACL,CAAC;QAED,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;QAEnD,gBAAgB,GAAG,6BAA6B,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;QAE3E,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,OAAO,CACrD,gBAAgB,EAChB,MAAM,CACP,CAAC;QAEF,qCAAqC;QACrC,4EAA4E;QAC5E,+DAA+D;QAC/D,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,kBAAkB,CAC5D,UAAU,EACV,gBAAgB,EAChB,SAAS,CACV,CAAC;QACF,IAAI,SAAS,YAAY,QAAQ,EAAE,CAAC;YAClC,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,gBAAgB,GAAG,SAAS,CAAC;QAE7B,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAC1D,gBAAgB,EAChB,MAAM,EACN,SAAS,CACV,CAAC;QAEF,2EAA2E;QAC3E,0EAA0E;QAC1E,uEAAuE;QACvE,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,KAAK,CAChE,gBAAgB,EAChB,MAAM,EACN,cAAc,CACf,CAAC;QAEF,4EAA4E;QAC5E,+DAA+D;QAC/D,oEAAoE;QACpE,6DAA6D;QAC7D,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,yBAAyB,CAAC,KAAK,CAC1D,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,SAAS,CACV,CAAC;QAEF,sCAAsC;QACtC,wEAAwE;QACxE,kEAAkE;QAClE,OAAO,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,mBAAmB,CAClD,UAAU,EACV,gBAAgB,EAChB,QAAQ,EACR,SAAS,CACV,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SimCloudFrontCacheBehaviorConfig, SimCloudFrontDefaultCacheBehaviorConfig } from "../../command/create-distribution/create-distribution.command.js";
|
|
2
|
+
import type { SimCloudFrontBehavior } from "../../behaviour/sim-cloud-front-behavior.js";
|
|
3
|
+
import type { SimCfBehaviorResponseHeadersPolicy } from "./sim-cf-behavior-response-headers-policy.js";
|
|
4
|
+
/**
|
|
5
|
+
* Build the Behavior properties common to both the default Cache Behavior and
|
|
6
|
+
* a named one. Callers add their own fields, such as the path pattern, on top.
|
|
7
|
+
*/
|
|
8
|
+
export declare function simCfBehaviorProperties(cacheBehavior: SimCloudFrontDefaultCacheBehaviorConfig | SimCloudFrontCacheBehaviorConfig, responseHeadersPolicy: SimCfBehaviorResponseHeadersPolicy): SimCloudFrontBehavior;
|
|
9
|
+
//# sourceMappingURL=sim-cf-behavior-properties.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-cf-behavior-properties.d.ts","sourceRoot":"","sources":["../../../../../src/service/cloudfront/distribution/configurator/sim-cf-behavior-properties.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gCAAgC,EAChC,uCAAuC,EAExC,MAAM,kEAAkE,CAAC;AAC1E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AAEzF,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,8CAA8C,CAAC;AAGvG;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,aAAa,EACT,uCAAuC,GACvC,gCAAgC,EACpC,qBAAqB,EAAE,kCAAkC,GACxD,qBAAqB,CAsBvB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { assertDefined } from "../../../../util/type-guard/defined.js";
|
|
2
|
+
import { configureCffAssociations } from "./sim-cff-associations-configure.js";
|
|
3
|
+
/**
|
|
4
|
+
* Build the Behavior properties common to both the default Cache Behavior and
|
|
5
|
+
* a named one. Callers add their own fields, such as the path pattern, on top.
|
|
6
|
+
*/
|
|
7
|
+
export function simCfBehaviorProperties(cacheBehavior, responseHeadersPolicy) {
|
|
8
|
+
const { TargetOriginId, ResponseHeadersPolicyId } = cacheBehavior;
|
|
9
|
+
assertDefined(TargetOriginId, "CloudFront CacheBehavior TargetOriginId");
|
|
10
|
+
responseHeadersPolicy.assertExists(TargetOriginId, ResponseHeadersPolicyId);
|
|
11
|
+
return {
|
|
12
|
+
targetOriginName: TargetOriginId,
|
|
13
|
+
allowedMethods: methodsSet(cacheBehavior.AllowedMethods, ["GET", "HEAD"]),
|
|
14
|
+
cachedMethods: methodsSet(cacheBehavior.AllowedMethods?.CachedMethods, [
|
|
15
|
+
"GET",
|
|
16
|
+
"HEAD",
|
|
17
|
+
]),
|
|
18
|
+
...(cacheBehavior.ViewerProtocolPolicy !== undefined && {
|
|
19
|
+
viewerProtocolPolicy: cacheBehavior.ViewerProtocolPolicy,
|
|
20
|
+
}),
|
|
21
|
+
...(ResponseHeadersPolicyId !== undefined && {
|
|
22
|
+
responseHeadersPolicyId: ResponseHeadersPolicyId,
|
|
23
|
+
}),
|
|
24
|
+
functionAssociations: configureCffAssociations(cacheBehavior),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Build a Set of HTTP methods from a method list config, falling back to the
|
|
29
|
+
* provided defaults when no items are configured.
|
|
30
|
+
*/
|
|
31
|
+
function methodsSet(methods, fallback) {
|
|
32
|
+
return new Set(methods?.Items ?? fallback);
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=sim-cf-behavior-properties.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-cf-behavior-properties.js","sourceRoot":"","sources":["../../../../../src/service/cloudfront/distribution/configurator/sim-cf-behavior-properties.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAEvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAE/E;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CACrC,aAEoC,EACpC,qBAAyD;IAEzD,MAAM,EAAE,cAAc,EAAE,uBAAuB,EAAE,GAAG,aAAa,CAAC;IAElE,aAAa,CAAC,cAAc,EAAE,yCAAyC,CAAC,CAAC;IAEzE,qBAAqB,CAAC,YAAY,CAAC,cAAc,EAAE,uBAAuB,CAAC,CAAC;IAE5E,OAAO;QACL,gBAAgB,EAAE,cAAc;QAChC,cAAc,EAAE,UAAU,CAAC,aAAa,CAAC,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACzE,aAAa,EAAE,UAAU,CAAC,aAAa,CAAC,cAAc,EAAE,aAAa,EAAE;YACrE,KAAK;YACL,MAAM;SACP,CAAC;QACF,GAAG,CAAC,aAAa,CAAC,oBAAoB,KAAK,SAAS,IAAI;YACtD,oBAAoB,EAAE,aAAa,CAAC,oBAAoB;SACzD,CAAC;QACF,GAAG,CAAC,uBAAuB,KAAK,SAAS,IAAI;YAC3C,uBAAuB,EAAE,uBAAuB;SACjD,CAAC;QACF,oBAAoB,EAAE,wBAAwB,CAAC,aAAa,CAAC;KAC9D,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,SAAS,UAAU,CACjB,OAA4C,EAC5C,QAAkB;IAElB,OAAO,IAAI,GAAG,CAAC,OAAO,EAAE,KAAK,IAAI,QAAQ,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { SimCloudFrontDistributionConfig } from "../../command/create-distribution/create-distribution.command.js";
|
|
2
|
+
import type { SimCloudFrontResponseHeadersPolicyRegistry } from "../../response-headers-policy/sim-cf-response-headers-policy-registry.js";
|
|
3
|
+
/**
|
|
4
|
+
* Refuses a Cache Behavior naming a response headers policy this simulation
|
|
5
|
+
* does not hold.
|
|
6
|
+
*
|
|
7
|
+
* Real CloudFront checks this when the Distribution is created or updated, so
|
|
8
|
+
* a template naming a mistyped or AWS-managed policy ID fails the deploy there
|
|
9
|
+
* too, rather than deploying successfully and only failing the first request
|
|
10
|
+
* that reaches the Behavior.
|
|
11
|
+
*/
|
|
12
|
+
export declare class SimCfBehaviorResponseHeadersPolicy {
|
|
13
|
+
private readonly policies;
|
|
14
|
+
constructor(policies: SimCloudFrontResponseHeadersPolicyRegistry);
|
|
15
|
+
/**
|
|
16
|
+
* Refuse every Behavior of a DistributionConfig that names a policy which is
|
|
17
|
+
* not there, without touching the Distribution.
|
|
18
|
+
*
|
|
19
|
+
* An update replaces a Distribution's whole configuration, so this runs
|
|
20
|
+
* before any of it is torn down: a refusal here leaves the Distribution
|
|
21
|
+
* serving exactly what it served before, rather than half replaced.
|
|
22
|
+
*/
|
|
23
|
+
assertAllExist(distributionConfig: SimCloudFrontDistributionConfig): void;
|
|
24
|
+
/**
|
|
25
|
+
* Refuse one Behavior naming a policy which is not there.
|
|
26
|
+
*/
|
|
27
|
+
assertExists(targetOriginId: string | undefined, responseHeadersPolicyId: string | undefined): void;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=sim-cf-behavior-response-headers-policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-cf-behavior-response-headers-policy.d.ts","sourceRoot":"","sources":["../../../../../src/service/cloudfront/distribution/configurator/sim-cf-behavior-response-headers-policy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,kEAAkE,CAAC;AAExH,OAAO,KAAK,EAAE,0CAA0C,EAAE,MAAM,0EAA0E,CAAC;AAE3I;;;;;;;;GAQG;AACH,qBAAa,kCAAkC;IAE3C,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAD3B,YACmB,QAAQ,EAAE,0CAA0C,EACnE;IAEJ;;;;;;;OAOG;IACH,cAAc,CAAC,kBAAkB,EAAE,+BAA+B,GAAG,IAAI,CAcxE;IAED;;OAEG;IACH,YAAY,CACV,cAAc,EAAE,MAAM,GAAG,SAAS,EAClC,uBAAuB,EAAE,MAAM,GAAG,SAAS,GAC1C,IAAI,CAgBN;CACF"}
|
package/dist/service/cloudfront/distribution/configurator/sim-cf-behavior-response-headers-policy.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { SimCloudFrontInvalidResponseHeadersPolicyId } from "../../error/sim-cloudfront.error.js";
|
|
2
|
+
/**
|
|
3
|
+
* Refuses a Cache Behavior naming a response headers policy this simulation
|
|
4
|
+
* does not hold.
|
|
5
|
+
*
|
|
6
|
+
* Real CloudFront checks this when the Distribution is created or updated, so
|
|
7
|
+
* a template naming a mistyped or AWS-managed policy ID fails the deploy there
|
|
8
|
+
* too, rather than deploying successfully and only failing the first request
|
|
9
|
+
* that reaches the Behavior.
|
|
10
|
+
*/
|
|
11
|
+
export class SimCfBehaviorResponseHeadersPolicy {
|
|
12
|
+
policies;
|
|
13
|
+
constructor(policies) {
|
|
14
|
+
this.policies = policies;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Refuse every Behavior of a DistributionConfig that names a policy which is
|
|
18
|
+
* not there, without touching the Distribution.
|
|
19
|
+
*
|
|
20
|
+
* An update replaces a Distribution's whole configuration, so this runs
|
|
21
|
+
* before any of it is torn down: a refusal here leaves the Distribution
|
|
22
|
+
* serving exactly what it served before, rather than half replaced.
|
|
23
|
+
*/
|
|
24
|
+
assertAllExist(distributionConfig) {
|
|
25
|
+
const behaviors = [
|
|
26
|
+
distributionConfig.DefaultCacheBehavior,
|
|
27
|
+
...(distributionConfig.CacheBehaviors?.Items ?? []),
|
|
28
|
+
];
|
|
29
|
+
for (const behavior of behaviors) {
|
|
30
|
+
if (behavior !== undefined) {
|
|
31
|
+
this.assertExists(behavior.TargetOriginId, behavior.ResponseHeadersPolicyId);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Refuse one Behavior naming a policy which is not there.
|
|
37
|
+
*/
|
|
38
|
+
assertExists(targetOriginId, responseHeadersPolicyId) {
|
|
39
|
+
if (responseHeadersPolicyId === undefined ||
|
|
40
|
+
this.policies.byId(responseHeadersPolicyId) !== undefined) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
throw new SimCloudFrontInvalidResponseHeadersPolicyId(`Sim CloudFront Behavior for Origin ${targetOriginId} names response ` +
|
|
44
|
+
`headers policy ${responseHeadersPolicyId}, which does not exist. ` +
|
|
45
|
+
`Only a policy an AWS::CloudFront::ResponseHeadersPolicy Resource ` +
|
|
46
|
+
`created in this simulation can be named, so a managed policy ID, ` +
|
|
47
|
+
`which names a policy AWS owns rather than one a template creates, ` +
|
|
48
|
+
`will not be found.`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=sim-cf-behavior-response-headers-policy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-cf-behavior-response-headers-policy.js","sourceRoot":"","sources":["../../../../../src/service/cloudfront/distribution/configurator/sim-cf-behavior-response-headers-policy.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,2CAA2C,EAAE,MAAM,qCAAqC,CAAC;AAGlG;;;;;;;;GAQG;AACH,MAAM,OAAO,kCAAkC;IAE1B,QAAQ;IAD3B,YACmB,QAAoD;wBAApD,QAAQ;IACxB,CAAC;IAEJ;;;;;;;OAOG;IACH,cAAc,CAAC,kBAAmD;QAChE,MAAM,SAAS,GAAG;YAChB,kBAAkB,CAAC,oBAAoB;YACvC,GAAG,CAAC,kBAAkB,CAAC,cAAc,EAAE,KAAK,IAAI,EAAE,CAAC;SACpD,CAAC;QAEF,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;YACjC,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;gBAC3B,IAAI,CAAC,YAAY,CACf,QAAQ,CAAC,cAAc,EACvB,QAAQ,CAAC,uBAAuB,CACjC,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAED;;OAEG;IACH,YAAY,CACV,cAAkC,EAClC,uBAA2C;QAE3C,IACE,uBAAuB,KAAK,SAAS;YACrC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,uBAAuB,CAAC,KAAK,SAAS,EACzD,CAAC;YACD,OAAO;QACT,CAAC;QAED,MAAM,IAAI,2CAA2C,CACnD,sCAAsC,cAAc,kBAAkB;YACpE,kBAAkB,uBAAuB,0BAA0B;YACnE,mEAAmE;YACnE,mEAAmE;YACnE,oEAAoE;YACpE,oBAAoB,CACvB,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { SimCfCustomOriginDispatcher } from "../../origin/custom/sim-cf-custom-origin-dispatcher.js";
|
|
2
2
|
import type { SimCloudFrontS3OriginResolver } from "../../origin/s3/sim-cloudfront-s3-origin.js";
|
|
3
3
|
import type { SimCloudFrontOriginAccessControlRegistry } from "../../origin-access-control/sim-cf-origin-access-control-registry.js";
|
|
4
|
+
import type { SimCloudFrontResponseHeadersPolicyRegistry } from "../../response-headers-policy/sim-cf-response-headers-policy-registry.js";
|
|
4
5
|
import { SimCloudFrontDistributionConfigurator } from "./sim-cloud-front-distribution-configurator.js";
|
|
5
6
|
interface SimCloudFrontConfiguratorOrigins {
|
|
6
7
|
readonly s3OriginResolver: SimCloudFrontS3OriginResolver;
|
|
7
8
|
readonly customOriginDispatcher?: SimCfCustomOriginDispatcher | undefined;
|
|
8
9
|
readonly originAccessControls: SimCloudFrontOriginAccessControlRegistry;
|
|
10
|
+
readonly responseHeadersPolicies: SimCloudFrontResponseHeadersPolicyRegistry;
|
|
9
11
|
}
|
|
10
12
|
/**
|
|
11
13
|
* Build the configurator that applies a DistributionConfig to a Distribution.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-cf-distribution-configurator.factory.d.ts","sourceRoot":"","sources":["../../../../../src/service/cloudfront/distribution/configurator/sim-cf-distribution-configurator.factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wDAAwD,CAAC;AAC1G,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,6CAA6C,CAAC;AACjG,OAAO,KAAK,EAAE,wCAAwC,EAAE,MAAM,sEAAsE,CAAC;
|
|
1
|
+
{"version":3,"file":"sim-cf-distribution-configurator.factory.d.ts","sourceRoot":"","sources":["../../../../../src/service/cloudfront/distribution/configurator/sim-cf-distribution-configurator.factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wDAAwD,CAAC;AAC1G,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,6CAA6C,CAAC;AACjG,OAAO,KAAK,EAAE,wCAAwC,EAAE,MAAM,sEAAsE,CAAC;AACrI,OAAO,KAAK,EAAE,0CAA0C,EAAE,MAAM,0EAA0E,CAAC;AAG3I,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CAAC;AAGvG,UAAU,gCAAgC;IACxC,QAAQ,CAAC,gBAAgB,EAAE,6BAA6B,CAAC;IACzD,QAAQ,CAAC,sBAAsB,CAAC,EAAE,2BAA2B,GAAG,SAAS,CAAC;IAC1E,QAAQ,CAAC,oBAAoB,EAAE,wCAAwC,CAAC;IACxE,QAAQ,CAAC,uBAAuB,EAAE,0CAA0C,CAAC;CAC9E;AAED;;;;;GAKG;AACH,wBAAgB,yCAAyC,CACvD,OAAO,EAAE,gCAAgC,GACxC,qCAAqC,CAcvC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SimCfBehaviorResponseHeadersPolicy } from "./sim-cf-behavior-response-headers-policy.js";
|
|
1
2
|
import { SimCloudFrontBehaviorConfigurator } from "./sim-cloud-front-behavior-configurator.js";
|
|
2
3
|
import { SimCloudFrontDistributionConfigurator } from "./sim-cloud-front-distribution-configurator.js";
|
|
3
4
|
import { SimCloudFrontOriginConfigurator } from "./sim-cloud-front-origin-configurator.js";
|
|
@@ -8,6 +9,7 @@ import { SimCloudFrontOriginConfigurator } from "./sim-cloud-front-origin-config
|
|
|
8
9
|
* same set of configurators.
|
|
9
10
|
*/
|
|
10
11
|
export function makeSimCloudFrontDistributionConfigurator(origins) {
|
|
11
|
-
|
|
12
|
+
const responseHeadersPolicy = new SimCfBehaviorResponseHeadersPolicy(origins.responseHeadersPolicies);
|
|
13
|
+
return new SimCloudFrontDistributionConfigurator(new SimCloudFrontOriginConfigurator(origins.s3OriginResolver, origins.originAccessControls, origins.customOriginDispatcher), new SimCloudFrontBehaviorConfigurator(responseHeadersPolicy), responseHeadersPolicy);
|
|
12
14
|
}
|
|
13
15
|
//# sourceMappingURL=sim-cf-distribution-configurator.factory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-cf-distribution-configurator.factory.js","sourceRoot":"","sources":["../../../../../src/service/cloudfront/distribution/configurator/sim-cf-distribution-configurator.factory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sim-cf-distribution-configurator.factory.js","sourceRoot":"","sources":["../../../../../src/service/cloudfront/distribution/configurator/sim-cf-distribution-configurator.factory.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kCAAkC,EAAE,MAAM,8CAA8C,CAAC;AAClG,OAAO,EAAE,iCAAiC,EAAE,MAAM,4CAA4C,CAAC;AAC/F,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CAAC;AACvG,OAAO,EAAE,+BAA+B,EAAE,MAAM,0CAA0C,CAAC;AAS3F;;;;;GAKG;AACH,MAAM,UAAU,yCAAyC,CACvD,OAAyC;IAEzC,MAAM,qBAAqB,GAAG,IAAI,kCAAkC,CAClE,OAAO,CAAC,uBAAuB,CAChC,CAAC;IAEF,OAAO,IAAI,qCAAqC,CAC9C,IAAI,+BAA+B,CACjC,OAAO,CAAC,gBAAgB,EACxB,OAAO,CAAC,oBAAoB,EAC5B,OAAO,CAAC,sBAAsB,CAC/B,EACD,IAAI,iCAAiC,CAAC,qBAAqB,CAAC,EAC5D,qBAAqB,CACtB,CAAC;AACJ,CAAC"}
|