@jaypie/constructs 1.2.3 → 1.2.5

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.
@@ -8,6 +8,7 @@ export { JaypieDatadogForwarder, JaypieDatadogForwarderProps, } from "./JaypieDa
8
8
  export { JaypieDistribution, JaypieDistributionProps, } from "./JaypieDistribution";
9
9
  export { JaypieDatadogSecret } from "./JaypieDatadogSecret";
10
10
  export { JaypieDnsRecord, JaypieDnsRecordProps } from "./JaypieDnsRecord";
11
+ export { JaypieDynamoDb, JaypieDynamoDbProps } from "./JaypieDynamoDb";
11
12
  export { JaypieEnvSecret } from "./JaypieEnvSecret";
12
13
  export { JaypieEventsRule, JaypieEventsRuleProps } from "./JaypieEventsRule";
13
14
  export { JaypieGitHubDeployRole, JaypieGitHubDeployRoleProps, } from "./JaypieGitHubDeployRole";
@@ -0,0 +1,115 @@
1
+ import { Construct } from "constructs";
2
+ import { RemovalPolicy } from "aws-cdk-lib";
3
+ import * as dynamodb from "aws-cdk-lib/aws-dynamodb";
4
+ export interface JaypieDynamoDbProps extends Omit<dynamodb.TablePropsV2, "globalSecondaryIndexes" | "partitionKey" | "sortKey"> {
5
+ /**
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
10
+ */
11
+ globalSecondaryIndexes?: boolean | dynamodb.GlobalSecondaryIndexPropsV2[];
12
+ /**
13
+ * Partition key attribute definition.
14
+ * @default { name: "model", type: AttributeType.STRING }
15
+ */
16
+ partitionKey?: dynamodb.Attribute;
17
+ /**
18
+ * Optional project identifier for tagging
19
+ */
20
+ project?: string;
21
+ /**
22
+ * Optional role tag for the table
23
+ */
24
+ roleTag?: string;
25
+ /**
26
+ * Optional service identifier for tagging
27
+ */
28
+ service?: string;
29
+ /**
30
+ * Sort key attribute definition.
31
+ * @default { name: "id", type: AttributeType.STRING }
32
+ */
33
+ sortKey?: dynamodb.Attribute;
34
+ /**
35
+ * Optional vendor tag for the table
36
+ */
37
+ vendorTag?: string;
38
+ }
39
+ /**
40
+ * DynamoDB table with Jaypie single-table design patterns.
41
+ *
42
+ * Creates a table with:
43
+ * - Partition key: `model` (String)
44
+ * - Sort key: `id` (String)
45
+ * - Billing: PAY_PER_REQUEST (on-demand)
46
+ * - Removal policy: RETAIN in production, DESTROY otherwise
47
+ * - Five GSIs for different access patterns (can be overridden)
48
+ *
49
+ * @example
50
+ * // Shorthand: tableName becomes "myApp", construct id is "JaypieDynamoDb-myApp"
51
+ * const table = new JaypieDynamoDb(this, "myApp");
52
+ *
53
+ * @example
54
+ * // Full configuration
55
+ * const table = new JaypieDynamoDb(this, "MyTable", {
56
+ * tableName: "custom-table-name",
57
+ * globalSecondaryIndexes: [], // Disable GSIs
58
+ * });
59
+ *
60
+ * @example
61
+ * // Use only specific GSIs
62
+ * const table = new JaypieDynamoDb(this, "MyTable", {
63
+ * globalSecondaryIndexes: [
64
+ * JaypieDynamoDb.GlobalSecondaryIndex.Ou,
65
+ * JaypieDynamoDb.GlobalSecondaryIndex.Type,
66
+ * ],
67
+ * });
68
+ */
69
+ export declare class JaypieDynamoDb extends Construct implements dynamodb.ITableV2 {
70
+ /**
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
82
+ */
83
+ static readonly GlobalSecondaryIndexes: dynamodb.GlobalSecondaryIndexPropsV2[];
84
+ private readonly _table;
85
+ constructor(scope: Construct, id: string, props?: JaypieDynamoDbProps);
86
+ /**
87
+ * The underlying DynamoDB TableV2 construct
88
+ */
89
+ get table(): dynamodb.TableV2;
90
+ get env(): import("aws-cdk-lib").ResourceEnvironment;
91
+ get stack(): import("aws-cdk-lib").Stack;
92
+ get tableArn(): string;
93
+ get tableId(): string | undefined;
94
+ get tableName(): string;
95
+ get tableStreamArn(): string | undefined;
96
+ get encryptionKey(): import("aws-cdk-lib/aws-kms").IKey | undefined;
97
+ applyRemovalPolicy(policy: RemovalPolicy): void;
98
+ grant(grantee: import("aws-cdk-lib/aws-iam").IGrantable, ...actions: string[]): import("aws-cdk-lib/aws-iam").Grant;
99
+ grantFullAccess(grantee: import("aws-cdk-lib/aws-iam").IGrantable): import("aws-cdk-lib/aws-iam").Grant;
100
+ grantReadData(grantee: import("aws-cdk-lib/aws-iam").IGrantable): import("aws-cdk-lib/aws-iam").Grant;
101
+ grantReadWriteData(grantee: import("aws-cdk-lib/aws-iam").IGrantable): import("aws-cdk-lib/aws-iam").Grant;
102
+ grantStream(grantee: import("aws-cdk-lib/aws-iam").IGrantable, ...actions: string[]): import("aws-cdk-lib/aws-iam").Grant;
103
+ grantStreamRead(grantee: import("aws-cdk-lib/aws-iam").IGrantable): import("aws-cdk-lib/aws-iam").Grant;
104
+ grantTableListStreams(grantee: import("aws-cdk-lib/aws-iam").IGrantable): import("aws-cdk-lib/aws-iam").Grant;
105
+ grantWriteData(grantee: import("aws-cdk-lib/aws-iam").IGrantable): import("aws-cdk-lib/aws-iam").Grant;
106
+ metric(metricName: string, props?: import("aws-cdk-lib/aws-cloudwatch").MetricOptions): import("aws-cdk-lib/aws-cloudwatch").Metric;
107
+ metricConditionalCheckFailedRequests(props?: import("aws-cdk-lib/aws-cloudwatch").MetricOptions): import("aws-cdk-lib/aws-cloudwatch").Metric;
108
+ metricConsumedReadCapacityUnits(props?: import("aws-cdk-lib/aws-cloudwatch").MetricOptions): import("aws-cdk-lib/aws-cloudwatch").Metric;
109
+ metricConsumedWriteCapacityUnits(props?: import("aws-cdk-lib/aws-cloudwatch").MetricOptions): import("aws-cdk-lib/aws-cloudwatch").Metric;
110
+ metricSuccessfulRequestLatency(props?: import("aws-cdk-lib/aws-cloudwatch").MetricOptions): import("aws-cdk-lib/aws-cloudwatch").Metric;
111
+ metricSystemErrorsForOperations(props?: dynamodb.SystemErrorsForOperationsMetricOptions): import("aws-cdk-lib/aws-cloudwatch").IMetric;
112
+ metricThrottledRequests(props?: import("aws-cdk-lib/aws-cloudwatch").MetricOptions): import("aws-cdk-lib/aws-cloudwatch").Metric;
113
+ metricThrottledRequestsForOperations(props?: dynamodb.OperationsMetricOptions): import("aws-cdk-lib/aws-cloudwatch").IMetric;
114
+ metricUserErrors(props?: import("aws-cdk-lib/aws-cloudwatch").MetricOptions): import("aws-cdk-lib/aws-cloudwatch").Metric;
115
+ }
@@ -20,8 +20,10 @@ export interface JaypieLambdaProps {
20
20
  description?: string;
21
21
  /**
22
22
  * DynamoDB tables to grant read/write access to the Lambda function.
23
+ * Each table is granted read/write access and if exactly one table is provided,
24
+ * the CDK_ENV_DYNAMO_TABLE environment variable is set to the table name.
23
25
  */
24
- dynamoTables?: dynamodb.ITable[];
26
+ tables?: dynamodb.ITable[];
25
27
  /**
26
28
  * Environment variables for the Lambda function.
27
29
  *
@@ -22,8 +22,10 @@ export interface JaypieNextjsProps {
22
22
  domainName?: string | DomainNameConfig;
23
23
  /**
24
24
  * DynamoDB tables to grant read/write access to the Next.js server function.
25
+ * Each table is granted read/write access and if exactly one table is provided,
26
+ * the CDK_ENV_DYNAMO_TABLE environment variable is set to the table name.
25
27
  */
26
- dynamoTables?: dynamodb.ITable[];
28
+ tables?: dynamodb.ITable[];
27
29
  /**
28
30
  * Environment variables for the Next.js application.
29
31
  *
@@ -0,0 +1 @@
1
+ export {};
@@ -8,6 +8,7 @@ export { JaypieDatadogForwarder, JaypieDatadogForwarderProps, } from "./JaypieDa
8
8
  export { JaypieDistribution, JaypieDistributionProps, } from "./JaypieDistribution";
9
9
  export { JaypieDatadogSecret } from "./JaypieDatadogSecret";
10
10
  export { JaypieDnsRecord, JaypieDnsRecordProps } from "./JaypieDnsRecord";
11
+ export { JaypieDynamoDb, JaypieDynamoDbProps } from "./JaypieDynamoDb";
11
12
  export { JaypieEnvSecret } from "./JaypieEnvSecret";
12
13
  export { JaypieEventsRule, JaypieEventsRuleProps } from "./JaypieEventsRule";
13
14
  export { JaypieGitHubDeployRole, JaypieGitHubDeployRoleProps, } from "./JaypieGitHubDeployRole";
package/dist/esm/index.js CHANGED
@@ -24,6 +24,7 @@ import { Rule, RuleTargetInput } from 'aws-cdk-lib/aws-events';
24
24
  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
+ import * as dynamodb from 'aws-cdk-lib/aws-dynamodb';
27
28
  import { Nextjs } from 'cdk-nextjs-standalone';
28
29
  import * as path from 'path';
29
30
  import { Trail, ReadWriteType } from 'aws-cdk-lib/aws-cloudtrail';
@@ -363,10 +364,17 @@ function envHostname({ component, domain, env, subdomain, } = {}) {
363
364
  const resolvedSubdomain = providedSubdomain || process.env.CDK_ENV_SUBDOMAIN;
364
365
  const resolvedEnv = env || process.env.PROJECT_ENV;
365
366
  const filteredEnv = resolvedEnv === CDK$2.ENV.PRODUCTION ? undefined : resolvedEnv;
367
+ // Check if parts are already contained in the domain to avoid duplication
368
+ const domainParts = resolvedDomain.split(".");
369
+ const isPartInDomain = (part) => {
370
+ if (!part)
371
+ return false;
372
+ return domainParts.includes(part);
373
+ };
366
374
  const parts = [
367
- resolvedComponent,
368
- resolvedSubdomain,
369
- filteredEnv,
375
+ isPartInDomain(resolvedComponent) ? undefined : resolvedComponent,
376
+ isPartInDomain(resolvedSubdomain) ? undefined : resolvedSubdomain,
377
+ isPartInDomain(filteredEnv) ? undefined : filteredEnv,
370
378
  resolvedDomain,
371
379
  ].filter((part) => part);
372
380
  return parts.join(".");
@@ -1170,7 +1178,7 @@ class JaypieAppStack extends JaypieStack {
1170
1178
  class JaypieLambda extends Construct {
1171
1179
  constructor(scope, id, props) {
1172
1180
  super(scope, id);
1173
- const { allowAllOutbound, allowPublicSubnet, architecture = lambda.Architecture.X86_64, code, datadogApiKeyArn, deadLetterQueue, deadLetterQueueEnabled, deadLetterTopic, description, dynamoTables = [], environment: environmentInput, envSecrets = {}, ephemeralStorageSize, filesystem, handler = "index.handler", initialPolicy, layers = [], logGroup, logRetention = CDK$2.LAMBDA.LOG_RETENTION, maxEventAge, memorySize = CDK$2.LAMBDA.MEMORY_SIZE, paramsAndSecrets, paramsAndSecretsOptions, profiling, profilingGroup, provisionedConcurrentExecutions, reservedConcurrentExecutions, retryAttempts, roleTag = CDK$2.ROLE.PROCESSING, runtime = new lambda.Runtime("nodejs24.x", lambda.RuntimeFamily.NODEJS, {
1181
+ const { allowAllOutbound, allowPublicSubnet, architecture = lambda.Architecture.X86_64, code, datadogApiKeyArn, deadLetterQueue, deadLetterQueueEnabled, deadLetterTopic, description, tables = [], environment: environmentInput, envSecrets = {}, ephemeralStorageSize, filesystem, handler = "index.handler", initialPolicy, layers = [], logGroup, logRetention = CDK$2.LAMBDA.LOG_RETENTION, maxEventAge, memorySize = CDK$2.LAMBDA.MEMORY_SIZE, paramsAndSecrets, paramsAndSecretsOptions, profiling, profilingGroup, provisionedConcurrentExecutions, reservedConcurrentExecutions, retryAttempts, roleTag = CDK$2.ROLE.PROCESSING, runtime = new lambda.Runtime("nodejs24.x", lambda.RuntimeFamily.NODEJS, {
1174
1182
  supportsInlineCode: true,
1175
1183
  }), runtimeManagementMode, secrets: secretsInput = [], securityGroups, timeout = Duration.seconds(CDK$2.DURATION.LAMBDA_WORKER), tracing, vendorTag, vpc, vpcSubnets, } = props;
1176
1184
  // Resolve environment from array or object syntax
@@ -1262,12 +1270,12 @@ class JaypieLambda extends Construct {
1262
1270
  secret.grantRead(this._lambda);
1263
1271
  });
1264
1272
  // Grant read/write permissions for DynamoDB tables
1265
- dynamoTables.forEach((table) => {
1273
+ tables.forEach((table) => {
1266
1274
  table.grantReadWriteData(this._lambda);
1267
1275
  });
1268
1276
  // Add table name to environment if there's exactly one table
1269
- if (dynamoTables.length === 1) {
1270
- this._lambda.addEnvironment("CDK_ENV_DYNAMO_TABLE", dynamoTables[0].tableName);
1277
+ if (tables.length === 1) {
1278
+ this._lambda.addEnvironment("CDK_ENV_DYNAMO_TABLE", tables[0].tableName);
1271
1279
  }
1272
1280
  // Configure provisioned concurrency if specified
1273
1281
  if (provisionedConcurrentExecutions !== undefined) {
@@ -2257,6 +2265,247 @@ class JaypieDnsRecord extends Construct {
2257
2265
  }
2258
2266
  }
2259
2267
 
2268
+ //
2269
+ //
2270
+ // Constants
2271
+ //
2272
+ /**
2273
+ * GSI attribute names used in Jaypie single-table design
2274
+ */
2275
+ const GSI_NAMES = {
2276
+ ALIAS: "indexAlias",
2277
+ CLASS: "indexClass",
2278
+ OU: "indexOu",
2279
+ TYPE: "indexType",
2280
+ XID: "indexXid",
2281
+ };
2282
+ /**
2283
+ * Individual GSI definitions for Jaypie single-table design.
2284
+ * All GSIs use a string partition key and numeric sort key (sequence).
2285
+ */
2286
+ const GlobalSecondaryIndex = {
2287
+ Alias: {
2288
+ indexName: GSI_NAMES.ALIAS,
2289
+ partitionKey: {
2290
+ name: GSI_NAMES.ALIAS,
2291
+ type: dynamodb.AttributeType.STRING,
2292
+ },
2293
+ projectionType: dynamodb.ProjectionType.ALL,
2294
+ sortKey: { name: "sequence", type: dynamodb.AttributeType.NUMBER },
2295
+ },
2296
+ Class: {
2297
+ indexName: GSI_NAMES.CLASS,
2298
+ partitionKey: {
2299
+ name: GSI_NAMES.CLASS,
2300
+ type: dynamodb.AttributeType.STRING,
2301
+ },
2302
+ projectionType: dynamodb.ProjectionType.ALL,
2303
+ sortKey: { name: "sequence", type: dynamodb.AttributeType.NUMBER },
2304
+ },
2305
+ Ou: {
2306
+ indexName: GSI_NAMES.OU,
2307
+ partitionKey: { name: GSI_NAMES.OU, type: dynamodb.AttributeType.STRING },
2308
+ projectionType: dynamodb.ProjectionType.ALL,
2309
+ sortKey: { name: "sequence", type: dynamodb.AttributeType.NUMBER },
2310
+ },
2311
+ Type: {
2312
+ indexName: GSI_NAMES.TYPE,
2313
+ partitionKey: { name: GSI_NAMES.TYPE, type: dynamodb.AttributeType.STRING },
2314
+ projectionType: dynamodb.ProjectionType.ALL,
2315
+ sortKey: { name: "sequence", type: dynamodb.AttributeType.NUMBER },
2316
+ },
2317
+ Xid: {
2318
+ indexName: GSI_NAMES.XID,
2319
+ partitionKey: { name: GSI_NAMES.XID, type: dynamodb.AttributeType.STRING },
2320
+ projectionType: dynamodb.ProjectionType.ALL,
2321
+ sortKey: { name: "sequence", type: dynamodb.AttributeType.NUMBER },
2322
+ },
2323
+ };
2324
+ /**
2325
+ * Array of all default Jaypie GSI definitions.
2326
+ * Used when no globalSecondaryIndexes are provided.
2327
+ */
2328
+ const GlobalSecondaryIndexes = [
2329
+ GlobalSecondaryIndex.Alias,
2330
+ GlobalSecondaryIndex.Class,
2331
+ GlobalSecondaryIndex.Ou,
2332
+ GlobalSecondaryIndex.Type,
2333
+ GlobalSecondaryIndex.Xid,
2334
+ ];
2335
+ //
2336
+ //
2337
+ // Main
2338
+ //
2339
+ /**
2340
+ * DynamoDB table with Jaypie single-table design patterns.
2341
+ *
2342
+ * Creates a table with:
2343
+ * - Partition key: `model` (String)
2344
+ * - Sort key: `id` (String)
2345
+ * - Billing: PAY_PER_REQUEST (on-demand)
2346
+ * - Removal policy: RETAIN in production, DESTROY otherwise
2347
+ * - Five GSIs for different access patterns (can be overridden)
2348
+ *
2349
+ * @example
2350
+ * // Shorthand: tableName becomes "myApp", construct id is "JaypieDynamoDb-myApp"
2351
+ * const table = new JaypieDynamoDb(this, "myApp");
2352
+ *
2353
+ * @example
2354
+ * // Full configuration
2355
+ * const table = new JaypieDynamoDb(this, "MyTable", {
2356
+ * tableName: "custom-table-name",
2357
+ * globalSecondaryIndexes: [], // Disable GSIs
2358
+ * });
2359
+ *
2360
+ * @example
2361
+ * // Use only specific GSIs
2362
+ * const table = new JaypieDynamoDb(this, "MyTable", {
2363
+ * globalSecondaryIndexes: [
2364
+ * JaypieDynamoDb.GlobalSecondaryIndex.Ou,
2365
+ * JaypieDynamoDb.GlobalSecondaryIndex.Type,
2366
+ * ],
2367
+ * });
2368
+ */
2369
+ class JaypieDynamoDb extends Construct {
2370
+ constructor(scope, id, props = {}) {
2371
+ // Determine if this is shorthand usage: new JaypieDynamoDb(this, "myApp")
2372
+ // In shorthand, id becomes the tableName and construct id is prefixed
2373
+ const isShorthand = !props.tableName && !id.includes("-");
2374
+ const constructId = isShorthand ? `JaypieDynamoDb-${id}` : id;
2375
+ const tableName = props.tableName ?? (isShorthand ? id : undefined);
2376
+ super(scope, constructId);
2377
+ const { billing = dynamodb.Billing.onDemand(), globalSecondaryIndexes: gsiInput, partitionKey = {
2378
+ name: "model",
2379
+ type: dynamodb.AttributeType.STRING,
2380
+ }, project, removalPolicy = isProductionEnv()
2381
+ ? RemovalPolicy.RETAIN
2382
+ : RemovalPolicy.DESTROY, roleTag = CDK$2.ROLE.STORAGE, service, sortKey = { name: "id", type: dynamodb.AttributeType.STRING }, vendorTag, ...restProps } = props;
2383
+ // Resolve GSI configuration: undefined/true = all, false = none, array = use as-is
2384
+ const globalSecondaryIndexes = gsiInput === false
2385
+ ? undefined
2386
+ : Array.isArray(gsiInput)
2387
+ ? gsiInput
2388
+ : GlobalSecondaryIndexes;
2389
+ this._table = new dynamodb.TableV2(this, "Table", {
2390
+ billing,
2391
+ globalSecondaryIndexes,
2392
+ partitionKey,
2393
+ removalPolicy,
2394
+ sortKey,
2395
+ tableName,
2396
+ ...restProps,
2397
+ });
2398
+ // Apply tags
2399
+ if (project) {
2400
+ Tags.of(this._table).add(CDK$2.TAG.PROJECT, project);
2401
+ }
2402
+ Tags.of(this._table).add(CDK$2.TAG.ROLE, roleTag);
2403
+ if (service) {
2404
+ Tags.of(this._table).add(CDK$2.TAG.SERVICE, service);
2405
+ }
2406
+ if (vendorTag) {
2407
+ Tags.of(this._table).add(CDK$2.TAG.VENDOR, vendorTag);
2408
+ }
2409
+ }
2410
+ //
2411
+ //
2412
+ // Public accessors
2413
+ //
2414
+ /**
2415
+ * The underlying DynamoDB TableV2 construct
2416
+ */
2417
+ get table() {
2418
+ return this._table;
2419
+ }
2420
+ //
2421
+ //
2422
+ // ITableV2 implementation
2423
+ //
2424
+ get env() {
2425
+ return this._table.env;
2426
+ }
2427
+ get stack() {
2428
+ return this._table.stack;
2429
+ }
2430
+ get tableArn() {
2431
+ return this._table.tableArn;
2432
+ }
2433
+ get tableId() {
2434
+ return this._table.tableId;
2435
+ }
2436
+ get tableName() {
2437
+ return this._table.tableName;
2438
+ }
2439
+ get tableStreamArn() {
2440
+ return this._table.tableStreamArn;
2441
+ }
2442
+ get encryptionKey() {
2443
+ return this._table.encryptionKey;
2444
+ }
2445
+ applyRemovalPolicy(policy) {
2446
+ this._table.applyRemovalPolicy(policy);
2447
+ }
2448
+ grant(grantee, ...actions) {
2449
+ return this._table.grant(grantee, ...actions);
2450
+ }
2451
+ grantFullAccess(grantee) {
2452
+ return this._table.grantFullAccess(grantee);
2453
+ }
2454
+ grantReadData(grantee) {
2455
+ return this._table.grantReadData(grantee);
2456
+ }
2457
+ grantReadWriteData(grantee) {
2458
+ return this._table.grantReadWriteData(grantee);
2459
+ }
2460
+ grantStream(grantee, ...actions) {
2461
+ return this._table.grantStream(grantee, ...actions);
2462
+ }
2463
+ grantStreamRead(grantee) {
2464
+ return this._table.grantStreamRead(grantee);
2465
+ }
2466
+ grantTableListStreams(grantee) {
2467
+ return this._table.grantTableListStreams(grantee);
2468
+ }
2469
+ grantWriteData(grantee) {
2470
+ return this._table.grantWriteData(grantee);
2471
+ }
2472
+ metric(metricName, props) {
2473
+ return this._table.metric(metricName, props);
2474
+ }
2475
+ metricConditionalCheckFailedRequests(props) {
2476
+ return this._table.metricConditionalCheckFailedRequests(props);
2477
+ }
2478
+ metricConsumedReadCapacityUnits(props) {
2479
+ return this._table.metricConsumedReadCapacityUnits(props);
2480
+ }
2481
+ metricConsumedWriteCapacityUnits(props) {
2482
+ return this._table.metricConsumedWriteCapacityUnits(props);
2483
+ }
2484
+ metricSuccessfulRequestLatency(props) {
2485
+ return this._table.metricSuccessfulRequestLatency(props);
2486
+ }
2487
+ metricSystemErrorsForOperations(props) {
2488
+ return this._table.metricSystemErrorsForOperations(props);
2489
+ }
2490
+ metricThrottledRequests(props) {
2491
+ return this._table.metricThrottledRequests(props);
2492
+ }
2493
+ metricThrottledRequestsForOperations(props) {
2494
+ return this._table.metricThrottledRequestsForOperations(props);
2495
+ }
2496
+ metricUserErrors(props) {
2497
+ return this._table.metricUserErrors(props);
2498
+ }
2499
+ }
2500
+ /**
2501
+ * Individual GSI definitions for Jaypie single-table design
2502
+ */
2503
+ JaypieDynamoDb.GlobalSecondaryIndex = GlobalSecondaryIndex;
2504
+ /**
2505
+ * Array of all default Jaypie GSI definitions
2506
+ */
2507
+ JaypieDynamoDb.GlobalSecondaryIndexes = GlobalSecondaryIndexes;
2508
+
2260
2509
  class JaypieEventsRule extends Construct {
2261
2510
  /**
2262
2511
  * Create a new EventBridge rule that targets a Lambda function
@@ -2662,13 +2911,13 @@ class JaypieNextJs extends Construct {
2662
2911
  secret.grantRead(nextjs.serverFunction.lambdaFunction);
2663
2912
  });
2664
2913
  // Grant read/write permissions for DynamoDB tables
2665
- const dynamoTables = props?.dynamoTables || [];
2666
- dynamoTables.forEach((table) => {
2914
+ const tables = props?.tables || [];
2915
+ tables.forEach((table) => {
2667
2916
  table.grantReadWriteData(nextjs.serverFunction.lambdaFunction);
2668
2917
  });
2669
2918
  // Add table name to environment if there's exactly one table
2670
- if (dynamoTables.length === 1) {
2671
- nextjs.serverFunction.lambdaFunction.addEnvironment("CDK_ENV_DYNAMO_TABLE", dynamoTables[0].tableName);
2919
+ if (tables.length === 1) {
2920
+ nextjs.serverFunction.lambdaFunction.addEnvironment("CDK_ENV_DYNAMO_TABLE", tables[0].tableName);
2672
2921
  }
2673
2922
  // Store reference to nextjs for property exposure
2674
2923
  this._nextjs = nextjs;
@@ -3485,5 +3734,5 @@ class JaypieTraceSigningKeySecret extends JaypieEnvSecret {
3485
3734
  }
3486
3735
  }
3487
3736
 
3488
- export { CDK$2 as CDK, JaypieAccountLoggingBucket, JaypieApiGateway, JaypieAppStack, JaypieBucketQueuedLambda, JaypieDatadogBucket, JaypieDatadogForwarder, JaypieDatadogSecret, JaypieDistribution, JaypieDnsRecord, JaypieEnvSecret, JaypieEventsRule, JaypieExpressLambda, JaypieGitHubDeployRole, JaypieHostedZone, JaypieInfrastructureStack, JaypieLambda, JaypieMongoDbSecret, JaypieNextJs, JaypieOpenAiSecret, JaypieOrganizationTrail, JaypieQueuedLambda, JaypieSsoPermissions, JaypieSsoSyncApplication, JaypieStack, JaypieStaticWebBucket, JaypieTraceSigningKeySecret, JaypieWebDeploymentBucket, addDatadogLayers, clearAllSecretsCaches, clearSecretsCache, constructEnvName, constructStackName, constructTagger, envHostname, extendDatadogRole, isEnv, isProductionEnv, isSandboxEnv, isValidHostname$1 as isValidHostname, isValidSubdomain, jaypieLambdaEnv, mergeDomain, resolveDatadogForwarderFunction, resolveDatadogLayers, resolveDatadogLoggingDestination, resolveEnvironment, resolveHostedZone, resolveParamsAndSecrets, resolveSecrets };
3737
+ export { CDK$2 as CDK, JaypieAccountLoggingBucket, JaypieApiGateway, JaypieAppStack, JaypieBucketQueuedLambda, 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, clearAllSecretsCaches, clearSecretsCache, constructEnvName, constructStackName, constructTagger, envHostname, extendDatadogRole, isEnv, isProductionEnv, isSandboxEnv, isValidHostname$1 as isValidHostname, isValidSubdomain, jaypieLambdaEnv, mergeDomain, resolveDatadogForwarderFunction, resolveDatadogLayers, resolveDatadogLoggingDestination, resolveEnvironment, resolveHostedZone, resolveParamsAndSecrets, resolveSecrets };
3489
3738
  //# sourceMappingURL=index.js.map