@kensio/yulin 1.4.0 → 1.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.
Files changed (87) hide show
  1. package/dist/serve/http/url/sim-aws-request-hostname.d.ts +13 -0
  2. package/dist/serve/http/url/sim-aws-request-hostname.d.ts.map +1 -0
  3. package/dist/serve/http/url/sim-aws-request-hostname.js +19 -0
  4. package/dist/serve/http/url/sim-aws-request-hostname.js.map +1 -0
  5. package/dist/service/aws/sim-aws-properties.d.ts +6 -1
  6. package/dist/service/aws/sim-aws-properties.d.ts.map +1 -1
  7. package/dist/service/aws/sim-aws.js.map +1 -1
  8. package/dist/service/cloudformation/deploy/sim-cfn-template-deployer.d.ts +9 -0
  9. package/dist/service/cloudformation/deploy/sim-cfn-template-deployer.d.ts.map +1 -1
  10. package/dist/service/cloudformation/deploy/sim-cfn-template-deployer.js +12 -0
  11. package/dist/service/cloudformation/deploy/sim-cfn-template-deployer.js.map +1 -1
  12. package/dist/service/cloudfront/cff/adapter/sim-cff-request-response-adapter.d.ts +19 -0
  13. package/dist/service/cloudfront/cff/adapter/sim-cff-request-response-adapter.d.ts.map +1 -1
  14. package/dist/service/cloudfront/cff/adapter/sim-cff-request-response-adapter.js +35 -2
  15. package/dist/service/cloudfront/cff/adapter/sim-cff-request-response-adapter.js.map +1 -1
  16. package/dist/service/cloudfront/command/create-distribution/create-distribution.command.d.ts +16 -0
  17. package/dist/service/cloudfront/command/create-distribution/create-distribution.command.d.ts.map +1 -1
  18. package/dist/service/cloudfront/command/create-distribution/sim-cf-distro-config-normalizer.d.ts.map +1 -1
  19. package/dist/service/cloudfront/command/create-distribution/sim-cf-distro-config-normalizer.js +1 -0
  20. package/dist/service/cloudfront/command/create-distribution/sim-cf-distro-config-normalizer.js.map +1 -1
  21. package/dist/service/cloudfront/controller/dependency/sim-cf-controller-dependency.d.ts +3 -0
  22. package/dist/service/cloudfront/controller/dependency/sim-cf-controller-dependency.d.ts.map +1 -1
  23. package/dist/service/cloudfront/controller/dependency/sim-cf-controller-dependency.js +11 -3
  24. package/dist/service/cloudfront/controller/dependency/sim-cf-controller-dependency.js.map +1 -1
  25. package/dist/service/cloudfront/controller/error/sim-cf-custom-error-responder.d.ts +29 -0
  26. package/dist/service/cloudfront/controller/error/sim-cf-custom-error-responder.d.ts.map +1 -0
  27. package/dist/service/cloudfront/controller/error/sim-cf-custom-error-responder.js +58 -0
  28. package/dist/service/cloudfront/controller/error/sim-cf-custom-error-responder.js.map +1 -0
  29. package/dist/service/cloudfront/controller/root-object/sim-cf-default-root-object-request.d.ts +17 -0
  30. package/dist/service/cloudfront/controller/root-object/sim-cf-default-root-object-request.d.ts.map +1 -0
  31. package/dist/service/cloudfront/controller/root-object/sim-cf-default-root-object-request.js +35 -0
  32. package/dist/service/cloudfront/controller/root-object/sim-cf-default-root-object-request.js.map +1 -0
  33. package/dist/service/cloudfront/controller/sim-cloudfront-request-pipeline.d.ts +5 -2
  34. package/dist/service/cloudfront/controller/sim-cloudfront-request-pipeline.d.ts.map +1 -1
  35. package/dist/service/cloudfront/controller/sim-cloudfront-request-pipeline.js +13 -3
  36. package/dist/service/cloudfront/controller/sim-cloudfront-request-pipeline.js.map +1 -1
  37. package/dist/service/cloudfront/custom-error/sim-cloudfront-custom-error-response.d.ts +24 -0
  38. package/dist/service/cloudfront/custom-error/sim-cloudfront-custom-error-response.d.ts.map +1 -0
  39. package/dist/service/cloudfront/custom-error/sim-cloudfront-custom-error-response.js +14 -0
  40. package/dist/service/cloudfront/custom-error/sim-cloudfront-custom-error-response.js.map +1 -0
  41. package/dist/service/cloudfront/distribution/configurator/sim-cloud-front-custom-error-configurator.d.ts +19 -0
  42. package/dist/service/cloudfront/distribution/configurator/sim-cloud-front-custom-error-configurator.d.ts.map +1 -0
  43. package/dist/service/cloudfront/distribution/configurator/sim-cloud-front-custom-error-configurator.js +53 -0
  44. package/dist/service/cloudfront/distribution/configurator/sim-cloud-front-custom-error-configurator.js.map +1 -0
  45. package/dist/service/cloudfront/distribution/configurator/sim-cloud-front-distribution-configurator.d.ts +11 -1
  46. package/dist/service/cloudfront/distribution/configurator/sim-cloud-front-distribution-configurator.d.ts.map +1 -1
  47. package/dist/service/cloudfront/distribution/configurator/sim-cloud-front-distribution-configurator.js +26 -1
  48. package/dist/service/cloudfront/distribution/configurator/sim-cloud-front-distribution-configurator.js.map +1 -1
  49. package/dist/service/cloudfront/distribution/sim-cloudfront-distribution.d.ts +14 -0
  50. package/dist/service/cloudfront/distribution/sim-cloudfront-distribution.d.ts.map +1 -1
  51. package/dist/service/cloudfront/distribution/sim-cloudfront-distribution.js +20 -0
  52. package/dist/service/cloudfront/distribution/sim-cloudfront-distribution.js.map +1 -1
  53. package/dist/service/cloudfront/error/sim-cloudfront.error.d.ts +31 -0
  54. package/dist/service/cloudfront/error/sim-cloudfront.error.d.ts.map +1 -1
  55. package/dist/service/cloudfront/error/sim-cloudfront.error.js +39 -0
  56. package/dist/service/cloudfront/error/sim-cloudfront.error.js.map +1 -1
  57. package/dist/service/cloudfront/router/sim-cloud-front-distro-router.d.ts.map +1 -1
  58. package/dist/service/cloudfront/router/sim-cloud-front-distro-router.js +2 -7
  59. package/dist/service/cloudfront/router/sim-cloud-front-distro-router.js.map +1 -1
  60. package/dist/service/dynamodb/document/sim-dynamodb-document-command-paths.d.ts +12 -3
  61. package/dist/service/dynamodb/document/sim-dynamodb-document-command-paths.d.ts.map +1 -1
  62. package/dist/service/dynamodb/document/sim-dynamodb-document-command-paths.js +28 -3
  63. package/dist/service/dynamodb/document/sim-dynamodb-document-command-paths.js.map +1 -1
  64. package/dist/service/dynamodb/document/sim-dynamodb-document-command.d.ts +2 -8
  65. package/dist/service/dynamodb/document/sim-dynamodb-document-command.d.ts.map +1 -1
  66. package/dist/service/dynamodb/document/sim-dynamodb-document-command.js +3 -20
  67. package/dist/service/dynamodb/document/sim-dynamodb-document-command.js.map +1 -1
  68. package/dist/service/dynamodb/document/sim-dynamodb-document-routes.d.ts +22 -6
  69. package/dist/service/dynamodb/document/sim-dynamodb-document-routes.d.ts.map +1 -1
  70. package/dist/service/dynamodb/document/sim-dynamodb-document-routes.js +43 -22
  71. package/dist/service/dynamodb/document/sim-dynamodb-document-routes.js.map +1 -1
  72. package/dist/service/dynamodb/document/sim-dynamodb-document-shared-name-route.d.ts +26 -0
  73. package/dist/service/dynamodb/document/sim-dynamodb-document-shared-name-route.d.ts.map +1 -0
  74. package/dist/service/dynamodb/document/sim-dynamodb-document-shared-name-route.js +31 -0
  75. package/dist/service/dynamodb/document/sim-dynamodb-document-shared-name-route.js.map +1 -0
  76. package/dist/service/dynamodb/sdk/sim-dynamodb-sdk-command-router.d.ts.map +1 -1
  77. package/dist/service/dynamodb/sdk/sim-dynamodb-sdk-command-router.js +13 -14
  78. package/dist/service/dynamodb/sdk/sim-dynamodb-sdk-command-router.js.map +1 -1
  79. package/dist/service/route53/command/create-hosted-zone/sim-route53-zone-id.d.ts +9 -2
  80. package/dist/service/route53/command/create-hosted-zone/sim-route53-zone-id.d.ts.map +1 -1
  81. package/dist/service/route53/command/create-hosted-zone/sim-route53-zone-id.js +25 -6
  82. package/dist/service/route53/command/create-hosted-zone/sim-route53-zone-id.js.map +1 -1
  83. package/dist/service/route53/error/sim-route53.error.d.ts +7 -0
  84. package/dist/service/route53/error/sim-route53.error.d.ts.map +1 -1
  85. package/dist/service/route53/error/sim-route53.error.js +9 -0
  86. package/dist/service/route53/error/sim-route53.error.js.map +1 -1
  87. package/package.json +2 -2
