@jaypie/constructs 1.2.12 → 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.
@@ -3,9 +3,26 @@ import { RemovalPolicy, Stack } from "aws-cdk-lib";
3
3
  import * as acm from "aws-cdk-lib/aws-certificatemanager";
4
4
  import * as apiGateway from "aws-cdk-lib/aws-apigateway";
5
5
  import * as route53 from "aws-cdk-lib/aws-route53";
6
+ import { HostConfig } from "./helpers";
6
7
  export interface JaypieApiGatewayProps extends apiGateway.LambdaRestApiProps {
7
8
  certificate?: boolean | acm.ICertificate;
8
- host?: string;
9
+ /**
10
+ * The domain name for the API Gateway.
11
+ *
12
+ * Supports both string and config object:
13
+ * - String: used directly as the domain name (e.g., "api.example.com")
14
+ * - Object: passed to envHostname() to construct the domain name
15
+ * - { subdomain, domain, env, component }
16
+ *
17
+ * @example
18
+ * // Direct string
19
+ * host: "api.example.com"
20
+ *
21
+ * @example
22
+ * // Config object - resolves using envHostname()
23
+ * host: { subdomain: "api" }
24
+ */
25
+ host?: string | HostConfig;
9
26
  name?: string;
10
27
  roleTag?: string;
11
28
  zone?: string | route53.IHostedZone;
@@ -6,6 +6,7 @@ import * as route53 from "aws-cdk-lib/aws-route53";
6
6
  import * as s3 from "aws-cdk-lib/aws-s3";
7
7
  import { LambdaDestination } from "aws-cdk-lib/aws-s3-notifications";
8
8
  import { Construct } from "constructs";
9
+ import { HostConfig } from "./helpers";
9
10
  export interface JaypieDistributionProps extends Omit<cloudfront.DistributionProps, "certificate" | "defaultBehavior" | "logBucket"> {
10
11
  /**
11
12
  * SSL certificate for the CloudFront distribution
@@ -41,15 +42,28 @@ export interface JaypieDistributionProps extends Omit<cloudfront.DistributionPro
41
42
  */
42
43
  handler?: cloudfront.IOrigin | lambda.IFunctionUrl | lambda.IFunction;
43
44
  /**
44
- * The domain name for the distribution
45
+ * The domain name for the distribution.
46
+ *
47
+ * Supports both string and config object:
48
+ * - String: used directly as the domain name (e.g., "api.example.com")
49
+ * - Object: passed to envHostname() to construct the domain name
50
+ * - { subdomain, domain, env, component }
51
+ *
45
52
  * @default mergeDomain(CDK_ENV_API_SUBDOMAIN, CDK_ENV_API_HOSTED_ZONE || CDK_ENV_HOSTED_ZONE)
53
+ *
54
+ * @example
55
+ * // Direct string
56
+ * host: "api.example.com"
57
+ *
58
+ * @example
59
+ * // Config object - resolves using envHostname()
60
+ * host: { subdomain: "api" }
46
61
  */
47
- host?: string;
62
+ host?: string | HostConfig;
48
63
  /**
49
64
  * Invoke mode for Lambda Function URLs.
50
- * If not provided, auto-detects from handler if it has an invokeMode property
51
- * (e.g., JaypieStreamingLambda).
52
- * @default InvokeMode.BUFFERED (or auto-detected from handler)
65
+ * Use RESPONSE_STREAM for streaming responses with createLambdaStreamHandler.
66
+ * @default InvokeMode.BUFFERED
53
67
  */
54
68
  invokeMode?: lambda.InvokeMode;
55
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, Ou, 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.Ou,
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 Ou: 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
  /**
@@ -2,13 +2,11 @@ import * as dynamodb from "aws-cdk-lib/aws-dynamodb";
2
2
  import { IHostedZone } from "aws-cdk-lib/aws-route53";
3
3
  import * as secretsmanager from "aws-cdk-lib/aws-secretsmanager";
4
4
  import { Construct } from "constructs";
5
- import { EnvironmentInput, SecretsArrayItem } from "./helpers";
6
- export interface DomainNameConfig {
7
- component?: string;
8
- domain?: string;
9
- env?: string;
10
- subdomain?: string;
11
- }
5
+ import { EnvironmentInput, HostConfig, SecretsArrayItem } from "./helpers";
6
+ /**
7
+ * @deprecated Use HostConfig instead. This alias is kept for backwards compatibility.
8
+ */
9
+ export type DomainNameConfig = HostConfig;
12
10
  export interface JaypieNextjsProps {
13
11
  datadogApiKeyArn?: string;
14
12
  /**
@@ -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,6 +1,11 @@
1
- export declare function envHostname({ component, domain, env, subdomain, }?: {
1
+ /**
2
+ * Configuration for resolving a hostname from parts.
3
+ * Used by envHostname() to construct domain names from environment and config.
4
+ */
5
+ export interface HostConfig {
2
6
  component?: string;
3
7
  domain?: string;
4
8
  env?: string;
5
9
  subdomain?: string;
6
- }): string;
10
+ }
11
+ export declare function envHostname({ component, domain, env, subdomain, }?: HostConfig): string;
@@ -2,7 +2,7 @@ export { addDatadogLayers } from "./addDatadogLayers";
2
2
  export { constructEnvName } from "./constructEnvName";
3
3
  export { constructStackName } from "./constructStackName";
4
4
  export { constructTagger } from "./constructTagger";
5
- export { envHostname } from "./envHostname";
5
+ export { envHostname, HostConfig } from "./envHostname";
6
6
  export { extendDatadogRole, ExtendDatadogRoleOptions, } from "./extendDatadogRole";
7
7
  export { clearAllCertificateCaches, clearCertificateCache, resolveCertificate, ResolveCertificateOptions, } from "./resolveCertificate";
8
8
  export { isEnv, isProductionEnv, isSandboxEnv } from "./isEnv";
@@ -22,6 +22,7 @@ var awsEventsTargets = require('aws-cdk-lib/aws-events-targets');
22
22
  var cloudfront = require('aws-cdk-lib/aws-cloudfront');
23
23
  var origins = require('aws-cdk-lib/aws-cloudfront-origins');
24
24
  var dynamodb = require('aws-cdk-lib/aws-dynamodb');
25
+ var fabric = require('@jaypie/fabric');
25
26
  var cdkNextjsStandalone = require('cdk-nextjs-standalone');
26
27
  var path = require('path');
27
28
  var awsCloudtrail = require('aws-cdk-lib/aws-cloudtrail');
@@ -63,20 +64,6 @@ var origins__namespace = /*#__PURE__*/_interopNamespaceDefault(origins);
63
64
  var dynamodb__namespace = /*#__PURE__*/_interopNamespaceDefault(dynamodb);
64
65
  var path__namespace = /*#__PURE__*/_interopNamespaceDefault(path);
65
66
 
66
- const LAMBDA_WEB_ADAPTER = {
67
- ACCOUNT: "753240598075",
68
- DEFAULT_PORT: 8000,
69
- EXEC_WRAPPER: "/opt/bootstrap",
70
- INVOKE_MODE: {
71
- BUFFERED: "BUFFERED",
72
- RESPONSE_STREAM: "RESPONSE_STREAM",
73
- },
74
- LAYER: {
75
- ARM64: "LambdaAdapterLayerArm64",
76
- X86: "LambdaAdapterLayerX86",
77
- },
78
- VERSION: 25,
79
- };
80
67
  const CDK$2 = {
81
68
  ACCOUNT: {
82
69
  DEVELOPMENT: "development",
@@ -782,7 +769,7 @@ function resolveDatadogLayers(scope, options = {}) {
782
769
  }
783
770
  const layerIdSuffix = uniqueId || process.env.PROJECT_NONCE || Date.now().toString();
784
771
  // Create Datadog Node.js layer
785
- const datadogNodeLayer = lambda__namespace.LayerVersion.fromLayerVersionArn(scope, `DatadogNodeLayer-${layerIdSuffix}`, `arn:aws:lambda:${resolvedRegion}:464622532012:layer:Datadog-Node20-x:${CDK$2.DATADOG.LAYER.NODE}`);
772
+ const datadogNodeLayer = lambda__namespace.LayerVersion.fromLayerVersionArn(scope, `DatadogNodeLayer-${layerIdSuffix}`, `arn:aws:lambda:${resolvedRegion}:464622532012:layer:Datadog-Node24-x:${CDK$2.DATADOG.LAYER.NODE}`);
786
773
  // Create Datadog Extension layer
787
774
  const datadogExtensionLayer = lambda__namespace.LayerVersion.fromLayerVersionArn(scope, `DatadogExtensionLayer-${layerIdSuffix}`, `arn:aws:lambda:${resolvedRegion}:464622532012:layer:Datadog-Extension:${CDK$2.DATADOG.LAYER.EXTENSION}`);
788
775
  return [datadogNodeLayer, datadogExtensionLayer];
@@ -1159,15 +1146,20 @@ class JaypieApiGateway extends constructs.Construct {
1159
1146
  zone = process.env.CDK_ENV_API_HOSTED_ZONE;
1160
1147
  }
1161
1148
  // Determine host from props or environment
1162
- let host = propsHost;
1163
- if (!host) {
1164
- if (process.env.CDK_ENV_API_HOST_NAME) {
1165
- host = process.env.CDK_ENV_API_HOST_NAME;
1166
- }
1167
- else if (process.env.CDK_ENV_API_SUBDOMAIN &&
1168
- process.env.CDK_ENV_API_HOSTED_ZONE) {
1169
- host = mergeDomain(process.env.CDK_ENV_API_SUBDOMAIN, process.env.CDK_ENV_API_HOSTED_ZONE);
1170
- }
1149
+ let host;
1150
+ if (typeof propsHost === "string") {
1151
+ host = propsHost;
1152
+ }
1153
+ else if (typeof propsHost === "object") {
1154
+ // Resolve host from HostConfig using envHostname()
1155
+ host = envHostname(propsHost);
1156
+ }
1157
+ else if (process.env.CDK_ENV_API_HOST_NAME) {
1158
+ host = process.env.CDK_ENV_API_HOST_NAME;
1159
+ }
1160
+ else if (process.env.CDK_ENV_API_SUBDOMAIN &&
1161
+ process.env.CDK_ENV_API_HOSTED_ZONE) {
1162
+ host = mergeDomain(process.env.CDK_ENV_API_SUBDOMAIN, process.env.CDK_ENV_API_HOSTED_ZONE);
1171
1163
  }
1172
1164
  const apiGatewayName = name || constructEnvName("ApiGateway");
1173
1165
  const apiDomainName = constructEnvName("ApiDomainName");
@@ -2372,8 +2364,20 @@ class JaypieDistribution extends constructs.Construct {
2372
2364
  throw new Error("CDK_ENV_HOSTED_ZONE is not a valid hostname");
2373
2365
  }
2374
2366
  // Determine host from props or environment
2375
- let host = propsHost;
2376
- if (!host) {
2367
+ let host;
2368
+ if (typeof propsHost === "string") {
2369
+ host = propsHost;
2370
+ }
2371
+ else if (typeof propsHost === "object") {
2372
+ // Resolve host from HostConfig using envHostname()
2373
+ try {
2374
+ host = envHostname(propsHost);
2375
+ }
2376
+ catch {
2377
+ host = undefined;
2378
+ }
2379
+ }
2380
+ else {
2377
2381
  try {
2378
2382
  if (process.env.CDK_ENV_API_HOST_NAME) {
2379
2383
  host = process.env.CDK_ENV_API_HOST_NAME;
@@ -2399,7 +2403,7 @@ class JaypieDistribution extends constructs.Construct {
2399
2403
  // IFunction before IFunctionUrl (IFunction doesn't have functionUrlId)
2400
2404
  let origin;
2401
2405
  if (handler) {
2402
- // Auto-detect invoke mode from handler (e.g., JaypieStreamingLambda)
2406
+ // Auto-detect invoke mode from handler if it has an invokeMode property
2403
2407
  // Explicit invokeMode prop takes precedence over auto-detection
2404
2408
  const resolvedInvokeMode = invokeMode !== lambda__namespace.InvokeMode.BUFFERED
2405
2409
  ? invokeMode // Explicit non-default value, use it
@@ -2560,7 +2564,7 @@ class JaypieDistribution extends constructs.Construct {
2560
2564
  !("url" in handler));
2561
2565
  }
2562
2566
  hasInvokeMode(handler) {
2563
- // Check if handler has an invokeMode property (e.g., JaypieStreamingLambda)
2567
+ // Check if handler has an invokeMode property for streaming support
2564
2568
  return (typeof handler === "object" &&
2565
2569
  handler !== null &&
2566
2570
  "invokeMode" in handler &&
@@ -2698,69 +2702,40 @@ class JaypieDnsRecord extends constructs.Construct {
2698
2702
  //
2699
2703
  // Constants
2700
2704
  //
2705
+ /** Composite key separator used in GSI partition keys */
2706
+ const SEPARATOR = "#";
2707
+ //
2708
+ //
2709
+ // Helper Functions
2710
+ //
2701
2711
  /**
2702
- * GSI attribute names used in Jaypie single-table design
2703
- */
2704
- const GSI_NAMES = {
2705
- ALIAS: "indexAlias",
2706
- CLASS: "indexClass",
2707
- OU: "indexOu",
2708
- TYPE: "indexType",
2709
- XID: "indexXid",
2710
- };
2711
- /**
2712
- * Individual GSI definitions for Jaypie single-table design.
2713
- * All GSIs use a string partition key and numeric sort key (sequence).
2714
- */
2715
- const GlobalSecondaryIndex = {
2716
- Alias: {
2717
- indexName: GSI_NAMES.ALIAS,
2718
- partitionKey: {
2719
- name: GSI_NAMES.ALIAS,
2720
- type: dynamodb__namespace.AttributeType.STRING,
2721
- },
2722
- projectionType: dynamodb__namespace.ProjectionType.ALL,
2723
- sortKey: { name: "sequence", type: dynamodb__namespace.AttributeType.NUMBER },
2724
- },
2725
- Class: {
2726
- indexName: GSI_NAMES.CLASS,
2727
- partitionKey: {
2728
- name: GSI_NAMES.CLASS,
2729
- type: dynamodb__namespace.AttributeType.STRING,
2730
- },
2731
- projectionType: dynamodb__namespace.ProjectionType.ALL,
2732
- sortKey: { name: "sequence", type: dynamodb__namespace.AttributeType.NUMBER },
2733
- },
2734
- Ou: {
2735
- indexName: GSI_NAMES.OU,
2736
- partitionKey: { name: GSI_NAMES.OU, type: dynamodb__namespace.AttributeType.STRING },
2737
- projectionType: dynamodb__namespace.ProjectionType.ALL,
2738
- sortKey: { name: "sequence", type: dynamodb__namespace.AttributeType.NUMBER },
2739
- },
2740
- Type: {
2741
- indexName: GSI_NAMES.TYPE,
2742
- partitionKey: { name: GSI_NAMES.TYPE, type: dynamodb__namespace.AttributeType.STRING },
2743
- projectionType: dynamodb__namespace.ProjectionType.ALL,
2744
- sortKey: { name: "sequence", type: dynamodb__namespace.AttributeType.NUMBER },
2745
- },
2746
- Xid: {
2747
- indexName: GSI_NAMES.XID,
2748
- partitionKey: { name: GSI_NAMES.XID, type: dynamodb__namespace.AttributeType.STRING },
2749
- projectionType: dynamodb__namespace.ProjectionType.ALL,
2750
- sortKey: { name: "sequence", type: dynamodb__namespace.AttributeType.NUMBER },
2751
- },
2752
- };
2753
- /**
2754
- * Array of all default Jaypie GSI definitions.
2755
- * Used when no globalSecondaryIndexes are provided.
2712
+ * Convert IndexDefinition[] from @jaypie/fabric to CDK GlobalSecondaryIndexPropsV2[]
2713
+ *
2714
+ * @param indexes - Array of IndexDefinition from @jaypie/fabric
2715
+ * @returns Array of CDK GlobalSecondaryIndexPropsV2
2756
2716
  */
2757
- const GlobalSecondaryIndexes = [
2758
- GlobalSecondaryIndex.Alias,
2759
- GlobalSecondaryIndex.Class,
2760
- GlobalSecondaryIndex.Ou,
2761
- GlobalSecondaryIndex.Type,
2762
- GlobalSecondaryIndex.Xid,
2763
- ];
2717
+ function indexesToGsi(indexes) {
2718
+ return indexes.map((index) => {
2719
+ // Generate index name from pk fields if not provided
2720
+ const indexName = index.name ?? fabric.generateIndexName(index.pk);
2721
+ // Sort key defaults to ["sequence"] if not provided
2722
+ const skFields = index.sk ?? fabric.DEFAULT_SORT_KEY;
2723
+ return {
2724
+ indexName,
2725
+ partitionKey: {
2726
+ name: indexName,
2727
+ type: dynamodb__namespace.AttributeType.STRING,
2728
+ },
2729
+ projectionType: dynamodb__namespace.ProjectionType.ALL,
2730
+ sortKey: skFields.length === 1 && skFields[0] === "sequence"
2731
+ ? { name: "sequence", type: dynamodb__namespace.AttributeType.NUMBER }
2732
+ : {
2733
+ name: skFields.join(SEPARATOR),
2734
+ type: dynamodb__namespace.AttributeType.STRING,
2735
+ },
2736
+ };
2737
+ });
2738
+ }
2764
2739
  //
2765
2740
  //
2766
2741
  // Main
@@ -2773,25 +2748,25 @@ const GlobalSecondaryIndexes = [
2773
2748
  * - Sort key: `id` (String)
2774
2749
  * - Billing: PAY_PER_REQUEST (on-demand)
2775
2750
  * - Removal policy: RETAIN in production, DESTROY otherwise
2776
- * - Five GSIs for different access patterns (can be overridden)
2751
+ * - No GSIs by default (use `indexes` prop to add them)
2777
2752
  *
2778
2753
  * @example
2779
2754
  * // Shorthand: tableName becomes "myApp", construct id is "JaypieDynamoDb-myApp"
2780
2755
  * const table = new JaypieDynamoDb(this, "myApp");
2781
2756
  *
2782
2757
  * @example
2783
- * // Full configuration
2784
- * const table = new JaypieDynamoDb(this, "MyTable", {
2785
- * tableName: "custom-table-name",
2786
- * globalSecondaryIndexes: [], // Disable GSIs
2758
+ * // With default Jaypie indexes
2759
+ * const table = new JaypieDynamoDb(this, "myApp", {
2760
+ * indexes: JaypieDynamoDb.DEFAULT_INDEXES,
2787
2761
  * });
2788
2762
  *
2789
2763
  * @example
2790
- * // Use only specific GSIs
2764
+ * // With custom indexes
2791
2765
  * const table = new JaypieDynamoDb(this, "MyTable", {
2792
- * globalSecondaryIndexes: [
2793
- * JaypieDynamoDb.GlobalSecondaryIndex.Ou,
2794
- * JaypieDynamoDb.GlobalSecondaryIndex.Type,
2766
+ * tableName: "custom-table-name",
2767
+ * indexes: [
2768
+ * { pk: ["scope", "model"] },
2769
+ * { pk: ["scope", "model", "type"], sparse: true },
2795
2770
  * ],
2796
2771
  * });
2797
2772
  */
@@ -2803,18 +2778,14 @@ class JaypieDynamoDb extends constructs.Construct {
2803
2778
  const constructId = isShorthand ? `JaypieDynamoDb-${id}` : id;
2804
2779
  const tableName = props.tableName ?? (isShorthand ? id : undefined);
2805
2780
  super(scope, constructId);
2806
- const { billing = dynamodb__namespace.Billing.onDemand(), globalSecondaryIndexes: gsiInput, partitionKey = {
2781
+ const { billing = dynamodb__namespace.Billing.onDemand(), indexes, partitionKey = {
2807
2782
  name: "model",
2808
2783
  type: dynamodb__namespace.AttributeType.STRING,
2809
2784
  }, project, removalPolicy = isProductionEnv()
2810
2785
  ? cdk.RemovalPolicy.RETAIN
2811
2786
  : cdk.RemovalPolicy.DESTROY, roleTag = CDK$2.ROLE.STORAGE, service, sortKey = { name: "id", type: dynamodb__namespace.AttributeType.STRING }, vendorTag, ...restProps } = props;
2812
- // Resolve GSI configuration: undefined/true = all, false = none, array = use as-is
2813
- const globalSecondaryIndexes = gsiInput === false
2814
- ? undefined
2815
- : Array.isArray(gsiInput)
2816
- ? gsiInput
2817
- : GlobalSecondaryIndexes;
2787
+ // Convert IndexDefinition[] to CDK GSI props
2788
+ const globalSecondaryIndexes = indexes ? indexesToGsi(indexes) : undefined;
2818
2789
  this._table = new dynamodb__namespace.TableV2(this, "Table", {
2819
2790
  billing,
2820
2791
  globalSecondaryIndexes,
@@ -2927,13 +2898,10 @@ class JaypieDynamoDb extends constructs.Construct {
2927
2898
  }
2928
2899
  }
2929
2900
  /**
2930
- * Individual GSI definitions for Jaypie single-table design
2901
+ * Default Jaypie GSI definitions from @jaypie/fabric.
2902
+ * Pass to `indexes` prop to create all standard GSIs.
2931
2903
  */
2932
- JaypieDynamoDb.GlobalSecondaryIndex = GlobalSecondaryIndex;
2933
- /**
2934
- * Array of all default Jaypie GSI definitions
2935
- */
2936
- JaypieDynamoDb.GlobalSecondaryIndexes = GlobalSecondaryIndexes;
2904
+ JaypieDynamoDb.DEFAULT_INDEXES = fabric.DEFAULT_INDEXES;
2937
2905
 
2938
2906
  class JaypieEventsRule extends constructs.Construct {
2939
2907
  /**
@@ -4149,75 +4117,6 @@ class JaypieStaticWebBucket extends JaypieWebDeploymentBucket {
4149
4117
  }
4150
4118
  }
4151
4119
 
4152
- /**
4153
- * A Lambda construct that uses AWS Lambda Web Adapter for streaming support.
4154
- * This allows running web applications (Express, Fastify, etc.) with streaming responses.
4155
- *
4156
- * @example
4157
- * ```typescript
4158
- * const streamingLambda = new JaypieStreamingLambda(this, "StreamingApi", {
4159
- * code: "dist/api",
4160
- * handler: "run.sh",
4161
- * streaming: true,
4162
- * });
4163
- *
4164
- * // Use with JaypieDistribution
4165
- * new JaypieDistribution(this, "Distribution", {
4166
- * handler: streamingLambda,
4167
- * invokeMode: streamingLambda.invokeMode,
4168
- * });
4169
- * ```
4170
- */
4171
- class JaypieStreamingLambda extends JaypieLambda {
4172
- constructor(scope, id, props) {
4173
- const { architecture = lambda__namespace.Architecture.X86_64, environment: propsEnvironment, layers: propsLayers = [], port = LAMBDA_WEB_ADAPTER.DEFAULT_PORT, streaming = false, ...restProps } = props;
4174
- // Determine the Lambda Web Adapter layer ARN based on architecture
4175
- const region = cdk.Stack.of(scope).region;
4176
- const layerArn = architecture === lambda__namespace.Architecture.ARM_64
4177
- ? `arn:aws:lambda:${region}:${LAMBDA_WEB_ADAPTER.ACCOUNT}:layer:${LAMBDA_WEB_ADAPTER.LAYER.ARM64}:${LAMBDA_WEB_ADAPTER.VERSION}`
4178
- : `arn:aws:lambda:${region}:${LAMBDA_WEB_ADAPTER.ACCOUNT}:layer:${LAMBDA_WEB_ADAPTER.LAYER.X86}:${LAMBDA_WEB_ADAPTER.VERSION}`;
4179
- // Create the Lambda Web Adapter layer
4180
- const webAdapterLayer = lambda__namespace.LayerVersion.fromLayerVersionArn(scope, `${id}WebAdapterLayer`, layerArn);
4181
- // Build environment variables with Lambda Web Adapter configuration
4182
- const lwaInvokeMode = streaming
4183
- ? LAMBDA_WEB_ADAPTER.INVOKE_MODE.RESPONSE_STREAM
4184
- : LAMBDA_WEB_ADAPTER.INVOKE_MODE.BUFFERED;
4185
- const webAdapterEnvironment = {
4186
- AWS_LAMBDA_EXEC_WRAPPER: LAMBDA_WEB_ADAPTER.EXEC_WRAPPER,
4187
- AWS_LWA_INVOKE_MODE: lwaInvokeMode,
4188
- PORT: String(port),
4189
- };
4190
- // Merge environment variables - props environment takes precedence
4191
- let mergedEnvironment;
4192
- if (Array.isArray(propsEnvironment)) {
4193
- // Array syntax: prepend our object to the array
4194
- mergedEnvironment = [webAdapterEnvironment, ...propsEnvironment];
4195
- }
4196
- else if (propsEnvironment && typeof propsEnvironment === "object") {
4197
- // Object syntax: merge objects
4198
- mergedEnvironment = {
4199
- ...webAdapterEnvironment,
4200
- ...propsEnvironment,
4201
- };
4202
- }
4203
- else {
4204
- mergedEnvironment = webAdapterEnvironment;
4205
- }
4206
- super(scope, id, {
4207
- architecture,
4208
- environment: mergedEnvironment,
4209
- layers: [webAdapterLayer, ...propsLayers],
4210
- roleTag: CDK$2.ROLE.API,
4211
- timeout: cdk.Duration.seconds(CDK$2.DURATION.EXPRESS_API),
4212
- ...restProps,
4213
- });
4214
- // Set invoke mode for use with JaypieDistribution
4215
- this.invokeMode = streaming
4216
- ? lambda__namespace.InvokeMode.RESPONSE_STREAM
4217
- : lambda__namespace.InvokeMode.BUFFERED;
4218
- }
4219
- }
4220
-
4221
4120
  class JaypieTraceSigningKeySecret extends JaypieEnvSecret {
4222
4121
  constructor(scope, id = "TraceSigningKey", props) {
4223
4122
  const defaultProps = {
@@ -4258,10 +4157,8 @@ exports.JaypieSsoPermissions = JaypieSsoPermissions;
4258
4157
  exports.JaypieSsoSyncApplication = JaypieSsoSyncApplication;
4259
4158
  exports.JaypieStack = JaypieStack;
4260
4159
  exports.JaypieStaticWebBucket = JaypieStaticWebBucket;
4261
- exports.JaypieStreamingLambda = JaypieStreamingLambda;
4262
4160
  exports.JaypieTraceSigningKeySecret = JaypieTraceSigningKeySecret;
4263
4161
  exports.JaypieWebDeploymentBucket = JaypieWebDeploymentBucket;
4264
- exports.LAMBDA_WEB_ADAPTER = LAMBDA_WEB_ADAPTER;
4265
4162
  exports.addDatadogLayers = addDatadogLayers;
4266
4163
  exports.clearAllCertificateCaches = clearAllCertificateCaches;
4267
4164
  exports.clearAllSecretsCaches = clearAllSecretsCaches;