UNPKG

cdk-nextjs-standalone

Version:

Deploy a NextJS app to AWS using CDK and OpenNext.

60 lines (59 loc) 2.33 kB
import { TableV2 as Table } from 'aws-cdk-lib/aws-dynamodb'; import { Function as LambdaFunction, FunctionOptions } from 'aws-cdk-lib/aws-lambda'; import { Queue, QueueProps } from 'aws-cdk-lib/aws-sqs'; import { Construct } from 'constructs'; import { OptionalCustomResourceProps, OptionalFunctionProps, OptionalProviderProps, OptionalTablePropsV2 } from './generated-structs'; import { NextjsBuild } from './NextjsBuild'; import { NextjsServer } from './NextjsServer'; export interface NextjsRevalidationOverrides { readonly queueProps?: QueueProps; readonly queueFunctionProps?: OptionalFunctionProps; readonly tableProps?: OptionalTablePropsV2; readonly insertFunctionProps?: OptionalFunctionProps; readonly insertProviderProps?: OptionalProviderProps; readonly insertCustomResourceProps?: OptionalCustomResourceProps; } export interface NextjsRevalidationProps { /** * Override function properties. */ readonly lambdaOptions?: FunctionOptions; /** * @see {@link NextjsBuild} */ readonly nextBuild: NextjsBuild; /** * Override props for every construct. */ readonly overrides?: NextjsRevalidationOverrides; /** * @see {@link NextjsServer} */ readonly serverFunction: NextjsServer; } /** * Builds the system for revalidating Next.js resources. This includes a Lambda function handler and queue system as well * as the DynamoDB table and provider function. * * @see {@link https://github.com/serverless-stack/open-next/blob/main/README.md?plain=1#L65} * */ export declare class NextjsRevalidation extends Construct { queue: Queue; table: Table; queueFunction: LambdaFunction; tableFunction: LambdaFunction | undefined; private props; constructor(scope: Construct, id: string, props: NextjsRevalidationProps); private createQueue; private createQueueFunction; private createRevalidationTable; /** * This function will insert the initial batch of tag / path / revalidation data into the DynamoDB table during deployment. * @see: {@link https://open-next.js.org/inner_workings/isr#tags} * * @param revalidationTable table to grant function access to * @returns the revalidation insert provider function */ private createRevalidationInsertFunction; }