@@ -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":"AAIA,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,8CAA8C,CAAC;AAExG;;;;;;;;;GASG;AACH,qBAAa,4BAA4B;IACvC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA4B;IACzD,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAgC;IAClE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAmB;IACjD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA6B;IAE3D,YAAY,YAAY,EAAE,mCAAmC,EAK5D;IAED;;OAEG;IACG,MAAM,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CA2ChD;CACF"}
1
+ {"version":3,"file":"sim-cloudfront-request-pipeline.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudfront/controller/sim-cloudfront-request-pipeline.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,8CAA8C,CAAC;AAIxG;;;;;;;;;;;GAWG;AACH,qBAAa,4BAA4B;IACvC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA4B;IACzD,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAgC;IAClE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAmB;IACjD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA6B;IAC3D,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAA4B;IAEjE,YAAY,YAAY,EAAE,mCAAmC,EAM5D;IAED;;OAEG;IACG,MAAM,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAsDhD;CACF"}
@@ -1,7 +1,10 @@
1
+ import { simCfDefaultRootObjectRequest } from "./root-object/sim-cf-default-root-object-request.js";
1
2
  /**
2
3
  * Runs a single simulated CloudFront request through its lifecycle:
3
- * route to a Distribution, resolve the matching Behavior, run viewer-request
4
- * hooks, fetch from the Origin, then run viewer-response hooks.
4
+ * route to a Distribution, apply the default root object, resolve the matching
5
+ * Behavior, run viewer-request hooks, fetch from the Origin, replace an error
6
+ * response with the Distribution's custom error page, then run viewer-response
7
+ * hooks.
5
8
  *
6
9
  * This is the request-processing core, kept separate from the service
7
10
  * controller so the controller stays a thin adapter to the shared
@@ -13,11 +16,13 @@ export class SimCloudFrontRequestPipeline {
13
16
  behaviourResolver;
14
17
  cffApplicator;
15
18
  originFetcher;
19
+ customErrorResponder;
16
20
  constructor(dependencies) {
17
21
  this.distroRouter = dependencies.distroRouter;
18
22
  this.behaviourResolver = dependencies.behaviourResolver;
19
23
  this.cffApplicator = dependencies.cffApplicator;
20
24
  this.originFetcher = dependencies.originFetcher;
25
+ this.customErrorResponder = dependencies.customErrorResponder;
21
26
  }
22
27
  /**
23
28
  * Process one incoming request and produce the response the caller sees.
@@ -31,6 +36,7 @@ export class SimCloudFrontRequestPipeline {
31
36
  });
32
37
  }
33
38
  const { cloudFront, distribution: distro } = route;
39
+ requestReference = simCfDefaultRootObjectRequest(requestReference, distro);
34
40
  const behaviour = this.behaviourResolver.resolve(requestReference, distro);
35
41
  // Handle viewer-request CFF, if any.
36
42
  // A viewer-request CFF can either rewrite the Request that continues to the
@@ -40,7 +46,11 @@ export class SimCloudFrontRequestPipeline {
40
46
  return cffResult;
41
47
  }
42
48
  requestReference = cffResult;
43
- const response = await this.originFetcher.fetch(requestReference, distro, behaviour);
49
+ const originResponse = await this.originFetcher.fetch(requestReference, distro, behaviour);
50
+ // Replace an Origin error with the Distribution's custom error page, if it
51
+ // configures one for that status. This happens before the viewer-response
52
+ // CFF so that a function sees the response the viewer is about to get.
53
+ const response = await this.customErrorResponder.apply(requestReference, distro, originResponse);
44
54
  // Handle viewer-response CFF, if any.
45
55
  // A viewer-response CFF can inspect the original request and replace or
46
56
  // 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":"AAMA;;;;;;;;;GASG;AACH,MAAM,OAAO,4BAA4B;IACtB,YAAY,CAA4B;IACxC,iBAAiB,CAAgC;IACjD,aAAa,CAAmB;IAChC,aAAa,CAA6B;IAE3D,YAAY,YAAiD;QAC3D,IAAI,CAAC,YAAY,GAAG,YAAY,CA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"sim-cloudfront-request-pipeline.js","sourceRoot":"","sources":["../../../../src/service/cloudfront/controller/sim-cloudfront-request-pipeline.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,6BAA6B,EAAE,MAAM,qDAAqD,CAAC;AAEpG;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,4BAA4B;IACtB,YAAY,CAA4B;IACxC,iBAAiB,CAAgC;IACjD,aAAa,CAAmB;IAChC,aAAa,CAA6B;IAC1C,oBAAoB,CAA4B;IAEjE,YAAY,YAAiD;QAC3D,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC,YAAY,CAAC;QAC9C,IAAI,CAAC,iBAAiB,GAAG,YAAY,CAAC,iBAAiB,CAAC;QACxD,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC,aAAa,CAAC;QAChD,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC,aAAa,CAAC;QAChD,IAAI,CAAC,oBAAoB,GAAG,YAAY,CAAC,oBAAoB,CAAC;IAChE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,OAAgB;QAC3B,IAAI,gBAAgB,GAAG,OAAO,CAAC;QAE/B,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,gBAAgB,CAAC,CAAC;QAElE,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,iBAAiB,CAAC,OAAO,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;QAE3E,qCAAqC;QACrC,4EAA4E;QAC5E,+DAA+D;QAC/D,MAAM,SAAS,GAAG,IAAI,CAAC,aAAa,CAAC,kBAAkB,CACrD,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,aAAa,CAAC,KAAK,CACnD,gBAAgB,EAChB,MAAM,EACN,SAAS,CACV,CAAC;QAEF,2EAA2E;QAC3E,0EAA0E;QAC1E,uEAAuE;QACvE,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,KAAK,CACpD,gBAAgB,EAChB,MAAM,EACN,cAAc,CACf,CAAC;QAEF,sCAAsC;QACtC,wEAAwE;QACxE,kEAAkE;QAClE,OAAO,IAAI,CAAC,aAAa,CAAC,mBAAmB,CAC3C,UAAU,EACV,gBAAgB,EAChB,QAAQ,EACR,SAAS,CACV,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * The HTTP status codes CloudFront can return a custom error page for.
3
+ */
4
+ export declare const simCloudFrontCustomErrorCodes: ReadonlySet<number>;
5
+ /**
6
+ * The HTTP status codes CloudFront can return alongside a custom error page.
7
+ *
8
+ * These are the error codes plus 200, which is how a Distribution serves a
9
+ * page for an error without telling the viewer anything went wrong.
10
+ */
11
+ export declare const simCloudFrontCustomErrorResponseCodes: ReadonlySet<number>;
12
+ /**
13
+ * A custom error response of a sim CloudFront Distribution.
14
+ *
15
+ * Only a rule with a response page reaches this model. A rule carrying nothing
16
+ * but `ErrorCode` and `ErrorCachingMinTTL` configures error caching, which the
17
+ * simulator has nothing to cache with.
18
+ */
19
+ export interface SimCloudFrontCustomErrorResponse {
20
+ readonly errorCode: number;
21
+ readonly responsePagePath: string;
22
+ readonly responseCode: number;
23
+ }
24
+ //# sourceMappingURL=sim-cloudfront-custom-error-response.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-cloudfront-custom-error-response.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudfront/custom-error/sim-cloudfront-custom-error-response.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,6BAA6B,EAAE,WAAW,CAAC,MAAM,CAE5D,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,qCAAqC,EAAE,WAAW,CAAC,MAAM,CACpB,CAAC;AAEnD;;;;;;GAMG;AACH,MAAM,WAAW,gCAAgC;IAC/C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The HTTP status codes CloudFront can return a custom error page for.
3
+ */
4
+ export const simCloudFrontCustomErrorCodes = new Set([
5
+ 400, 403, 404, 405, 414, 416, 500, 501, 502, 503, 504,
6
+ ]);
7
+ /**
8
+ * The HTTP status codes CloudFront can return alongside a custom error page.
9
+ *
10
+ * These are the error codes plus 200, which is how a Distribution serves a
11
+ * page for an error without telling the viewer anything went wrong.
12
+ */
13
+ export const simCloudFrontCustomErrorResponseCodes = new Set([200, ...simCloudFrontCustomErrorCodes]);
14
+ //# sourceMappingURL=sim-cloudfront-custom-error-response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-cloudfront-custom-error-response.js","sourceRoot":"","sources":["../../../../src/service/cloudfront/custom-error/sim-cloudfront-custom-error-response.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAwB,IAAI,GAAG,CAAC;IACxE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG;CACtD,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAChD,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,6BAA6B,CAAC,CAAC,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { SimCloudFrontCustomErrorResponseConfig } from "../../command/create-distribution/create-distribution.command.js";
2
+ import type { SimCloudFrontDistribution } from "../sim-cloudfront-distribution.js";
3
+ /**
4
+ * Applies custom error response configuration to a sim CloudFront
5
+ * Distribution.
6
+ *
7
+ * CloudFront pairs `ResponsePagePath` and `ResponseCode`: a rule carrying one
8
+ * without the other is refused rather than half applied. A rule carrying
9
+ * neither only configures error caching, which this simulator does not model,
10
+ * so it is accepted and left out of the Distribution's request handling.
11
+ */
12
+ export declare class SimCloudFrontCustomErrorConfigurator {
13
+ /**
14
+ * Configure one custom error response on a Distribution.
15
+ */
16
+ configure(distribution: SimCloudFrontDistribution, customErrorResponse: SimCloudFrontCustomErrorResponseConfig): void;
17
+ private responseCode;
18
+ }
19
+ //# sourceMappingURL=sim-cloud-front-custom-error-configurator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-cloud-front-custom-error-configurator.d.ts","sourceRoot":"","sources":["../../../../../src/service/cloudfront/distribution/configurator/sim-cloud-front-custom-error-configurator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sCAAsC,EAAE,MAAM,kEAAkE,CAAC;AAC/H,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAWnF;;;;;;;;GAQG;AACH,qBAAa,oCAAoC;IAC/C;;OAEG;IACH,SAAS,CACP,YAAY,EAAE,yBAAyB,EACvC,mBAAmB,EAAE,sCAAsC,GAC1D,IAAI,CAyCN;IAED,OAAO,CAAC,YAAY;CAgBrB"}
@@ -0,0 +1,53 @@
1
+ import { simCloudFrontCustomErrorCodes, simCloudFrontCustomErrorResponseCodes, } from "../../custom-error/sim-cloudfront-custom-error-response.js";
2
+ import { SimCloudFrontInvalidArgument, SimCloudFrontInvalidErrorCode, SimCloudFrontInvalidResponseCode, } from "../../error/sim-cloudfront.error.js";
3
+ /**
4
+ * Applies custom error response configuration to a sim CloudFront
5
+ * Distribution.
6
+ *
7
+ * CloudFront pairs `ResponsePagePath` and `ResponseCode`: a rule carrying one
8
+ * without the other is refused rather than half applied. A rule carrying
9
+ * neither only configures error caching, which this simulator does not model,
10
+ * so it is accepted and left out of the Distribution's request handling.
11
+ */
12
+ export class SimCloudFrontCustomErrorConfigurator {
13
+ /**
14
+ * Configure one custom error response on a Distribution.
15
+ */
16
+ configure(distribution, customErrorResponse) {
17
+ const errorCode = customErrorResponse.ErrorCode;
18
+ if (errorCode === undefined ||
19
+ !simCloudFrontCustomErrorCodes.has(errorCode)) {
20
+ throw new SimCloudFrontInvalidErrorCode(`CloudFront CustomErrorResponse ErrorCode ${String(errorCode)} is not one of ${[...simCloudFrontCustomErrorCodes].join(", ")}`);
21
+ }
22
+ const responsePagePath = customErrorResponse.ResponsePagePath;
23
+ const responseCode = this.responseCode(customErrorResponse.ResponseCode);
24
+ if (responsePagePath === undefined || responsePagePath === "") {
25
+ if (responseCode !== undefined) {
26
+ throw new SimCloudFrontInvalidArgument(`CloudFront CustomErrorResponse for ${String(errorCode)} has a ResponseCode without a ResponsePagePath`);
27
+ }
28
+ return;
29
+ }
30
+ if (responseCode === undefined) {
31
+ throw new SimCloudFrontInvalidArgument(`CloudFront CustomErrorResponse for ${String(errorCode)} has a ResponsePagePath without a ResponseCode`);
32
+ }
33
+ if (!responsePagePath.startsWith("/")) {
34
+ throw new SimCloudFrontInvalidArgument(`CloudFront CustomErrorResponse ResponsePagePath ${responsePagePath} must begin with a forward slash`);
35
+ }
36
+ distribution.addCustomErrorResponse({
37
+ errorCode,
38
+ responsePagePath,
39
+ responseCode,
40
+ });
41
+ }
42
+ responseCode(responseCode) {
43
+ if (responseCode === undefined || responseCode === "") {
44
+ return undefined;
45
+ }
46
+ const parsed = Number(responseCode);
47
+ if (!simCloudFrontCustomErrorResponseCodes.has(parsed)) {
48
+ throw new SimCloudFrontInvalidResponseCode(`CloudFront CustomErrorResponse ResponseCode ${String(responseCode)} is not one of ${[...simCloudFrontCustomErrorResponseCodes].join(", ")}`);
49
+ }
50
+ return parsed;
51
+ }
52
+ }
53
+ //# sourceMappingURL=sim-cloud-front-custom-error-configurator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sim-cloud-front-custom-error-configurator.js","sourceRoot":"","sources":["../../../../../src/service/cloudfront/distribution/configurator/sim-cloud-front-custom-error-configurator.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,6BAA6B,EAC7B,qCAAqC,GACtC,MAAM,4DAA4D,CAAC;AACpE,OAAO,EACL,4BAA4B,EAC5B,6BAA6B,EAC7B,gCAAgC,GACjC,MAAM,qCAAqC,CAAC;AAE7C;;;;;;;;GAQG;AACH,MAAM,OAAO,oCAAoC;IAC/C;;OAEG;IACH,SAAS,CACP,YAAuC,EACvC,mBAA2D;QAE3D,MAAM,SAAS,GAAG,mBAAmB,CAAC,SAAS,CAAC;QAChD,IACE,SAAS,KAAK,SAAS;YACvB,CAAC,6BAA6B,CAAC,GAAG,CAAC,SAAS,CAAC,EAC7C,CAAC;YACD,MAAM,IAAI,6BAA6B,CACrC,4CAA4C,MAAM,CAAC,SAAS,CAAC,kBAAkB,CAAC,GAAG,6BAA6B,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAC/H,CAAC;QACJ,CAAC;QAED,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,gBAAgB,CAAC;QAC9D,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC;QAEzE,IAAI,gBAAgB,KAAK,SAAS,IAAI,gBAAgB,KAAK,EAAE,EAAE,CAAC;YAC9D,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;gBAC/B,MAAM,IAAI,4BAA4B,CACpC,sCAAsC,MAAM,CAAC,SAAS,CAAC,gDAAgD,CACxG,CAAC;YACJ,CAAC;YAED,OAAO;QACT,CAAC;QAED,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;YAC/B,MAAM,IAAI,4BAA4B,CACpC,sCAAsC,MAAM,CAAC,SAAS,CAAC,gDAAgD,CACxG,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,gBAAgB,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACtC,MAAM,IAAI,4BAA4B,CACpC,mDAAmD,gBAAgB,kCAAkC,CACtG,CAAC;QACJ,CAAC;QAED,YAAY,CAAC,sBAAsB,CAAC;YAClC,SAAS;YACT,gBAAgB;YAChB,YAAY;SACb,CAAC,CAAC;IACL,CAAC;IAEO,YAAY,CAClB,YAAyC;QAEzC,IAAI,YAAY,KAAK,SAAS,IAAI,YAAY,KAAK,EAAE,EAAE,CAAC;YACtD,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;QACpC,IAAI,CAAC,qCAAqC,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;YACvD,MAAM,IAAI,gCAAgC,CACxC,+CAA+C,MAAM,CAAC,YAAY,CAAC,kBAAkB,CAAC,GAAG,qCAAqC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAC7I,CAAC;QACJ,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
@@ -5,10 +5,12 @@ import type { SimCloudFrontBehaviorConfigurator } from "./sim-cloud-front-behavi
5
5
  /**
6
6
  * Applies top-level Distribution configuration to a sim CloudFront Distribution.
7
7
  *
8
- * Orchestrates the three configuration steps in the order CloudFront requires:
8
+ * Orchestrates the configuration steps in the order CloudFront requires:
9
9
  * 1. Alternate domain names (Aliases)
10
10
  * 2. Origins
11
11
  * 3. Cache Behaviors (default first, then named patterns)
12
+ * 4. The default root object and custom error responses, which are request
13
+ * handling rather than routing and so depend on nothing above them
12
14
  *
13
15
  * Named Cache Behaviors must be added after the default so that the default
14
16
  * always acts as the fallback when no path pattern matches.
@@ -16,10 +18,18 @@ import type { SimCloudFrontBehaviorConfigurator } from "./sim-cloud-front-behavi
16
18
  export declare class SimCloudFrontDistributionConfigurator {
17
19
  private readonly originConfigurator;
18
20
  private readonly behaviorConfigurator;
21
+ private readonly customErrorConfigurator;
19
22
  constructor(originConfigurator: SimCloudFrontOriginConfigurator, behaviorConfigurator: SimCloudFrontBehaviorConfigurator);
20
23
  /**
21
24
  * Configure a Distribution from its DistributionConfig.
22
25
  */
