@jaypie/constructs 1.2.13 → 1.2.14

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
- export { CDK, LAMBDA_WEB_ADAPTER } from "./constants";
1
+ export { CDK } from "./constants";
2
2
  export { JaypieAccountLoggingBucket, JaypieAccountLoggingBucketProps, } from "./JaypieAccountLoggingBucket";
3
3
  export { JaypieApiGateway, JaypieApiGatewayProps, } from "./JaypieApiGateway";
4
4
  export { JaypieAppStack } from "./JaypieAppStack";
@@ -10,6 +10,7 @@ export { JaypieDatadogSecret } from "./JaypieDatadogSecret";
10
10
  export { JaypieDistribution, JaypieDistributionProps, } from "./JaypieDistribution";
11
11
  export { JaypieDnsRecord, JaypieDnsRecordProps } from "./JaypieDnsRecord";
12
12
  export { JaypieDynamoDb, JaypieDynamoDbProps } from "./JaypieDynamoDb";
13
+ export type { IndexDefinition } from "@jaypie/fabric";
13
14
  export { JaypieEnvSecret } from "./JaypieEnvSecret";
14
15
  export { JaypieEventsRule, JaypieEventsRuleProps } from "./JaypieEventsRule";
15
16
  export { JaypieExpressLambda } from "./JaypieExpressLambda";
@@ -26,7 +27,6 @@ export { AccountAssignments, JaypieSsoPermissions, JaypieSsoPermissionsProps, }
26
27
  export { JaypieSsoSyncApplication, JaypieSsoSyncApplicationProps, } from "./JaypieSsoSyncApplication";
27
28
  export { JaypieStack, JaypieStackProps } from "./JaypieStack";
28
29
  export { JaypieStaticWebBucket, JaypieStaticWebBucketProps, } from "./JaypieStaticWebBucket";
29
- export { JaypieStreamingLambda, JaypieStreamingLambdaProps, } from "./JaypieStreamingLambda";
30
30
  export { JaypieTraceSigningKeySecret } from "./JaypieTraceSigningKeySecret";
31
31
  export { JaypieWebDeploymentBucket } from "./JaypieWebDeploymentBucket";
32
32
  export * from "./helpers";
@@ -62,9 +62,8 @@ export interface JaypieDistributionProps extends Omit<cloudfront.DistributionPro
62
62
  host?: string | HostConfig;
63
63
  /**
64
64
  * Invoke mode for Lambda Function URLs.
65
- * If not provided, auto-detects from handler if it has an invokeMode property
66
- * (e.g., JaypieStreamingLambda).
67
- * @default InvokeMode.BUFFERED (or auto-detected from handler)
65
+ * Use RESPONSE_STREAM for streaming responses with createLambdaStreamHandler.
66
+ * @default InvokeMode.BUFFERED
68
67
  */
69
68
  invokeMode?: lambda.InvokeMode;
70
69
  /**
@@ -1,14 +1,35 @@
1
1
  import { Construct } from "constructs";
2
2
  import { RemovalPolicy } from "aws-cdk-lib";
3
3
  import * as dynamodb from "aws-cdk-lib/aws-dynamodb";
4
+ import { type IndexDefinition } from "@jaypie/fabric";
4
5
  export interface JaypieDynamoDbProps extends Omit<dynamodb.TablePropsV2, "globalSecondaryIndexes" | "partitionKey" | "sortKey"> {
5
6
  /**
6
- * Configure GSIs for the table.
7
- * - `undefined` or `true`: Creates all five Jaypie GSIs (Alias, Class, Scope, Type, Xid)
8
- * - `false`: No GSIs
9
- * - Array: Use the specified GSIs
7
+ * Configure GSIs for the table using @jaypie/fabric IndexDefinition format.
8
+ * - `undefined`: No GSIs (default)
9
+ * - Array of IndexDefinition: Use the specified indexes
10
+ *
11
+ * Use `JaypieDynamoDb.DEFAULT_INDEXES` for the standard Jaypie GSIs.
12
+ *
13
+ * @example
14
+ * // No GSIs (default)
15
+ * new JaypieDynamoDb(this, "myTable");
16
+ *
17
+ * @example
18
+ * // With default Jaypie indexes
19
+ * new JaypieDynamoDb(this, "myTable", {
20
+ * indexes: JaypieDynamoDb.DEFAULT_INDEXES,
21
+ * });
22
+ *
23
+ * @example
24
+ * // With custom indexes
25
+ * new JaypieDynamoDb(this, "myTable", {
26
+ * indexes: [
27
+ * { pk: ["scope", "model"], sk: ["sequence"] },
28
+ * { pk: ["scope", "model", "type"], sk: ["sequence"], sparse: true },
29
+ * ],
30
+ * });
10
31
  */
