import { TablePropsV2, ITableV2 } from "aws-cdk-lib/aws-dynamodb"; import { BucketProps, IBucket } from "aws-cdk-lib/aws-s3"; import { BucketDeployment, BucketDeploymentProps } from "aws-cdk-lib/aws-s3-deployment"; import { Construct } from "constructs"; export interface NextjsCacheOverrides { readonly cacheBucketProps?: BucketProps; readonly revalidationTableProps?: TablePropsV2; readonly bucketDeploymentProps?: BucketDeploymentProps; } export interface NextjsCacheProps { readonly buildId: string; /** * Bring your own S3 bucket for cache storage. When provided, cdk-nextjs * will skip creating a new bucket. Cache objects are prefixed with `buildId` * so multiple deployments can safely share one bucket. */ readonly cacheBucket?: IBucket; /** * Absolute path to the init cache directory * @example "/Users/john/myapp/.next/cdk-nextjs-init-cache" */ readonly initCacheDir: string; readonly overrides?: NextjsCacheOverrides; /** * Bring your own DynamoDB table for revalidation metadata. When provided, * cdk-nextjs will skip creating a new table. The table must have `pk` (String) * as partition key and `sk` (String) as sort key. Entries are partitioned by * `buildId` so multiple deployments can safely share one table. */ readonly revalidationTable?: ITableV2; } /** * Next.js Cache construct providing unified S3 and DynamoDB cache management. */ export declare class NextjsCache extends Construct { readonly cacheBucket: IBucket; readonly revalidationTable: ITableV2; readonly buildId: string; readonly bucketDeployment?: BucketDeployment; private props; constructor(scope: Construct, id: string, props: NextjsCacheProps); /** * Creates S3 bucket for cache storage with BUILD_ID prefixing. */ private createCacheBucket; /** * Creates DynamoDB table for revalidation metadata * Schema: pk (buildId or "METADATA"), sk (tag#cacheKey or "CURRENT_BUILD"), createdAt, revalidatedAt */ private createRevalidationTable; /** * Deploy pre-built cache files from .next/cdk-nextjs-init-cache to S3 */ private createDeployment; }