23
26
  configure(distribution: SimCloudFrontDistribution, distributionConfig: SimCloudFrontDistributionConfig): void;
27
+ /**
28
+ * CloudFront takes the default root object as an Origin object name, so a
29
+ * leading forward slash is refused rather than quietly stripped: in real
30
+ * CloudFront it produces a 403 on every request to the Distribution root.
31
+ * An empty value means no default root object, as it does in AWS.
32
+ */
33
+ private defaultRootObject;
24
34
  }
25
35
  //# sourceMappingURL=sim-cloud-front-distribution-configurator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sim-cloud-front-distribution-configurator.d.ts","sourceRoot":"","sources":["../../../../../src/service/cloudfront/distribution/configurator/sim-cloud-front-distribution-configurator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,kEAAkE,CAAC;AACxH,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AACnF,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,0CAA0C,CAAC;AAChG,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,4CAA4C,CAAC;AAEpG;;;;;;;;;;GAUG;AACH,qBAAa,qCAAqC;IAE9C,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IACnC,OAAO,CAAC,QAAQ,CAAC,oBAAoB;IAFvC,YACmB,kBAAkB,EAAE,+BAA+B,EACnD,oBAAoB,EAAE,iCAAiC,EACtE;IAEJ;;OAEG;IACH,SAAS,CACP,YAAY,EAAE,yBAAyB,EACvC,kBAAkB,EAAE,+BAA+B,GAClD,IAAI,CAuBN;CACF"}
