@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.
@@ -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;
@@ -19,6 +19,9 @@ var lambdaEventSources = require('aws-cdk-lib/aws-lambda-event-sources');
19
19
  var awsEvents = require('aws-cdk-lib/aws-events');
20
20
  var awsEventsTargets = require('aws-cdk-lib/aws-events-targets');
21
21
  var awsLogs = require('aws-cdk-lib/aws-logs');
22
+ var constructs$1 = require('@jaypie/constructs');
23
+ var cdkNextjsStandalone = require('cdk-nextjs-standalone');
24
+ var path = require('path');
22
25
  var awsCloudtrail = require('aws-cdk-lib/aws-cloudtrail');
23
26
  var awsSso = require('aws-cdk-lib/aws-sso');
24
27
  var awsSam = require('aws-cdk-lib/aws-sam');
@@ -54,6 +57,7 @@ var logDestinations__namespace = /*#__PURE__*/_interopNamespaceDefault(logDestin
54
57
  var s3n__namespace = /*#__PURE__*/_interopNamespaceDefault(s3n);
55
58
  var sqs__namespace = /*#__PURE__*/_interopNamespaceDefault(sqs);
56
59
  var lambdaEventSources__namespace = /*#__PURE__*/_interopNamespaceDefault(lambdaEventSources);
60
+ var path__namespace = /*#__PURE__*/_interopNamespaceDefault(path);
57
61
  var cloudfront__namespace = /*#__PURE__*/_interopNamespaceDefault(cloudfront);
58
62
  var origins__namespace = /*#__PURE__*/_interopNamespaceDefault(origins);
59
63
 
@@ -695,7 +699,7 @@ function resolveHostedZone(scope, { name = "HostedZone", zone = process.env.CDK_
695
699
  return zone;
696
700
  }
697
701
 
698
- const resolveParamsAndSecrets = ({ paramsAndSecrets, options, }) => {
702
+ const resolveParamsAndSecrets = ({ paramsAndSecrets, options, } = {}) => {
699
703
  if (paramsAndSecrets === false) {
700
704
  return;
701
705
  }
@@ -2191,6 +2195,41 @@ class JaypieMongoDbSecret extends JaypieEnvSecret {
2191
2195
  }
2192
2196
  }
2193
2197
 
2198
+ class JaypieNextJs extends constructs.Construct {
2199
+ constructor(scope, id, props) {
2200
+ super(scope, id);
2201
+ const domainName = props?.domainName || constructs$1.envHostname();
2202
+ const nextjsPath = props?.nextjsPath?.startsWith("..")
2203
+ ? path__namespace.join(process.cwd(), props.nextjsPath)
2204
+ : props?.nextjsPath || path__namespace.join(process.cwd(), "..", "nextjs");
2205
+ const paramsAndSecrets = resolveParamsAndSecrets();
2206
+ const nextjs = new cdkNextjsStandalone.Nextjs(this, "NextJsApp", {
2207
+ nextjsPath,
2208
+ domainProps: {
2209
+ domainName,
2210
+ hostedZone: constructs$1.resolveHostedZone(this, {
2211
+ zone: props?.hostedZone,
2212
+ }),
2213
+ },
2214
+ environment: constructs$1.jaypieLambdaEnv(),
2215
+ overrides: {
2216
+ nextjsServer: {
2217
+ functionProps: {
2218
+ paramsAndSecrets,
2219
+ },
2220
+ },
2221
+ nextjsImage: {
2222
+ functionProps: {
2223
+ paramsAndSecrets,
2224
+ },
2225
+ },
2226
+ },
2227
+ });
2228
+ addDatadogLayers(nextjs.imageOptimizationFunction);
2229
+ addDatadogLayers(nextjs.serverFunction.lambdaFunction);
2230
+ }
2231
+ }
2232
+
2194
2233
  class JaypieOpenAiSecret extends JaypieEnvSecret {
2195
2234
  constructor(scope, id = "OpenAiApiKey", props) {
2196
2235
  const defaultProps = {
@@ -2929,6 +2968,7 @@ exports.JaypieHostedZone = JaypieHostedZone;
2929
2968
  exports.JaypieInfrastructureStack = JaypieInfrastructureStack;
2930
2969
  exports.JaypieLambda = JaypieLambda;
2931
2970
  exports.JaypieMongoDbSecret = JaypieMongoDbSecret;
2971
+ exports.JaypieNextJs = JaypieNextJs;
2932
2972
  exports.JaypieOpenAiSecret = JaypieOpenAiSecret;
2933
2973
  exports.JaypieOrganizationTrail = JaypieOrganizationTrail;
2934
2974
  exports.JaypieQueuedLambda = JaypieQueuedLambda;