@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.
@@ -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";
@@ -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;
@@ -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
  }
@@ -1472,14 +1475,14 @@ class JaypieDatadogBucket extends Construct {
1472
1475
  else {
1473
1476
  // First param is props
1474
1477
  props = idOrProps || {};
1475
- id = props.id || "DatadogArchiveBucket";
1478
+ id = props.id || "JaypieDatadogBucket";
1476
1479
  }
1477
1480
  super(scope, id);
1478
1481
  // Extract Jaypie-specific options
1479
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1480
- const { grantDatadogAccess = true, id: _id, project, service = CDK$2.SERVICE.DATADOG, ...bucketProps } = props;
1481
- // Create the bucket
1482
- this.bucket = new Bucket(this, "Bucket", bucketProps);
1482
+ const { bucketId = "DatadogArchiveBucket", bucketScope, grantDatadogAccess = true, project, service = CDK$2.SERVICE.DATADOG, ...bucketProps } = props;
1483
+ // Create the bucket using bucketScope (defaults to this) and bucketId
1484
+ const effectiveBucketScope = bucketScope || this;
1485
+ this.bucket = new Bucket(effectiveBucketScope, bucketId, bucketProps);
1483
1486
  // Add tags to bucket
1484
1487
  cdk.Tags.of(this.bucket).add(CDK$2.TAG.SERVICE, service);
1485
1488
  cdk.Tags.of(this.bucket).add(CDK$2.TAG.ROLE, CDK$2.ROLE.MONITORING);
@@ -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