@jaypie/constructs 1.1.57 → 1.1.58

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.
@@ -15,6 +15,7 @@ export { JaypieHostedZone, JaypieHostedZoneRecordProps, } from "./JaypieHostedZo
15
15
  export { JaypieInfrastructureStack } from "./JaypieInfrastructureStack";
16
16
  export { JaypieLambda } from "./JaypieLambda";
17
17
  export { JaypieMongoDbSecret } from "./JaypieMongoDbSecret";
18
+ export { JaypieNextJs } from "./JaypieNextJs";
18
19
  export { JaypieOpenAiSecret } from "./JaypieOpenAiSecret";
19
20
  export { JaypieOrganizationTrail, JaypieOrganizationTrailProps, } from "./JaypieOrganizationTrail";
20
21
  export { AccountAssignments, JaypieSsoPermissions, JaypieSsoPermissionsProps, } from "./JaypieSsoPermissions";
@@ -0,0 +1,11 @@
1
+ import { IHostedZone } from "aws-cdk-lib/aws-route53";
2
+ import { Construct } from "constructs";
3
+ export interface JaypieNextjsProps {
4
+ domainName?: string;
5
+ datadogApiKeyArn?: string;
6
+ hostedZone?: IHostedZone | string;
7
+ nextjsPath?: string;
8
+ }
9
+ export declare class JaypieNextJs extends Construct {
10
+ constructor(scope: Construct, id: string, props?: JaypieNextjsProps);
11
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -6,7 +6,7 @@ export interface ResolveParamsAndSecretsOptions {
6
6
  parameterStoreTtl?: Duration;
7
7
  secretsManagerTtl?: Duration;
8
8
  }
9
- export declare const resolveParamsAndSecrets: ({ paramsAndSecrets, options, }: {
9
+ export declare const resolveParamsAndSecrets: ({ paramsAndSecrets, options, }?: {
10
10
  paramsAndSecrets?: lambda.ParamsAndSecretsLayerVersion | boolean;
11
11
  options?: ResolveParamsAndSecretsOptions;
12
12
  }) => lambda.ParamsAndSecretsLayerVersion | undefined;
@@ -15,6 +15,7 @@ export { JaypieHostedZone, JaypieHostedZoneRecordProps, } from "./JaypieHostedZo
15
15
  export { JaypieInfrastructureStack } from "./JaypieInfrastructureStack";
16
16
  export { JaypieLambda } from "./JaypieLambda";
17
17
  export { JaypieMongoDbSecret } from "./JaypieMongoDbSecret";
18
+ export { JaypieNextJs } from "./JaypieNextJs";
18
19
  export { JaypieOpenAiSecret } from "./JaypieOpenAiSecret";
19
20
  export { JaypieOrganizationTrail, JaypieOrganizationTrailProps, } from "./JaypieOrganizationTrail";
20
21
  export { AccountAssignments, JaypieSsoPermissions, JaypieSsoPermissionsProps, } from "./JaypieSsoPermissions";
package/dist/esm/index.js CHANGED
@@ -21,6 +21,9 @@ import * as lambdaEventSources from 'aws-cdk-lib/aws-lambda-event-sources';
21
21
  import { Rule, RuleTargetInput } from 'aws-cdk-lib/aws-events';
22
22
  import { LambdaFunction } from 'aws-cdk-lib/aws-events-targets';
23
23
  import { LogGroup, RetentionDays, FilterPattern } from 'aws-cdk-lib/aws-logs';
24
+ import { envHostname as envHostname$1, jaypieLambdaEnv as jaypieLambdaEnv$1, resolveHostedZone as resolveHostedZone$1 } from '@jaypie/constructs';
25
+ import { Nextjs } from 'cdk-nextjs-standalone';
26
+ import * as path from 'path';
24
27
  import { Trail, ReadWriteType } from 'aws-cdk-lib/aws-cloudtrail';
25
28
  import { CfnPermissionSet, CfnAssignment } from 'aws-cdk-lib/aws-sso';
26
29
  import { CfnApplication } from 'aws-cdk-lib/aws-sam';
@@ -665,7 +668,7 @@ function resolveHostedZone(scope, { name = "HostedZone", zone = process.env.CDK_
665
668
  return zone;
666
669
  }
667
670
 
668
- const resolveParamsAndSecrets = ({ paramsAndSecrets, options, }) => {
671
+ const resolveParamsAndSecrets = ({ paramsAndSecrets, options, } = {}) => {
669
672
  if (paramsAndSecrets === false) {
670
673
  return;
671
674
  }
@@ -2161,6 +2164,41 @@ class JaypieMongoDbSecret extends JaypieEnvSecret {
2161
2164
  }
2162
2165
  }
2163
2166
 
2167
+ class JaypieNextJs extends Construct {
2168
+ constructor(scope, id, props) {
2169
+ super(scope, id);
2170
+ const domainName = props?.domainName || envHostname$1();
2171
+ const nextjsPath = props?.nextjsPath?.startsWith("..")
2172
+ ? path.join(process.cwd(), props.nextjsPath)
2173
+ : props?.nextjsPath || path.join(process.cwd(), "..", "nextjs");
2174
+ const paramsAndSecrets = resolveParamsAndSecrets();
2175
+ const nextjs = new Nextjs(this, "NextJsApp", {
2176
+ nextjsPath,
2177
+ domainProps: {
2178
+ domainName,
2179
+ hostedZone: resolveHostedZone$1(this, {
2180
+ zone: props?.hostedZone,
2181
+ }),
2182
+ },
2183
+ environment: jaypieLambdaEnv$1(),
2184
+ overrides: {
2185
+ nextjsServer: {
2186
+ functionProps: {
2187
+ paramsAndSecrets,
2188
+ },
2189
+ },
2190
+ nextjsImage: {
2191
+ functionProps: {
2192
+ paramsAndSecrets,
2193
+ },
2194
+ },
2195
+ },
2196
+ });
2197
+ addDatadogLayers(nextjs.imageOptimizationFunction);
2198
+ addDatadogLayers(nextjs.serverFunction.lambdaFunction);
2199
+ }
2200
+ }
2201
+
2164
2202
  class JaypieOpenAiSecret extends JaypieEnvSecret {
2165
2203
  constructor(scope, id = "OpenAiApiKey", props) {
2166
2204
  const defaultProps = {
@@ -2882,5 +2920,5 @@ class JaypieWebDeploymentBucket extends Construct {
2882
2920
  }
2883
2921
  }
2884
2922
 
2885
- export { CDK$2 as CDK, JaypieAccountLoggingBucket, JaypieApiGateway, JaypieAppStack, JaypieBucketQueuedLambda, JaypieDatadogBucket, JaypieDatadogForwarder, JaypieDatadogSecret, JaypieDnsRecord, JaypieEnvSecret, JaypieEventsRule, JaypieExpressLambda, JaypieGitHubDeployRole, JaypieHostedZone, JaypieInfrastructureStack, JaypieLambda, JaypieMongoDbSecret, JaypieOpenAiSecret, JaypieOrganizationTrail, JaypieQueuedLambda, JaypieSsoPermissions, JaypieSsoSyncApplication, JaypieStack, JaypieTraceSigningKeySecret, JaypieWebDeploymentBucket, addDatadogLayers, constructEnvName, constructStackName, constructTagger, envHostname, extendDatadogRole, isEnv, isProductionEnv, isSandboxEnv, isValidHostname$1 as isValidHostname, isValidSubdomain, jaypieLambdaEnv, mergeDomain, resolveDatadogForwarderFunction, resolveDatadogLayers, resolveDatadogLoggingDestination, resolveHostedZone, resolveParamsAndSecrets };
2923
+ export { CDK$2 as CDK, JaypieAccountLoggingBucket, JaypieApiGateway, JaypieAppStack, JaypieBucketQueuedLambda, JaypieDatadogBucket, JaypieDatadogForwarder, JaypieDatadogSecret, JaypieDnsRecord, JaypieEnvSecret, JaypieEventsRule, JaypieExpressLambda, JaypieGitHubDeployRole, JaypieHostedZone, JaypieInfrastructureStack, JaypieLambda, JaypieMongoDbSecret, JaypieNextJs, JaypieOpenAiSecret, JaypieOrganizationTrail, JaypieQueuedLambda, JaypieSsoPermissions, JaypieSsoSyncApplication, JaypieStack, JaypieTraceSigningKeySecret, JaypieWebDeploymentBucket, addDatadogLayers, constructEnvName, constructStackName, constructTagger, envHostname, extendDatadogRole, isEnv, isProductionEnv, isSandboxEnv, isValidHostname$1 as isValidHostname, isValidSubdomain, jaypieLambdaEnv, mergeDomain, resolveDatadogForwarderFunction, resolveDatadogLayers, resolveDatadogLoggingDestination, resolveHostedZone, resolveParamsAndSecrets };
2886
2924
  //# sourceMappingURL=index.js.map