11
- globalSecondaryIndexes?: boolean | dynamodb.GlobalSecondaryIndexPropsV2[];
32
+ indexes?: IndexDefinition[];
12
33
  /**
13
34
  * Partition key attribute definition.
14
35
  * @default { name: "model", type: AttributeType.STRING }
@@ -44,43 +65,34 @@ export interface JaypieDynamoDbProps extends Omit<dynamodb.TablePropsV2, "global
44
65
  * - Sort key: `id` (String)
45
66
  * - Billing: PAY_PER_REQUEST (on-demand)
46
67
  * - Removal policy: RETAIN in production, DESTROY otherwise
47
- * - Five GSIs for different access patterns (can be overridden)
68
+ * - No GSIs by default (use `indexes` prop to add them)
48
69
  *
49
70
  * @example
50
71
  * // Shorthand: tableName becomes "myApp", construct id is "JaypieDynamoDb-myApp"
51
72
  * const table = new JaypieDynamoDb(this, "myApp");
52
73
  *
53
74
  * @example
54
- * // Full configuration
55
- * const table = new JaypieDynamoDb(this, "MyTable", {
56
- * tableName: "custom-table-name",
57
- * globalSecondaryIndexes: [], // Disable GSIs
75
+ * // With default Jaypie indexes
76
+ * const table = new JaypieDynamoDb(this, "myApp", {
77
+ * indexes: JaypieDynamoDb.DEFAULT_INDEXES,
58
78
  * });
59
79
  *
60
80
  * @example
61
- * // Use only specific GSIs
81
+ * // With custom indexes
62
82
  * const table = new JaypieDynamoDb(this, "MyTable", {
63
- * globalSecondaryIndexes: [
64
- * JaypieDynamoDb.GlobalSecondaryIndex.Scope,
65
- * JaypieDynamoDb.GlobalSecondaryIndex.Type,
83
+ * tableName: "custom-table-name",
84
+ * indexes: [
85
+ * { pk: ["scope", "model"] },
86
+ * { pk: ["scope", "model", "type"], sparse: true },
66
87
  * ],
67
88
  * });
68
89
  */