1
+ {"version":3,"file":"sim-cloud-front-distribution-configurator.d.ts","sourceRoot":"","sources":["../../../../../src/service/cloudfront/distribution/configurator/sim-cloud-front-distribution-configurator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,kEAAkE,CAAC;AACxH,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AACnF,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,0CAA0C,CAAC;AAChG,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,4CAA4C,CAAC;AAIpG;;;;;;;;;;;;GAYG;AACH,qBAAa,qCAAqC;IAK9C,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IACnC,OAAO,CAAC,QAAQ,CAAC,oBAAoB;IALvC,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CACK;IAE7C,YACmB,kBAAkB,EAAE,+BAA+B,EACnD,oBAAoB,EAAE,iCAAiC,EACtE;IAEJ;;OAEG;IACH,SAAS,CACP,YAAY,EAAE,yBAAyB,EACvC,kBAAkB,EAAE,+BAA+B,GAClD,IAAI,CAiCN;IAED;;;;;OAKG;IACH,OAAO,CAAC,iBAAiB;CAe1B"}
@@ -1,10 +1,14 @@
1
+ import { SimCloudFrontCustomErrorConfigurator } from "./sim-cloud-front-custom-error-configurator.js";
2
+ import { SimCloudFrontInvalidDefaultRootObject } from "../../error/sim-cloudfront.error.js";
1
3
  /**
2
4
  * Applies top-level Distribution configuration to a sim CloudFront Distribution.
3
5
  *
4
- * Orchestrates the three configuration steps in the order CloudFront requires:
6
+ * Orchestrates the configuration steps in the order CloudFront requires:
5
7
  * 1. Alternate domain names (Aliases)
6
8
  * 2. Origins
7
9
  * 3. Cache Behaviors (default first, then named patterns)
10
+ * 4. The default root object and custom error responses, which are request
11
+ * handling rather than routing and so depend on nothing above them
8
12
  *
9
13
  * Named Cache Behaviors must be added after the default so that the default
10
14
  * always acts as the fallback when no path pattern matches.
@@ -12,6 +16,7 @@
12
16
  export class SimCloudFrontDistributionConfigurator {
13
17
  originConfigurator;
14
18
  behaviorConfigurator;
19
+ customErrorConfigurator = new SimCloudFrontCustomErrorConfigurator();
15
20
  constructor(originConfigurator, behaviorConfigurator) {
16
21
  this.originConfigurator = originConfigurator;
17
22
  this.behaviorConfigurator = behaviorConfigurator;
@@ -33,6 +38,26 @@ export class SimCloudFrontDistributionConfigurator {
33
38
  for (const cacheBehavior of cacheBehaviorItems) {
34
39
  this.behaviorConfigurator.configureCacheBehavior(distribution, cacheBehavior);
35
40
  }
41
+ distribution.defaultRootObject = this.defaultRootObject(distributionConfig.DefaultRootObject);
42
+ const customErrorItems = distributionConfig.CustomErrorResponses?.Items ?? [];
43
+ for (const customErrorResponse of customErrorItems) {
44
+ this.customErrorConfigurator.configure(distribution, customErrorResponse);
45
+ }
46
+ }
47
+ /**
48
+ * CloudFront takes the default root object as an Origin object name, so a
49
+ * leading forward slash is refused rather than quietly stripped: in real
50
+ * CloudFront it produces a 403 on every request to the Distribution root.
51
+ * An empty value means no default root object, as it does in AWS.
52
+ */
53
+ defaultRootObject(defaultRootObject) {
54
+ if (defaultRootObject === undefined || defaultRootObject === "") {
55
+ return undefined;
56
+ }
57
+ if (defaultRootObject.startsWith("/")) {
58
+ throw new SimCloudFrontInvalidDefaultRootObject(`CloudFront DefaultRootObject ${defaultRootObject} must not begin with a forward slash`);
59
+ }
60
+ return defaultRootObject;
36
61
  }
37
62
  }
