@jaypie/constructs 1.2.24 → 1.2.26

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.
@@ -26,12 +26,6 @@ export interface JaypieNextjsProps {
26
26
  * This overrides any domainName configuration.
27
27
  */
28
28
  domainProps?: false;
29
- /**
30
- * DynamoDB tables to grant read/write access to the Next.js server function.
31
- * Each table is granted read/write access and if exactly one table is provided,
32
- * the DYNAMODB_TABLE_NAME environment variable is set to the table name.
33
- */
34
- tables?: dynamodb.ITable[];
35
29
  /**
36
30
  * Environment variables for the Next.js application.
37
31
  *
@@ -56,6 +50,17 @@ export interface JaypieNextjsProps {
56
50
  * (reuses existing secrets within the same scope)
57
51
  */
58
52
  secrets?: SecretsArrayItem[];
53
+ /**
54
+ * Enable response streaming for the Next.js server function.
55
+ * When true, enables Lambda response streaming for faster TTFB.
56
+ */
57
+ streaming?: boolean;
58
+ /**
59
+ * DynamoDB tables to grant read/write access to the Next.js server function.
60
+ * Each table is granted read/write access and if exactly one table is provided,
61
+ * the DYNAMODB_TABLE_NAME environment variable is set to the table name.
62
+ */
63
+ tables?: dynamodb.ITable[];
59
64
  }
60
65
  export declare class JaypieNextJs extends Construct {
61
66
  private readonly _nextjs;
@@ -0,0 +1 @@
1
+ export {};
package/dist/esm/index.js CHANGED
@@ -1134,6 +1134,10 @@ class JaypieApiGateway extends Construct {
1134
1134
  process.env.CDK_ENV_API_HOSTED_ZONE) {
1135
1135
  host = mergeDomain(process.env.CDK_ENV_API_SUBDOMAIN, process.env.CDK_ENV_API_HOSTED_ZONE);
1136
1136
  }
1137
+ // Set PROJECT_BASE_URL on the Lambda if host is resolved and handler supports it
1138
+ if (host && "addEnvironment" in handler) {
1139
+ handler.addEnvironment("PROJECT_BASE_URL", `https://${host}`);
1140
+ }
1137
1141
  const apiGatewayName = name || constructEnvName("ApiGateway");
1138
1142
  const apiDomainName = constructEnvName("ApiDomainName");
1139
1143
  let hostedZone;
@@ -2403,6 +2407,10 @@ class JaypieDistribution extends Construct {
2403
2407
  else if (this.isIOrigin(handler)) {
2404
2408
  origin = handler;
2405
2409
  }
2410
+ // Set PROJECT_BASE_URL on the Lambda if host is resolved and handler supports it
2411
+ if (host && this.isIFunction(handler) && "addEnvironment" in handler) {
2412
+ handler.addEnvironment("PROJECT_BASE_URL", `https://${host}`);
2413
+ }
2406
2414
  }
2407
2415
  // Build default behavior
2408
2416
  let defaultBehavior;
@@ -3248,6 +3256,7 @@ class JaypieNextJs extends Construct {
3248
3256
  }),
3249
3257
  },
3250
3258
  }),
3259
+ ...(props?.streaming && { streaming: true }),
3251
3260
  environment: {
3252
3261
  ...jaypieLambdaEnv(),
3253
3262
  ...environment,