@jaypie/constructs 1.1.56 → 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.
@@ -4,9 +4,19 @@ import { Construct } from "constructs";
4
4
  export interface JaypieDatadogBucketProps extends BucketProps {
5
5
  /**
6
6
  * Optional construct ID
7
- * @default "DatadogArchiveBucket"
7
+ * @default "JaypieDatadogBucket"
8
8
  */
9
9
  id?: string;
10
+ /**
11
+ * The scope to use when creating the S3 bucket
12
+ * @default this (the construct itself)
13
+ */
14
+ bucketScope?: Construct;
15
+ /**
16
+ * The ID to use for the S3 bucket construct
17
+ * @default "DatadogArchiveBucket"
18
+ */
19
+ bucketId?: string;
10
20
  /**
11
21
  * The service tag value
12
22
  * @default CDK.SERVICE.DATADOG
@@ -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
  }
@@ -1502,14 +1506,14 @@ class JaypieDatadogBucket extends constructs.Construct {
1502
1506
  else {
1503
1507
  // First param is props
1504
1508
  props = idOrProps || {};
1505
- id = props.id || "DatadogArchiveBucket";
1509
+ id = props.id || "JaypieDatadogBucket";
1506
1510
  }
1507
1511
  super(scope, id);
1508
1512
  // Extract Jaypie-specific options
1509
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1510
- const { grantDatadogAccess = true, id: _id, project, service = CDK$2.SERVICE.DATADOG, ...bucketProps } = props;
1511
- // Create the bucket
1512
- this.bucket = new s3.Bucket(this, "Bucket", bucketProps);
1513
+ const { bucketId = "DatadogArchiveBucket", bucketScope, grantDatadogAccess = true, project, service = CDK$2.SERVICE.DATADOG, ...bucketProps } = props;
1514
+ // Create the bucket using bucketScope (defaults to this) and bucketId
1515
+ const effectiveBucketScope = bucketScope || this;
1516
+ this.bucket = new s3.Bucket(effectiveBucketScope, bucketId, bucketProps);
1513
1517
  // Add tags to bucket
1514
1518
  cdk__namespace.Tags.of(this.bucket).add(CDK$2.TAG.SERVICE, service);
1515
1519
  cdk__namespace.Tags.of(this.bucket).add(CDK$2.TAG.ROLE, CDK$2.ROLE.MONITORING);
@@ -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;