38
63
  //# sourceMappingURL=sim-cloud-front-distribution-configurator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sim-cloud-front-distribution-configurator.js","sourceRoot":"","sources":["../../../../../src/service/cloudfront/distribution/configurator/sim-cloud-front-distribution-configurator.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;GAUG;AACH,MAAM,OAAO,qCAAqC;IAE7B,kBAAkB;IAClB,oBAAoB;IAFvC,YACmB,kBAAmD,EACnD,oBAAuD;kCADvD,kBAAkB;oCAClB,oBAAoB;IACpC,CAAC;IAEJ;;OAEG;IACH,SAAS,CACP,YAAuC,EACvC,kBAAmD;QAEnD,MAAM,UAAU,GAAG,kBAAkB,CAAC,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC;QAC3D,KAAK,MAAM,KAAK,IAAI,UAAU,EAAE,CAAC;YAC/B,YAAY,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC;QAC7C,CAAC;QAED,MAAM,WAAW,GAAG,kBAAkB,CAAC,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC;QAC5D,KAAK,MAAM,MAAM,IAAI,WAAW,EAAE,CAAC;YACjC,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;QAC1D,CAAC;QAED,IAAI,CAAC,oBAAoB,CAAC,6BAA6B,CACrD,YAAY,EACZ,kBAAkB,CAAC,oBAAoB,CACxC,CAAC;QAEF,MAAM,kBAAkB,GAAG,kBAAkB,CAAC,cAAc,EAAE,KAAK,IAAI,EAAE,CAAC;QAC1E,KAAK,MAAM,aAAa,IAAI,kBAAkB,EAAE,CAAC;YAC/C,IAAI,CAAC,oBAAoB,CAAC,sBAAsB,CAC9C,YAAY,EACZ,aAAa,CACd,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