69
90
  export declare class JaypieDynamoDb extends Construct implements dynamodb.ITableV2 {
70
91
  /**
71
- * Individual GSI definitions for Jaypie single-table design
72
- */
73
- static readonly GlobalSecondaryIndex: {
74
- readonly Alias: dynamodb.GlobalSecondaryIndexPropsV2;
75
- readonly Class: dynamodb.GlobalSecondaryIndexPropsV2;
76
- readonly Scope: dynamodb.GlobalSecondaryIndexPropsV2;
77
- readonly Type: dynamodb.GlobalSecondaryIndexPropsV2;
78
- readonly Xid: dynamodb.GlobalSecondaryIndexPropsV2;
79
- };
80
- /**
81
- * Array of all default Jaypie GSI definitions
92
+ * Default Jaypie GSI definitions from @jaypie/fabric.
93
+ * Pass to `indexes` prop to create all standard GSIs.
82
94
  */
83
- static readonly GlobalSecondaryIndexes: dynamodb.GlobalSecondaryIndexPropsV2[];
95
+ static readonly DEFAULT_INDEXES: any;
84
96
  private readonly _table;
85
97
  constructor(scope: Construct, id: string, props?: JaypieDynamoDbProps);
86
98
  /**
@@ -1,17 +1,3 @@
1
- export declare const LAMBDA_WEB_ADAPTER: {
2
- ACCOUNT: string;
3
- DEFAULT_PORT: number;
4
- EXEC_WRAPPER: string;
5
- INVOKE_MODE: {
6
- BUFFERED: string;
7
- RESPONSE_STREAM: string;
8
- };
9
- LAYER: {
10
- ARM64: string;
11
- X86: string;
12
- };
13
- VERSION: number;
14
- };
15
1
  export declare const CDK: {
16
2
  ACCOUNT: {
17
3
  DEVELOPMENT: string;
@@ -1,4 +1,4 @@
1
- export { CDK, LAMBDA_WEB_ADAPTER } from "./constants";
1
+ export { CDK } from "./constants";
2
2
  export { JaypieAccountLoggingBucket, JaypieAccountLoggingBucketProps, } from "./JaypieAccountLoggingBucket";
3
3
  export { JaypieApiGateway, JaypieApiGatewayProps, } from "./JaypieApiGateway";
4
4
  export { JaypieAppStack } from "./JaypieAppStack";
@@ -10,6 +10,7 @@ export { JaypieDatadogSecret } from "./JaypieDatadogSecret";
10
10
  export { JaypieDistribution, JaypieDistributionProps, } from "./JaypieDistribution";
11
11
  export { JaypieDnsRecord, JaypieDnsRecordProps } from "./JaypieDnsRecord";
12
12
  export { JaypieDynamoDb, JaypieDynamoDbProps } from "./JaypieDynamoDb";
13
+ export type { IndexDefinition } from "@jaypie/fabric";
13
14
  export { JaypieEnvSecret } from "./JaypieEnvSecret";
14
15
  export { JaypieEventsRule, JaypieEventsRuleProps } from "./JaypieEventsRule";
15
16
  export { JaypieExpressLambda } from "./JaypieExpressLambda";
@@ -26,7 +27,6 @@ export { AccountAssignments, JaypieSsoPermissions, JaypieSsoPermissionsProps, }
26
27
  export { JaypieSsoSyncApplication, JaypieSsoSyncApplicationProps, } from "./JaypieSsoSyncApplication";
27
28
  export { JaypieStack, JaypieStackProps } from "./JaypieStack";
28
29
  export { JaypieStaticWebBucket, JaypieStaticWebBucketProps, } from "./JaypieStaticWebBucket";
29
- export { JaypieStreamingLambda, JaypieStreamingLambdaProps, } from "./JaypieStreamingLambda";
30
30
  export { JaypieTraceSigningKeySecret } from "./JaypieTraceSigningKeySecret";
31
31
  export { JaypieWebDeploymentBucket } from "./JaypieWebDeploymentBucket";
32
32
  export * from "./helpers";
package/dist/esm/index.js CHANGED
@@ -25,26 +25,13 @@ import { LambdaFunction } from 'aws-cdk-lib/aws-events-targets';
25
25
  import * as cloudfront from 'aws-cdk-lib/aws-cloudfront';
26
26
  import * as origins from 'aws-cdk-lib/aws-cloudfront-origins';
27
27
  import * as dynamodb from 'aws-cdk-lib/aws-dynamodb';
28
+ import { DEFAULT_INDEXES, generateIndexName, DEFAULT_SORT_KEY } from '@jaypie/fabric';
28
29
  import { Nextjs } from 'cdk-nextjs-standalone';
29
30
  import * as path from 'path';
30
31
  import { Trail, ReadWriteType } from 'aws-cdk-lib/aws-cloudtrail';
31
32
  import { CfnPermissionSet, CfnAssignment } from 'aws-cdk-lib/aws-sso';
32
33
  import { CfnApplication } from 'aws-cdk-lib/aws-sam';
33
34
 
34
- const LAMBDA_WEB_ADAPTER = {
35
- ACCOUNT: "753240598075",
36
- DEFAULT_PORT: 8000,
37
- EXEC_WRAPPER: "/opt/bootstrap",
38
- INVOKE_MODE: {
39
- BUFFERED: "BUFFERED",
40
- RESPONSE_STREAM: "RESPONSE_STREAM",
41
- },
42
- LAYER: {
43
- ARM64: "LambdaAdapterLayerArm64",
44
- X86: "LambdaAdapterLayerX86",
45
- },
46
- VERSION: 25,
47
- };
48
35
  const CDK$2 = {
49
36
  ACCOUNT: {
50
37
  DEVELOPMENT: "development",
@@ -750,7 +737,7 @@ function resolveDatadogLayers(scope, options = {}) {
750
737
  }
751
738
  const layerIdSuffix = uniqueId || process.env.PROJECT_NONCE || Date.now().toString();
752
739
  // Create Datadog Node.js layer
753
- const datadogNodeLayer = lambda.LayerVersion.fromLayerVersionArn(scope, `DatadogNodeLayer-${layerIdSuffix}`, `arn:aws:lambda:${resolvedRegion}:464622532012:layer:Datadog-Node20-x:${CDK$2.DATADOG.LAYER.NODE}`);
740
+ const datadogNodeLayer = lambda.LayerVersion.fromLayerVersionArn(scope, `DatadogNodeLayer-${layerIdSuffix}`, `arn:aws:lambda:${resolvedRegion}:464622532012:layer:Datadog-Node24-x:${CDK$2.DATADOG.LAYER.NODE}`);
754
741
  // Create Datadog Extension layer
755
742
  const datadogExtensionLayer = lambda.LayerVersion.fromLayerVersionArn(scope, `DatadogExtensionLayer-${layerIdSuffix}`, `arn:aws:lambda:${resolvedRegion}:464622532012:layer:Datadog-Extension:${CDK$2.DATADOG.LAYER.EXTENSION}`);
756
743
  return [datadogNodeLayer, datadogExtensionLayer];
@@ -2384,7 +2371,7 @@ class JaypieDistribution extends Construct {
2384
2371
  // IFunction before IFunctionUrl (IFunction doesn't have functionUrlId)
2385
2372
  let origin;
2386
2373
  if (handler) {
2387
- // Auto-detect invoke mode from handler (e.g., JaypieStreamingLambda)
2374
+ // Auto-detect invoke mode from handler if it has an invokeMode property
2388
2375
  // Explicit invokeMode prop takes precedence over auto-detection
2389
2376
  const resolvedInvokeMode = invokeMode !== lambda.InvokeMode.BUFFERED
2390
2377
  ? invokeMode // Explicit non-default value, use it
@@ -2545,7 +2532,7 @@ class JaypieDistribution extends Construct {
2545
2532
  !("url" in handler));
2546
2533
  }
2547
2534
  hasInvokeMode(handler) {
2548
- // Check if handler has an invokeMode property (e.g., JaypieStreamingLambda)
2535
+ // Check if handler has an invokeMode property for streaming support
2549
2536
  return (typeof handler === "object" &&
2550
2537
  handler !== null &&
2551
2538
  "invokeMode" in handler &&
@@ -2683,69 +2670,40 @@ class JaypieDnsRecord extends Construct {
2683
2670
  //
2684
2671
  // Constants
2685
2672
  //
2673
+ /** Composite key separator used in GSI partition keys */
2674
+ const SEPARATOR = "#";
2675
+ //
2676
+ //
2677
+ // Helper Functions
2678
+ //
2686
2679
  /**
2687
- * GSI attribute names used in Jaypie single-table design
2688
- */
2689
- const GSI_NAMES = {
2690
- ALIAS: "indexAlias",
2691
- CLASS: "indexClass",
2692
- SCOPE: "indexScope",
2693
- TYPE: "indexType",
2694
- XID: "indexXid",
2695
- };
2696
- /**
2697
- * Individual GSI definitions for Jaypie single-table design.
2698
- * All GSIs use a string partition key and numeric sort key (sequence).
2699
- */
2700
- const GlobalSecondaryIndex = {
2701
- Alias: {
2702
- indexName: GSI_NAMES.ALIAS,
2703
- partitionKey: {
2704
- name: GSI_NAMES.ALIAS,
2705
- type: dynamodb.AttributeType.STRING,
2706
- },
2707
- projectionType: dynamodb.ProjectionType.ALL,
2708
- sortKey: { name: "sequence", type: dynamodb.AttributeType.NUMBER },
2709
- },
2710
- Class: {
2711
- indexName: GSI_NAMES.CLASS,
2712
- partitionKey: {
2713
- name: GSI_NAMES.CLASS,
2714
- type: dynamodb.AttributeType.STRING,
2715
- },
2716
- projectionType: dynamodb.ProjectionType.ALL,
2717
- sortKey: { name: "sequence", type: dynamodb.AttributeType.NUMBER },
2718
- },
2719
- Scope: {
2720
- indexName: GSI_NAMES.SCOPE,
2721
- partitionKey: { name: GSI_NAMES.SCOPE, type: dynamodb.AttributeType.STRING },
2722
- projectionType: dynamodb.ProjectionType.ALL,
2723
- sortKey: { name: "sequence", type: dynamodb.AttributeType.NUMBER },
2724
- },
2725
- Type: {
2726
- indexName: GSI_NAMES.TYPE,
2727
- partitionKey: { name: GSI_NAMES.TYPE, type: dynamodb.AttributeType.STRING },
2728
- projectionType: dynamodb.ProjectionType.ALL,
2729
- sortKey: { name: "sequence", type: dynamodb.AttributeType.NUMBER },
2730
- },
2731
- Xid: {
2732
- indexName: GSI_NAMES.XID,
2733
- partitionKey: { name: GSI_NAMES.XID, type: dynamodb.AttributeType.STRING },
2734
- projectionType: dynamodb.ProjectionType.ALL,
2735
- sortKey: { name: "sequence", type: dynamodb.AttributeType.NUMBER },
2736
- },
2737
- };
2738
- /**
2739
- * Array of all default Jaypie GSI definitions.
2740
- * Used when no globalSecondaryIndexes are provided.
2680
+ * Convert IndexDefinition[] from @jaypie/fabric to CDK GlobalSecondaryIndexPropsV2[]
2681
+ *
2682
+ * @param indexes - Array of IndexDefinition from @jaypie/fabric
2683
+ * @returns Array of CDK GlobalSecondaryIndexPropsV2
2741
2684
  */
2742
- const GlobalSecondaryIndexes = [
2743
- GlobalSecondaryIndex.Alias,
2744
- GlobalSecondaryIndex.Class,
2745
- GlobalSecondaryIndex.Scope,
2746
- GlobalSecondaryIndex.Type,
2747
- GlobalSecondaryIndex.Xid,
2748
- ];
2685
+ function indexesToGsi(indexes) {
2686
+ return indexes.map((index) => {
2687
+ // Generate index name from pk fields if not provided
2688
+ const indexName = index.name ?? generateIndexName(index.pk);
2689
+ // Sort key defaults to ["sequence"] if not provided
2690
+ const skFields = index.sk ?? DEFAULT_SORT_KEY;
2691
+ return {
2692
+ indexName,
2693
+ partitionKey: {
2694
+ name: indexName,
2695
+ type: dynamodb.AttributeType.STRING,
2696
+ },
2697
+ projectionType: dynamodb.ProjectionType.ALL,
2698
+ sortKey: skFields.length === 1 && skFields[0] === "sequence"
2699
+ ? { name: "sequence", type: dynamodb.AttributeType.NUMBER }
2700
+ : {
2701
+ name: skFields.join(SEPARATOR),
2702
+ type: dynamodb.AttributeType.STRING,
2703
+ },
2704
+ };
2705
+ });
2706
+ }
2749
2707
  //
2750
2708
  //
2751
2709
  // Main
@@ -2758,25 +2716,25 @@ const GlobalSecondaryIndexes = [
2758
2716
  * - Sort key: `id` (String)
2759
2717
  * - Billing: PAY_PER_REQUEST (on-demand)
2760
2718
  * - Removal policy: RETAIN in production, DESTROY otherwise
2761
- * - Five GSIs for different access patterns (can be overridden)
2719
+ * - No GSIs by default (use `indexes` prop to add them)
2762
2720
  *
2763
2721
  * @example
2764
2722
  * // Shorthand: tableName becomes "myApp", construct id is "JaypieDynamoDb-myApp"
2765
2723
  * const table = new JaypieDynamoDb(this, "myApp");
2766
2724
  *
2767
2725
  * @example
2768
- * // Full configuration
2769
- * const table = new JaypieDynamoDb(this, "MyTable", {
2770
- * tableName: "custom-table-name",
2771
- * globalSecondaryIndexes: [], // Disable GSIs
2726
+ * // With default Jaypie indexes
2727
+ * const table = new JaypieDynamoDb(this, "myApp", {
2728
+ * indexes: JaypieDynamoDb.DEFAULT_INDEXES,
2772
2729
  * });
2773
2730
  *
2774
2731
  * @example
2775
- * // Use only specific GSIs
2732
+ * // With custom indexes
2776
2733
  * const table = new JaypieDynamoDb(this, "MyTable", {
2777
- * globalSecondaryIndexes: [
2778
- * JaypieDynamoDb.GlobalSecondaryIndex.Scope,
2779
- * JaypieDynamoDb.GlobalSecondaryIndex.Type,
2734
+ * tableName: "custom-table-name",
2735
+ * indexes: [
2736
+ * { pk: ["scope", "model"] },
2737
+ * { pk: ["scope", "model", "type"], sparse: true },
2780
2738
  * ],
2781
2739
  * });
2782
2740
  */
@@ -2788,18 +2746,14 @@ class JaypieDynamoDb extends Construct {
2788
2746
  const constructId = isShorthand ? `JaypieDynamoDb-${id}` : id;
2789
2747
  const tableName = props.tableName ?? (isShorthand ? id : undefined);
2790
2748
  super(scope, constructId);
2791
- const { billing = dynamodb.Billing.onDemand(), globalSecondaryIndexes: gsiInput, partitionKey = {
2749
+ const { billing = dynamodb.Billing.onDemand(), indexes, partitionKey = {
2792
2750
  name: "model",
2793
2751
  type: dynamodb.AttributeType.STRING,
2794
2752
  }, project, removalPolicy = isProductionEnv()
2795
2753
  ? RemovalPolicy.RETAIN
2796
2754
  : RemovalPolicy.DESTROY, roleTag = CDK$2.ROLE.STORAGE, service, sortKey = { name: "id", type: dynamodb.AttributeType.STRING }, vendorTag, ...restProps } = props;
2797
- // Resolve GSI configuration: undefined/true = all, false = none, array = use as-is
2798
- const globalSecondaryIndexes = gsiInput === false
2799
- ? undefined
2800
- : Array.isArray(gsiInput)
2801
- ? gsiInput
2802
- : GlobalSecondaryIndexes;
2755
+ // Convert IndexDefinition[] to CDK GSI props
2756
+ const globalSecondaryIndexes = indexes ? indexesToGsi(indexes) : undefined;
2803
2757
  this._table = new dynamodb.TableV2(this, "Table", {
2804
2758
  billing,
2805
2759
  globalSecondaryIndexes,
@@ -2912,13 +2866,10 @@ class JaypieDynamoDb extends Construct {
2912
2866
  }
2913
2867
  }
2914
2868
  /**
2915
- * Individual GSI definitions for Jaypie single-table design
2869
+ * Default Jaypie GSI definitions from @jaypie/fabric.
2870
+ * Pass to `indexes` prop to create all standard GSIs.
2916
2871
  */
2917
- JaypieDynamoDb.GlobalSecondaryIndex = GlobalSecondaryIndex;
2918
- /**
2919
- * Array of all default Jaypie GSI definitions
2920
- */
2921
- JaypieDynamoDb.GlobalSecondaryIndexes = GlobalSecondaryIndexes;
2872
+ JaypieDynamoDb.DEFAULT_INDEXES = DEFAULT_INDEXES;
2922
2873
 
2923
2874
  class JaypieEventsRule extends Construct {
2924
2875
  /**
@@ -4134,75 +4085,6 @@ class JaypieStaticWebBucket extends JaypieWebDeploymentBucket {
4134
4085
  }
4135
4086
  }
4136
4087
 
4137
- /**
4138
- * A Lambda construct that uses AWS Lambda Web Adapter for streaming support.
4139
- * This allows running web applications (Express, Fastify, etc.) with streaming responses.
4140
- *
4141
- * @example
4142
- * ```typescript
4143
- * const streamingLambda = new JaypieStreamingLambda(this, "StreamingApi", {
4144
- * code: "dist/api",
4145
- * handler: "run.sh",
4146
- * streaming: true,
4147
- * });
4148
- *
4149
- * // Use with JaypieDistribution
4150
- * new JaypieDistribution(this, "Distribution", {
4151
- * handler: streamingLambda,
4152
- * invokeMode: streamingLambda.invokeMode,
4153
- * });
4154
- * ```
4155
- */
4156
- class JaypieStreamingLambda extends JaypieLambda {
4157
- constructor(scope, id, props) {
4158
- const { architecture = lambda.Architecture.X86_64, environment: propsEnvironment, layers: propsLayers = [], port = LAMBDA_WEB_ADAPTER.DEFAULT_PORT, streaming = false, ...restProps } = props;
4159
- // Determine the Lambda Web Adapter layer ARN based on architecture
4160
- const region = Stack.of(scope).region;
4161
- const layerArn = architecture === lambda.Architecture.ARM_64
4162
- ? `arn:aws:lambda:${region}:${LAMBDA_WEB_ADAPTER.ACCOUNT}:layer:${LAMBDA_WEB_ADAPTER.LAYER.ARM64}:${LAMBDA_WEB_ADAPTER.VERSION}`
4163
- : `arn:aws:lambda:${region}:${LAMBDA_WEB_ADAPTER.ACCOUNT}:layer:${LAMBDA_WEB_ADAPTER.LAYER.X86}:${LAMBDA_WEB_ADAPTER.VERSION}`;
4164
- // Create the Lambda Web Adapter layer
4165
- const webAdapterLayer = lambda.LayerVersion.fromLayerVersionArn(scope, `${id}WebAdapterLayer`, layerArn);
4166
- // Build environment variables with Lambda Web Adapter configuration
4167
- const lwaInvokeMode = streaming
4168
- ? LAMBDA_WEB_ADAPTER.INVOKE_MODE.RESPONSE_STREAM
4169
- : LAMBDA_WEB_ADAPTER.INVOKE_MODE.BUFFERED;
4170
- const webAdapterEnvironment = {
4171
- AWS_LAMBDA_EXEC_WRAPPER: LAMBDA_WEB_ADAPTER.EXEC_WRAPPER,
4172
- AWS_LWA_INVOKE_MODE: lwaInvokeMode,
4173
- PORT: String(port),
4174
- };
4175
- // Merge environment variables - props environment takes precedence
4176
- let mergedEnvironment;
4177
- if (Array.isArray(propsEnvironment)) {
4178
- // Array syntax: prepend our object to the array
4179
- mergedEnvironment = [webAdapterEnvironment, ...propsEnvironment];
4180
- }
4181
- else if (propsEnvironment && typeof propsEnvironment === "object") {
4182
- // Object syntax: merge objects
4183
- mergedEnvironment = {
4184
- ...webAdapterEnvironment,
4185
- ...propsEnvironment,
4186
- };
4187
- }
4188
- else {
4189
- mergedEnvironment = webAdapterEnvironment;
4190
- }
4191
- super(scope, id, {
4192
- architecture,
4193
- environment: mergedEnvironment,
4194
- layers: [webAdapterLayer, ...propsLayers],
4195
- roleTag: CDK$2.ROLE.API,
4196
- timeout: Duration.seconds(CDK$2.DURATION.EXPRESS_API),
4197
- ...restProps,
4198
- });
4199
- // Set invoke mode for use with JaypieDistribution
4200
- this.invokeMode = streaming
4201
- ? lambda.InvokeMode.RESPONSE_STREAM
4202
- : lambda.InvokeMode.BUFFERED;
4203
- }
4204
- }
4205
-
4206
4088
  class JaypieTraceSigningKeySecret extends JaypieEnvSecret {
4207
4089
  constructor(scope, id = "TraceSigningKey", props) {
4208
4090
  const defaultProps = {
@@ -4215,5 +4097,5 @@ class JaypieTraceSigningKeySecret extends JaypieEnvSecret {
4215
4097
  }
4216
4098
  }
4217
4099
 
4218
- export { CDK$2 as CDK, JaypieAccountLoggingBucket, JaypieApiGateway, JaypieAppStack, JaypieBucketQueuedLambda, JaypieCertificate, JaypieDatadogBucket, JaypieDatadogForwarder, JaypieDatadogSecret, JaypieDistribution, JaypieDnsRecord, JaypieDynamoDb, JaypieEnvSecret, JaypieEventsRule, JaypieExpressLambda, JaypieGitHubDeployRole, JaypieHostedZone, JaypieInfrastructureStack, JaypieLambda, JaypieMongoDbSecret, JaypieNextJs, JaypieOpenAiSecret, JaypieOrganizationTrail, JaypieQueuedLambda, JaypieSsoPermissions, JaypieSsoSyncApplication, JaypieStack, JaypieStaticWebBucket, JaypieStreamingLambda, JaypieTraceSigningKeySecret, JaypieWebDeploymentBucket, LAMBDA_WEB_ADAPTER, addDatadogLayers, clearAllCertificateCaches, clearAllSecretsCaches, clearCertificateCache, clearSecretsCache, constructEnvName, constructStackName, constructTagger, envHostname, extendDatadogRole, isEnv, isProductionEnv, isSandboxEnv, isValidHostname$1 as isValidHostname, isValidSubdomain, jaypieLambdaEnv, mergeDomain, resolveCertificate, resolveDatadogForwarderFunction, resolveDatadogLayers, resolveDatadogLoggingDestination, resolveEnvironment, resolveHostedZone, resolveParamsAndSecrets, resolveSecrets };
4100
+ export { CDK$2 as CDK, JaypieAccountLoggingBucket, JaypieApiGateway, JaypieAppStack, JaypieBucketQueuedLambda, JaypieCertificate, JaypieDatadogBucket, JaypieDatadogForwarder, JaypieDatadogSecret, JaypieDistribution, JaypieDnsRecord, JaypieDynamoDb, JaypieEnvSecret, JaypieEventsRule, JaypieExpressLambda, JaypieGitHubDeployRole, JaypieHostedZone, JaypieInfrastructureStack, JaypieLambda, JaypieMongoDbSecret, JaypieNextJs, JaypieOpenAiSecret, JaypieOrganizationTrail, JaypieQueuedLambda, JaypieSsoPermissions, JaypieSsoSyncApplication, JaypieStack, JaypieStaticWebBucket, JaypieTraceSigningKeySecret, JaypieWebDeploymentBucket, addDatadogLayers, clearAllCertificateCaches, clearAllSecretsCaches, clearCertificateCache, clearSecretsCache, constructEnvName, constructStackName, constructTagger, envHostname, extendDatadogRole, isEnv, isProductionEnv, isSandboxEnv, isValidHostname$1 as isValidHostname, isValidSubdomain, jaypieLambdaEnv, mergeDomain, resolveCertificate, resolveDatadogForwarderFunction, resolveDatadogLayers, resolveDatadogLoggingDestination, resolveEnvironment, resolveHostedZone, resolveParamsAndSecrets, resolveSecrets };
4219
4101
  //# sourceMappingURL=index.js.map