@jaypie/constructs 1.2.7 → 1.2.9

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.
@@ -1,4 +1,4 @@
1
- import { RemovalPolicy, Stack } from "aws-cdk-lib";
1
+ import { Duration, RemovalPolicy, Stack } from "aws-cdk-lib";
2
2
  import * as acm from "aws-cdk-lib/aws-certificatemanager";
3
3
  import * as cloudfront from "aws-cdk-lib/aws-cloudfront";
4
4
  import * as lambda from "aws-cdk-lib/aws-lambda";
@@ -41,6 +41,13 @@ export interface JaypieDistributionProps extends Omit<cloudfront.DistributionPro
41
41
  * @default InvokeMode.BUFFERED (or auto-detected from handler)
42
42
  */
43
43
  invokeMode?: lambda.InvokeMode;
44
+ /**
45
+ * Origin read timeout - how long CloudFront waits for a response from the origin.
46
+ * This is the maximum time allowed for the origin to respond.
47
+ * @default CDK.DURATION.CLOUDFRONT_API (120 seconds)
48
+ * @max Duration.seconds(120)
49
+ */
50
+ originReadTimeout?: Duration;
44
51
  /**
45
52
  * Role tag for tagging resources
46
53
  * @default CDK.ROLE.HOSTING
@@ -69,6 +69,7 @@ export declare const CDK: {
69
69
  };
70
70
  DURATION: {
71
71
  EXPRESS_API: number;
72
+ CLOUDFRONT_API: number;
72
73
  LAMBDA_MAXIMUM: number;
73
74
  LAMBDA_WORKER: number;
74
75
  };
package/dist/esm/index.js CHANGED
@@ -103,6 +103,7 @@ const CDK$2 = {
103
103
  },
104
104
  DURATION: {
105
105
  EXPRESS_API: 30,
106
+ CLOUDFRONT_API: 120,
106
107
  LAMBDA_MAXIMUM: 900,
107
108
  LAMBDA_WORKER: 900,
108
109
  },
@@ -1991,7 +1992,7 @@ class JaypieDatadogSecret extends JaypieEnvSecret {
1991
1992
  class JaypieDistribution extends Construct {
1992
1993
  constructor(scope, id, props) {
1993
1994
  super(scope, id);
1994
- const { certificate: certificateProp = true, defaultBehavior: propsDefaultBehavior, destination: destinationProp = true, handler, host: propsHost, invokeMode = lambda.InvokeMode.BUFFERED, roleTag = CDK$2.ROLE.API, zone: propsZone, ...distributionProps } = props;
1995
+ const { certificate: certificateProp = true, defaultBehavior: propsDefaultBehavior, destination: destinationProp = true, handler, host: propsHost, invokeMode = lambda.InvokeMode.BUFFERED, originReadTimeout = Duration.seconds(CDK$2.DURATION.CLOUDFRONT_API), roleTag = CDK$2.ROLE.API, zone: propsZone, ...distributionProps } = props;
1995
1996
  // Validate environment variables
1996
1997
  if (process.env.CDK_ENV_API_SUBDOMAIN &&
1997
1998
  !isValidSubdomain(process.env.CDK_ENV_API_SUBDOMAIN)) {
@@ -2048,10 +2049,14 @@ class JaypieDistribution extends Construct {
2048
2049
  invokeMode: resolvedInvokeMode,
2049
2050
  });
2050
2051
  this.functionUrl = functionUrl;
2051
- origin = new origins.FunctionUrlOrigin(functionUrl);
2052
+ origin = new origins.FunctionUrlOrigin(functionUrl, {
2053
+ readTimeout: originReadTimeout,
2054
+ });
2052
2055
  }
2053
2056
  else if (this.isIFunctionUrl(handler)) {
2054
- origin = new origins.FunctionUrlOrigin(handler);
2057
+ origin = new origins.FunctionUrlOrigin(handler, {
2058
+ readTimeout: originReadTimeout,
2059
+ });
2055
2060
  }
2056
2061
  else if (this.isIOrigin(handler)) {
2057
2062
  origin = handler;