1
+ {"version":3,"file":"sim-cloud-front-distribution-configurator.js","sourceRoot":"","sources":["../../../../../src/service/cloudfront/distribution/configurator/sim-cloud-front-distribution-configurator.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,oCAAoC,EAAE,MAAM,gDAAgD,CAAC;AACtG,OAAO,EAAE,qCAAqC,EAAE,MAAM,qCAAqC,CAAC;AAE5F;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,qCAAqC;IAK7B,kBAAkB;IAClB,oBAAoB;IALtB,uBAAuB,GACtC,IAAI,oCAAoC,EAAE,CAAC;IAE7C,YACmB,kBAAmD,EACnD,oBAAuD;kCADvD,kBAAkB;oCACl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,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,IAAI,iBAAiB,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACtC,MAAM,IAAI,qCAAqC,CAC7C,gCAAgC,iBAAiB,sCAAsC,CACxF,CAAC;QACJ,CAAC;QAED,OAAO,iBAAiB,CAAC;IAC3B,CAAC;CACF"}
@@ -1,6 +1,7 @@
1
1
  import type { Brand } from "../../../util/brand.type.js";
2
2
  import type { SimCloudFrontOrigin } from "../origin/sim-cloudfront-origin.js";
3
3
  import type { SimCloudFrontBehavior } from "../behaviour/sim-cloud-front-behavior.js";
4
+ import type { SimCloudFrontCustomErrorResponse } from "../custom-error/sim-cloudfront-custom-error-response.js";
4
5
  import { type SimAwsAccountId } from "../../aws/sim-aws-account.js";
5
6
  import type { SimCloudFrontDistributionConfig } from "../command/create-distribution/create-distribution.command.js";
6
7
  import { type SimClock } from "../../../util/clock/sim-clock.js";
@@ -26,6 +27,7 @@ export declare class SimCloudFrontDistribution {
26
27
  readonly accountId: SimAwsAccountId;
27
28
  readonly distributionConfig: SimCloudFrontDistributionConfig | undefined;
28
29
  readonly behaviors: SimCloudFrontBehavior[];
30
+ readonly customErrorResponses: SimCloudFrontCustomErrorResponse[];
29
31
  readonly lastModifiedTime: Date;
30
32
  private readonly alternateDomainNames;
31
33
  private readonly origins;
@@ -34,6 +36,14 @@ export declare class SimCloudFrontDistribution {
34
36
  * Get the current Status of this sim Distribution.
35
37
  */
36
38
  get status(): SimCloudFrontDistributionStatus;
39
+ /**
40
+ * Get the object this sim Distribution serves for a request to its root.
41
+ */
42
+ get defaultRootObject(): string | undefined;
43
+ /**
44
+ * Set the object this sim Distribution serves for a request to its root.
45
+ */
46
+ set defaultRootObject(defaultRootObject: string | undefined);
37
47
  /**
38
48
  * Move the sim Distribution into Deployed status.
39
49
  */
@@ -54,6 +64,10 @@ export declare class SimCloudFrontDistribution {
54
64
  * Add a Behavior to this sim Distribution.
55
65
  */
56
66
  addBehavior(behavior: SimCloudFrontBehavior): void;
67
+ /**
68
+ * Add a custom error response to this sim Distribution.
69
+ */
70
+ addCustomErrorResponse(customErrorResponse: SimCloudFrontCustomErrorResponse): void;
57
71
  /**
58
72
  * Add an Origin to this sim Distribution.
59
73
  */
@@ -1 +1 @@
1
- {"version":3,"file":"sim-cloudfront-distribution.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudfront/distribution/sim-cloudfront-distribution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAEtF,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,+DAA+D,CAAC;AACrH,OAAO,EAAE,KAAK,QAAQ,EAAgB,MAAM,kCAAkC,CAAC;AAE/E,MAAM,MAAM,2BAA2B,GAAG,KAAK,CAC7C,MAAM,EACN,6BAA6B,CAC9B,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG,WAAW,GAAG,UAAU,CAAC;AAEvE,UAAU,mCAAmC;IAC3C,QAAQ,CAAC,cAAc,CAAC,EAAE,2BAA2B,CAAC;IACtD,QAAQ,CAAC,MAAM,CAAC,EAAE,+BAA+B,CAAC;IAClD,QAAQ,CAAC,SAAS,CAAC,EAAE,eAAe,CAAC;IACrC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,+BAA+B,CAAC;IAC9D;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC;CAC3B;AAED;;GAEG;AACH,qBAAa,yBAAyB;;IACpC,SAAgB,cAAc,EAAE,2BAA2B,CAAC;IAC5D,SAAgB,SAAS,EAAE,eAAe,CAAC;IAC3C,SAAgB,kBAAkB,EAChC,+BAA+B,GAAG,SAAS,CAAC;IAC9C,SAAgB,SAAS,EAAE,qBAAqB,EAAE,CAAM;IACxD,SAAgB,gBAAgB,EAAE,IAAI,CAAC;IAGvC,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAqB;IAE1D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA0C;IAElE,YAAY,UAAU,GAAE,mCAAwC,EAc/D;IAED;;OAEG;IACH,IAAI,MAAM,IAAI,+BAA+B,CAE5C;IAED;;OAEG;IACH,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CAGlC;IAED;;OAEG;IACH,uBAAuB,IAAI,WAAW,CAAC,MAAM,CAAC,CAE7C;IAED;;OAEG;IACH,UAAU,IAAI,WAAW,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAErD;IAED;;OAEG;IACH,sBAAsB,CAAC,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAExD;IAED;;OAEG;IACH,WAAW,CAAC,QAAQ,EAAE,qBAAqB,GAAG,IAAI,CAEjD;IAED;;OAEG;IACH,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAE/D;IAED;;OAEG;IACH,sBAAsB,CAAC,mBAAmB,EAAE,MAAM,GAAG,OAAO,CAE3D;IAED;;OAEG;IACH,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS,CAE7D;CACF;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,2BAA2B,CAIhE"}
1
+ {"version":3,"file":"sim-cloudfront-distribution.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudfront/distribution/sim-cloudfront-distribution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACtF,OAAO,KAAK,EAAE,gCA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iBAAiB,EAAE,MAAM,GAAG,SAAS,EAE1D;IAED;;OAEG;IACH,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CAGlC;IAED;;OAEG;IACH,uBAAuB,IAAI,WAAW,CAAC,MAAM,CAAC,CAE7C;IAED;;OAEG;IACH,UAAU,IAAI,WAAW,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAErD;IAED;;OAEG;IACH,sBAAsB,CAAC,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAExD;IAED;;OAEG;IACH,WAAW,CAAC,QAAQ,EAAE,qBAAqB,GAAG,IAAI,CAEjD;IAED;;OAEG;IACH,sBAAsB,CACpB,mBAAmB,EAAE,gCAAgC,GACpD,IAAI,CAEN;IAED;;OAEG;IACH,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAE/D;IAED;;OAEG;IACH,sBAAsB,CAAC,mBAAmB,EAAE,MAAM,GAAG,OAAO,CAE3D;IAED;;OAEG;IACH,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS,CAE7D;CACF;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,2BAA2B,CAIhE"}
@@ -9,8 +9,10 @@ export class SimCloudFrontDistribution {
9
9
  accountId;
10
10
  distributionConfig;
11
11
  behaviors = [];
12
+ customErrorResponses = [];
12
13
  lastModifiedTime;
13
14
  #status;
15
+ #defaultRootObject;
14
16
  alternateDomainNames = new Set();
15
17
  origins = new Map();
16
18
  constructor(properties = {}) {
@@ -27,6 +29,18 @@ export class SimCloudFrontDistribution {
27
29
  get status() {
28
30
  return this.#status;
29
31
  }
32
+ /**
33
+ * Get the object this sim Distribution serves for a request to its root.
34
+ */
35
+ get defaultRootObject() {
36
+ return this.#defaultRootObject;
37
+ }
38
+ /**
39
+ * Set the object this sim Distribution serves for a request to its root.
40
+ */
41
+ set defaultRootObject(defaultRootObject) {
42
+ this.#defaultRootObject = defaultRootObject;
43
+ }
30
44
  /**
31
45
  * Move the sim Distribution into Deployed status.
32
46
  */
@@ -58,6 +72,12 @@ export class SimCloudFrontDistribution {
58
72
  addBehavior(behavior) {
59
73
  this.behaviors.push(behavior);
60
74
  }
75
+ /**
76
+ * Add a custom error response to this sim Distribution.
77
+ */
78
+ addCustomErrorResponse(customErrorResponse) {
79
+ this.customErrorResponses.push(customErrorResponse);
80
+ }
61
81
  /**
62
82
  * Add an Origin to this sim Distribution.
63
83
  */
@@ -1 +1 @@
1
- {"version":3,"file":"sim-cloudfront-distribution.js","sourceRoot":"","sources":["../../../../src/service/cloudfront/distribution/sim-cloudfront-distribution.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EACL,mBAAmB,GAEpB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAiB,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAqB/E;;GAEG;AACH,MAAM,OAAO,yBAAyB;IACpB,cAAc,CAA8B;IAC5C,SAAS,CAAkB;IAC3B,kBAAkB,CACY;IAC9B,SAAS,GAA4B,EAAE,CAAC;IACxC,gBAAgB,CAAO;IAEvC,OAAO,CAAkC;IACxB,oBAAoB,GAAG,IAAI,GAAG,EAAU,CAAC;IAEzC,OAAO,GAAG,IAAI,GAAG,EAA+B,CAAC;IAElE,YAAY,UAAU,GAAwC,EAAE;QAC9D,MAAM,EACJ,cAAc,GAAG,kBAAkB,EAAE,EACrC,MAAM,GAAG,UAAU,EACnB,SAAS,GAAG,mBAAmB,EAAE,EACjC,kBAAkB,EAClB,KAAK,GAAG,IAAI,YAAY,EAAE,GAC3B,GAAG,UAAU,CAAC;QAEf,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC;QACpC,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;IAC/C,CAAC;IAED;;OAEG;IACH,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED;;OAEG;IACH,kBAAkB;QAChB,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC;QAC1B,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,uBAAuB;QACrB,OAAO,IAAI,CAAC,oBAAoB,CAAC;IACnC,CAAC;IAED;;OAEG;IACH,UAAU;QACR,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED;;OAEG;IACH,sBAAsB,CAAC,mBAA2B;QAChD,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IACrD,CAAC;IAED;;OAEG;IACH,WAAW,CAAC,QAA+B;QACzC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAChC,CAAC;IAED;;OAEG;IACH,SAAS,CAAC,UAAkB,EAAE,MAA2B;QACvD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IACvC,CAAC;IAED;;OAEG;IACH,sBAAsB,CAAC,mBAA2B;QAChD,OAAO,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IAC5D,CAAC;IAED;;OAEG;IACH,SAAS,CAAC,UAAkB;QAC1B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACtC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB;IAChC,OAAO,KAAK,CAAC,OAAO,CAAC,UAAU,CAC7B,eAAe,CACe,CAAC;AACnC,CAAC"}
1
+ {"version":3,"file":"sim-cloudfront-distribution.js","sourceRoot":"","sources":["../../../../src/service/cloudfront/distribution/sim-cloudfront-distribution.ts"],"names":[],"mapp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B,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC;QAC1B,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,uBAAuB;QACrB,OAAO,IAAI,CAAC,oBAAoB,CAAC;IACnC,CAAC;IAED;;OAEG;IACH,UAAU;QACR,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED;;OAEG;IACH,sBAAsB,CAAC,mBAA2B;QAChD,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IACrD,CAAC;IAED;;OAEG;IACH,WAAW,CAAC,QAA+B;QACzC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAChC,CAAC;IAED;;OAEG;IACH,sBAAsB,CACpB,mBAAqD;QAErD,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IACtD,CAAC;IAED;;OAEG;IACH,SAAS,CAAC,UAAkB,EAAE,MAA2B;QACvD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IACvC,CAAC;IAED;;OAEG;IACH,sBAAsB,CAAC,mBAA2B;QAChD,OAAO,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IAC5D,CAAC;IAED;;OAEG;IACH,SAAS,CAAC,UAAkB;QAC1B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACtC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB;IAChC,OAAO,KAAK,CAAC,OAAO,CAAC,UAAU,CAC7B,eAAe,CACe,CAAC;AACnC,CAAC"}
@@ -22,6 +22,37 @@ export declare class SimCloudFrontInvalidViewerCertificate extends SimCloudFront
22
22
  readonly name = "InvalidViewerCertificate";
23
23
  constructor(message: string);
24
24
  }
25
+ /**
26
+ * Simulated CloudFront InvalidDefaultRootObject error.
27
+ *
28
+ * CloudFront requires the default root object to name an object at the Origin,
29
+ * so a value starting with a forward slash is refused.
30
+ */
31
+ export declare class SimCloudFrontInvalidDefaultRootObject extends SimCloudFrontError {
32
+ readonly name = "InvalidDefaultRootObject";
33
+ constructor(message: string);
34
+ }
35
+ /**
36
+ * Simulated CloudFront InvalidErrorCode error.
37
+ */
38
+ export declare class SimCloudFrontInvalidErrorCode extends SimCloudFrontError {
39
+ readonly name = "InvalidErrorCode";
40
+ constructor(message: string);
41
+ }
42
+ /**
43
+ * Simulated CloudFront InvalidResponseCode error.
44
+ */
45
+ export declare class SimCloudFrontInvalidResponseCode extends SimCloudFrontError {
46
+ readonly name = "InvalidResponseCode";
47
+ constructor(message: string);
48
+ }
49
+ /**
50
+ * Simulated CloudFront InvalidArgument error.
51
+ */
52
+ export declare class SimCloudFrontInvalidArgument extends SimCloudFrontError {
53
+ readonly name = "InvalidArgument";
54
+ constructor(message: string);
55
+ }
25
56
  /**
26
57
  * Simulated CloudFront ResourceNotFoundException error.
27
58
  */
@@ -1 +1 @@
1
- {"version":3,"file":"sim-cloudfront.error.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudfront/error/sim-cloudfront.error.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CAClC;AAED;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;aAGzB,SAAS,EAAE,0BAA0B;IAFvD,YACE,OAAO,EAAE,MAAM,EACC,SAAS,GAAE,0BAA+B,EAG3D;CACF;AAED;;;;;;GAMG;AACH,qBAAa,qCAAsC,SAAQ,kBAAkB;IAC3E,SAAyB,IAAI,8BAA8B;IAE3D,YAAY,OAAO,EAAE,MAAM,EAE1B;CACF;AAED;;GAEG;AACH,qBAAa,sCAAuC,SAAQ,kBAAkB;IAC5E,SAAyB,IAAI,+BAA+B;IAE5D,YAAY,OAAO,EAAE,MAAM,EAE1B;CACF"}
1
+ {"version":3,"file":"sim-cloudfront.error.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudfront/error/sim-cloudfront.error.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CAClC;AAED;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;aAGzB,SAAS,EAAE,0BAA0B;IAFvD,YACE,OAAO,EAAE,MAAM,EACC,SAAS,GAAE,0BAA+B,EAG3D;CACF;AAED;;;;;;GAMG;AACH,qBAAa,qCAAsC,SAAQ,kBAAkB;IAC3E,SAAyB,IAAI,8BAA8B;IAE3D,YAAY,OAAO,EAAE,MAAM,EAE1B;CACF;AAED;;;;;GAKG;AACH,qBAAa,qCAAsC,SAAQ,kBAAkB;IAC3E,SAAyB,IAAI,8BAA8B;IAE3D,YAAY,OAAO,EAAE,MAAM,EAE1B;CACF;AAED;;GAEG;AACH,qBAAa,6BAA8B,SAAQ,kBAAkB;IACnE,SAAyB,IAAI,sBAAsB;IAEnD,YAAY,OAAO,EAAE,MAAM,EAE1B;CACF;AAED;;GAEG;AACH,qBAAa,gCAAiC,SAAQ,kBAAkB;IACtE,SAAyB,IAAI,yBAAyB;IAEtD,YAAY,OAAO,EAAE,MAAM,EAE1B;CACF;AAED;;GAEG;AACH,qBAAa,4BAA6B,SAAQ,kBAAkB;IAClE,SAAyB,IAAI,qBAAqB;IAElD,YAAY,OAAO,EAAE,MAAM,EAE1B;CACF;AAED;;GAEG;AACH,qBAAa,sCAAuC,SAAQ,kBAAkB;IAC5E,SAAyB,IAAI,+BAA+B;IAE5D,YAAY,OAAO,EAAE,MAAM,EAE1B;CACF"}
@@ -21,6 +21,45 @@ export class SimCloudFrontInvalidViewerCertificate extends SimCloudFrontError {
21
21
  super(message, { httpStatusCode: 400 });
22
22
  }
23
23
  }
24
+ /**
25
+ * Simulated CloudFront InvalidDefaultRootObject error.
26
+ *
27
+ * CloudFront requires the default root object to name an object at the Origin,
28
+ * so a value starting with a forward slash is refused.
29
+ */
30
+ export class SimCloudFrontInvalidDefaultRootObject extends SimCloudFrontError {
31
+ name = "InvalidDefaultRootObject";
32
+ constructor(message) {
33
+ super(message, { httpStatusCode: 400 });
34
+ }
35
+ }
36
+ /**
37
+ * Simulated CloudFront InvalidErrorCode error.
38
+ */
39
+ export class SimCloudFrontInvalidErrorCode extends SimCloudFrontError {
40
+ name = "InvalidErrorCode";
41
+ constructor(message) {
42
+ super(message, { httpStatusCode: 400 });
43
+ }
44
+ }
45
+ /**
46
+ * Simulated CloudFront InvalidResponseCode error.
47
+ */
48
+ export class SimCloudFrontInvalidResponseCode extends SimCloudFrontError {
49
+ name = "InvalidResponseCode";
50
+ constructor(message) {
51
+ super(message, { httpStatusCode: 400 });
52
+ }
53
+ }
54
+ /**
55
+ * Simulated CloudFront InvalidArgument error.
56
+ */
57
+ export class SimCloudFrontInvalidArgument extends SimCloudFrontError {
58
+ name = "InvalidArgument";
59
+ constructor(message) {
60
+ super(message, { httpStatusCode: 400 });
61
+ }
62
+ }
24
63
  /**
25
64
  * Simulated CloudFront ResourceNotFoundException error.
26
65
  */
@@ -1 +1 @@
1
- {"version":3,"file":"sim-cloudfront.error.js","sourceRoot":"","sources":["../../../../src/service/cloudfront/error/sim-cloudfront.error.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAGzB,SAAS;IAF3B,YACE,OAAe,EACC,SAAS,GAA+B,EAAE;QAE1D,KAAK,CAAC,OAAO,CAAC,CAAC;yBAFC,SAAS;IAG3B,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,OAAO,qCAAsC,SAAQ,kBAAkB;IAClD,IAAI,GAAG,0BAA0B,CAAC;IAE3D,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,EAAE,EAAE,cAAc,EAAE,GAAG,EAAE,CAAC,CAAC;IAC1C,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,sCAAuC,SAAQ,kBAAkB;IACnD,IAAI,GAAG,2BAA2B,CAAC;IAE5D,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,EAAE,EAAE,cAAc,EAAE,GAAG,EAAE,CAAC,CAAC;IAC1C,CAAC;CACF"}
1
+ {"version":3,"file":"sim-cloudfront.error.js","sourceRoot":"","sources":["../../../../src/service/cloudfront/error/sim-cloudfront.error.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAGzB,SAAS;IAF3B,YACE,OAAe,EACC,SAAS,GAA+B,EAAE;QAE1D,KAAK,CAAC,OAAO,CAAC,CAAC;yBAFC,SAAS;IAG3B,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,OAAO,qCAAsC,SAAQ,kBAAkB;IAClD,IAAI,GAAG,0BAA0B,CAAC;IAE3D,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,EAAE,EAAE,cAAc,EAAE,GAAG,EAAE,CAAC,CAAC;IAC1C,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,OAAO,qCAAsC,SAAQ,kBAAkB;IAClD,IAAI,GAAG,0BAA0B,CAAC;IAE3D,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,EAAE,EAAE,cAAc,EAAE,GAAG,EAAE,CAAC,CAAC;IAC1C,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,6BAA8B,SAAQ,kBAAkB;IAC1C,IAAI,GAAG,kBAAkB,CAAC;IAEnD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,EAAE,EAAE,cAAc,EAAE,GAAG,EAAE,CAAC,CAAC;IAC1C,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,gCAAiC,SAAQ,kBAAkB;IAC7C,IAAI,GAAG,qBAAqB,CAAC;IAEtD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,EAAE,EAAE,cAAc,EAAE,GAAG,EAAE,CAAC,CAAC;IAC1C,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,4BAA6B,SAAQ,kBAAkB;IACzC,IAAI,GAAG,iBAAiB,CAAC;IAElD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,EAAE,EAAE,cAAc,EAAE,GAAG,EAAE,CAAC,CAAC;IAC1C,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,sCAAuC,SAAQ,kBAAkB;IACnD,IAAI,GAAG,2BAA2B,CAAC;IAE5D,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,EAAE,EAAE,cAAc,EAAE,GAAG,EAAE,CAAC,CAAC;IAC1C,CAAC;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"sim-cloud-front-distro-router.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudfront/router/sim-cloud-front-distro-router.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,2BAA2B,EAC5B,MAAM,gDAAgD,CAAC;AAGxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AACrF,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAK9C,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC;IACnC,QAAQ,CAAC,YAAY,EAAE,yBAAyB,CAAC;CAClD;AAED,UAAU,mCAAmC;IAC3C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,kBAAkB,CAAC,EAAE,qBAAqB,CAAC;IACpD,QAAQ,CAAC,aAAa,CAAC,EAAE,WAAW,CAClC,2BAA2B,EAC3B,yBAAyB,CAC1B,CAAC;CACH;AAED;;;;;;;GAOG;AACH,qBAAa,yBAAyB;IACpC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAqC;IAC3E,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA8B;IAE7D,YAAY,UAAU,GAAE,mCAAwC,EAmB/D;IAED;;OAEG;IACH,MAAM,CAAC,iBAAiB,CACtB,aAAa,EAAE,yBAAyB,EAAE,GACzC,yBAAyB,CAM3B;IAED;;;;;;OAMG;IACH,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,wBAAwB,GAAG,SAAS,CAatE;IAED;;OAEG;IACH,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,yBAAyB,GAAG,SAAS,CAExE;CACF"}
1
+ {"version":3,"file":"sim-cloud-front-distro-router.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudfront/router/sim-cloud-front-distro-router.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,2BAA2B,EAC5B,MAAM,gDAAgD,CAAC;AAExD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AACrF,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAK9C,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC;IACnC,QAAQ,CAAC,YAAY,EAAE,yBAAyB,CAAC;CAClD;AAED,UAAU,mCAAmC;IAC3C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,kBAAkB,CAAC,EAAE,qBAAqB,CAAC;IACpD,QAAQ,CAAC,aAAa,CAAC,EAAE,WAAW,CAClC,2BAA2B,EAC3B,yBAAyB,CAC1B,CAAC;CACH;AAED;;;;;;;GAOG;AACH,qBAAa,yBAAyB;IACpC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAqC;IAC3E,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA8B;IAE7D,YAAY,UAAU,GAAE,mCAAwC,EAmB/D;IAED;;OAEG;IACH,MAAM,CAAC,iBAAiB,CACtB,aAAa,EAAE,yBAAyB,EAAE,GACzC,yBAAyB,CAM3B;IAED;;;;;;OAMG;IACH,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,wBAAwB,GAAG,SAAS,CAStE;IAED;;OAEG;IACH,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,yBAAyB,GAAG,SAAS,CAExE;CACF"}
@@ -1,5 +1,4 @@
1
- import { assertNotNull } from "../../../util/type-guard/defined.js";
2
- import { SimAwsLocalUrl } from "../../../serve/http/url/sim-aws-local-url.js";
1
+ import { simAwsRequestHostname } from "../../../serve/http/url/sim-aws-request-hostname.js";
3
2
  import { SimAws } from "../../aws/sim-aws.js";
4
3
  import { extractCloudFrontHostDistroId } from "./distro-id/extract-cf-host-distro-id.js";
5
4
  import { SimCloudFrontAlternateDomainRouter } from "./alternate-domain/sim-cf-alternate-domain-router.js";
@@ -50,11 +49,7 @@ export class SimCloudFrontDistroRouter {
50
49
  * are handled identically.
51
50
  */
52
51
  routeForRequest(request) {
53
- const url = new URL(request.url);
54
- const hostname = request.headers.get("host") ?? url.hostname;
55
- assertNotNull(hostname, "distroForRequest.req.headers.host");
56
- const simUrl = new SimAwsLocalUrl({ input: `http://${hostname}/` });
57
- const baseHostname = simUrl.withoutLocalhostSuffix().hostname;
52
+ const baseHostname = simAwsRequestHostname(request);
58
53
  const distributionId = extractCloudFrontHostDistroId(baseHostname);
59
54
  if (distributionId !== undefined) {
60
55
  return this.distroIdRouter.routeForDistributionId(distributionId);
@@ -1 +1 @@
1
- {"version":3,"file":"sim-cloud-front-distro-router.js","sourceRoot":"","sources":["../../../../src/service/cloudfront/router/sim-cloud-front-distro-router.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,8CAA8C,CAAC;AAG9E,OAAO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,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACjC,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC;QAC7D,aAAa,CAAC,QAAQ,EAAE,mCAAmC,CAAC,CAAC;QAC7D,MAAM,MAAM,GAAG,IAAI,cAAc,CAAC,EAAE,KAAK,EAAE,UAAU,QAAQ,GAAG,EAAE,CAAC,CAAC;QACpE,MAAM,YAAY,GAAG,MAAM,CAAC,sBAAsB,EAAE,CAAC,QAAQ,CAAC;QAE9D,MAAM,cAAc,GAAG,6BAA6B,CAAC,YAAY,CAAC,CAAC;QACnE,IAAI,cAAc,KAAK,SAAS,EAAE,CAAC;YACjC,OAAO,IAAI,CAAC,cAAc,CAAC,sBAAsB,CAAC,cAAc,CAAC,CAAC;QACpE,CAAC;QAED,OAAO,IAAI,CAAC,qBAAqB,CAAC,2BAA2B,CAAC,YAAY,CAAC,CAAC;IAC9E,CAAC;IAED;;OAEG;IACH,gBAAgB,CAAC,OAAgB;QAC/B,OAAO,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,YAAY,CAAC;IACrD,CAAC;CACF"}
1
+ {"version":3,"file":"sim-cloud-front-distro-router.js","sourceRoot":"","sources":["../../../../src/service/cloudfront/router/sim-cloud-front-distro-router.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qDAAqD,CAAC;AAG5F,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,6BAA6B,EAAE,MAAM,0CAA0C,CAAC;AACzF,OAAO,EAAE,kCAAkC,EAAE,MAAM,sDAAsD,CAAC;AAC1G,OAAO,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC;AAgBrF;;;;;;;GAOG;AACH,MAAM,OAAO,yBAAyB;IACnB,MAAM,CAAS;IACf,qBAAqB,CAAqC;IAC1D,cAAc,CAA8B;IA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,CAAC,OAAgB;QAC/B,OAAO,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,YAAY,CAAC;IACrD,CAAC;CACF"}
@@ -16,9 +16,10 @@ export interface SimDynamoDbDocumentCommandPaths {
16
16
  *
17
17
  * They stop short of the real ones in one place. `Expected`,
18
18
  * `ConditionalOperator` and `AttributeUpdates` are the conditional write and
19
- * the update that expressions replaced, and simulated DynamoDB refuses all
20
- * three, so a request carrying one never reaches a conversion. Converting input
21
- * that is about to be refused would only move the refusal.
19
+ * the update that expressions replaced, and `KeyConditions`, `QueryFilter` and
20
+ * `ScanFilter` are the read the same expressions replaced. Simulated DynamoDB
21
+ * refuses all six, so a request carrying one never reaches a conversion.
22
+ * Converting input that is about to be refused would only move the refusal.
22
23
  */
23
24
  export declare const simDynamoDbDocumentCommandPaths: {
24
25
  readonly put: {
@@ -37,6 +38,14 @@ export declare const simDynamoDbDocumentCommandPaths: {
37
38
  readonly input: SimDynamoDbDocumentPath;
38
39
  readonly output: SimDynamoDbDocumentPath;
39
40
  };
41
+ readonly query: {
42
+ readonly input: SimDynamoDbDocumentPath;
43
+ readonly output: SimDynamoDbDocumentPath;
44
+ };
45
+ readonly scan: {
46
+ readonly input: SimDynamoDbDocumentPath;
47
+ readonly output: SimDynamoDbDocumentPath;
48
+ };
40
49
  readonly batchWrite: {
41
50
  readonly input: SimDynamoDbDocumentPath;
42
51
  readonly output: SimDynamoDbDocumentPath;
@@ -1 +1 @@
1
- {"version":3,"file":"sim-dynamodb-document-command-paths.d.ts","sourceRoot":"","sources":["../../../../src/service/dynamodb/document/sim-dynamodb-document-command-paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,uBAAuB,EAE7B,MAAM,iCAAiC,CAAC;AAEzC;;GAEG;AACH,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,CAAC,KAAK,EAAE,uBAAuB,CAAC;IACxC,QAAQ,CAAC,MAAM,EAAE,uBAAuB,CAAC;CAC1C;AA2CD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,+BAA+B;;iBAExC,KAAK;iBAIL,MAAM;;;iBAGN,KAAK;iBACL,MAAM;;;iBAGN,KAAK;iBAIL,MAAM;;;iBAGN,KAAK;iBAIL,MAAM;;;iBAGN,KAAK;iBACL,MAAM;;;iBAGN,KAAK;iBACL,MAAM;;CAMoE,CAAC"}
1
+ {"version":3,"file":"sim-dynamodb-document-command-paths.d.ts","sourceRoot":"","sources":["../../../../src/service/dynamodb/document/sim-dynamodb-document-command-paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,uBAAuB,EAE7B,MAAM,iCAAiC,CAAC;AAEzC;;GAEG;AACH,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,CAAC,KAAK,EAAE,uBAAuB,CAAC;IACxC,QAAQ,CAAC,MAAM,EAAE,uBAAuB,CAAC;CAC1C;AA6DD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,+BAA+B;;iBAExC,KAAK;iBAIL,MAAM;;;iBAGN,KAAK;iBACL,MAAM;;;iBAGN,KAAK;iBAIL,MAAM;;;iBAGN,KAAK;iBAIL,MAAM;;;iBAGN,KAAK;iBACL,MAAM;;;iBAGN,KAAK;iBACL,MAAM;;;iBAGN,KAAK;iBACL,MAAM;;;iBAGN,KAAK;iBACL,MAAM;;CAMoE,CAAC"}