@jaypie/constructs 1.1.53 → 1.1.54

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.
@@ -1,10 +1,14 @@
1
- export { CDK } from "@jaypie/cdk";
1
+ export { CDK } from "./constants";
2
+ export { JaypieAccountLoggingBucket, JaypieAccountLoggingBucketProps, } from "./JaypieAccountLoggingBucket";
2
3
  export { JaypieApiGateway } from "./JaypieApiGateway";
3
4
  export { JaypieAppStack } from "./JaypieAppStack";
4
5
  export { JaypieBucketQueuedLambda } from "./JaypieBucketQueuedLambda";
6
+ export { JaypieDatadogBucket, JaypieDatadogBucketProps, } from "./JaypieDatadogBucket";
7
+ export { JaypieDatadogForwarder, JaypieDatadogForwarderProps, } from "./JaypieDatadogForwarder";
5
8
  export { JaypieDatadogSecret } from "./JaypieDatadogSecret";
6
9
  export { JaypieDnsRecord, JaypieDnsRecordProps } from "./JaypieDnsRecord";
7
10
  export { JaypieEnvSecret } from "./JaypieEnvSecret";
11
+ export { JaypieEventsRule, JaypieEventsRuleProps } from "./JaypieEventsRule";
8
12
  export { JaypieGitHubDeployRole, JaypieGitHubDeployRoleProps, } from "./JaypieGitHubDeployRole";
9
13
  export { JaypieExpressLambda } from "./JaypieExpressLambda";
10
14
  export { JaypieHostedZone, JaypieHostedZoneRecordProps, } from "./JaypieHostedZone";
@@ -12,6 +16,7 @@ export { JaypieInfrastructureStack } from "./JaypieInfrastructureStack";
12
16
  export { JaypieLambda } from "./JaypieLambda";
13
17
  export { JaypieMongoDbSecret } from "./JaypieMongoDbSecret";
14
18
  export { JaypieOpenAiSecret } from "./JaypieOpenAiSecret";
19
+ export { JaypieOrganizationTrail, JaypieOrganizationTrailProps, } from "./JaypieOrganizationTrail";
15
20
  export { AccountAssignments, JaypieSsoPermissions, JaypieSsoPermissionsProps, } from "./JaypieSsoPermissions";
16
21
  export { JaypieSsoSyncApplication, JaypieSsoSyncApplicationProps, } from "./JaypieSsoSyncApplication";
17
22
  export { JaypieQueuedLambda } from "./JaypieQueuedLambda";
@@ -0,0 +1,60 @@
1
+ import { BucketProps, IBucket } from "aws-cdk-lib/aws-s3";
2
+ import { Construct } from "constructs";
3
+ export interface JaypieAccountLoggingBucketProps extends BucketProps {
4
+ /**
5
+ * Optional construct ID
6
+ * @default "AccountLoggingBucket"
7
+ */
8
+ id?: string;
9
+ /**
10
+ * Bucket name
11
+ * @default `account-logging-stack-${PROJECT_NONCE}`
12
+ */
13
+ bucketName?: string;
14
+ /**
15
+ * The service tag value
16
+ * @default CDK.SERVICE.INFRASTRUCTURE
17
+ */
18
+ service?: string;
19
+ /**
20
+ * Optional project tag value
21
+ */
22
+ project?: string;
23
+ /**
24
+ * Number of days before logs expire
25
+ * @default 365
26
+ */
27
+ expirationDays?: number;
28
+ /**
29
+ * Number of days before transitioning to INFREQUENT_ACCESS storage
30
+ * @default 30
31
+ */
32
+ infrequentAccessTransitionDays?: number;
33
+ /**
34
+ * Number of days before transitioning to GLACIER storage
35
+ * @default 180
36
+ */
37
+ glacierTransitionDays?: number;
38
+ /**
39
+ * Whether to create CloudFormation output for bucket name
40
+ * @default true
41
+ */
42
+ createOutput?: boolean;
43
+ /**
44
+ * Custom export name for the bucket name output
45
+ * @default CDK.IMPORT.LOG_BUCKET
46
+ */
47
+ exportName?: string;
48
+ /**
49
+ * Description for the CloudFormation output
50
+ * @default "Account-wide logging bucket"
51
+ */
52
+ outputDescription?: string;
53
+ }
54
+ export declare class JaypieAccountLoggingBucket extends Construct {
55
+ readonly bucket: IBucket;
56
+ /**
57
+ * Create a new account-wide logging S3 bucket with lifecycle policies and export
58
+ */
59
+ constructor(scope: Construct, idOrProps?: string | JaypieAccountLoggingBucketProps, propsOrUndefined?: JaypieAccountLoggingBucketProps);
60
+ }
@@ -0,0 +1,45 @@
1
+ import { Policy } from "aws-cdk-lib/aws-iam";
2
+ import { BucketProps, IBucket } from "aws-cdk-lib/aws-s3";
3
+ import { Construct } from "constructs";
4
+ export interface JaypieDatadogBucketProps extends BucketProps {
5
+ /**
6
+ * Optional construct ID
7
+ * @default "DatadogArchiveBucket"
8
+ */
9
+ id?: string;
10
+ /**
11
+ * The service tag value
12
+ * @default CDK.SERVICE.DATADOG
13
+ */
14
+ service?: string;
15
+ /**
16
+ * Optional project tag value
17
+ */
18
+ project?: string;
19
+ /**
20
+ * Whether to grant Datadog role access to this bucket
21
+ * Uses CDK_ENV_DATADOG_ROLE_ARN if set
22
+ * @default true
23
+ */
24
+ grantDatadogAccess?: boolean;
25
+ }
26
+ export declare class JaypieDatadogBucket extends Construct {
27
+ readonly bucket: IBucket;
28
+ readonly policy?: Policy;
29
+ /**
30
+ * Create a new S3 bucket for Datadog log archiving with automatic IAM permissions
31
+ */
32
+ constructor(scope: Construct, idOrProps?: string | JaypieDatadogBucketProps, propsOrUndefined?: JaypieDatadogBucketProps);
33
+ /**
34
+ * Grants the Datadog IAM role access to this bucket
35
+ *
36
+ * Checks for CDK_ENV_DATADOG_ROLE_ARN environment variable.
37
+ * If found, creates a custom policy with:
38
+ * - s3:ListBucket on bucket
39
+ * - s3:GetObject and s3:PutObject on bucket/*
40
+ *
41
+ * @param options - Configuration options
42
+ * @returns The created Policy, or undefined if CDK_ENV_DATADOG_ROLE_ARN is not set
43
+ */
44
+ private grantDatadogRoleBucketAccess;
45
+ }
@@ -0,0 +1,76 @@
1
+ import { CfnStack } from "aws-cdk-lib";
2
+ import { Rule } from "aws-cdk-lib/aws-events";
3
+ import { IFunction } from "aws-cdk-lib/aws-lambda";
4
+ import { Construct } from "constructs";
5
+ export interface JaypieDatadogForwarderProps {
6
+ /**
7
+ * Optional construct ID
8
+ * @default "DatadogForwarder"
9
+ */
10
+ id?: string;
11
+ /**
12
+ * Datadog API key
13
+ * @default process.env.CDK_ENV_DATADOG_API_KEY
14
+ */
15
+ datadogApiKey?: string;
16
+ /**
17
+ * Account identifier for Datadog tags
18
+ * @default process.env.CDK_ENV_ACCOUNT
19
+ */
20
+ account?: string;
21
+ /**
22
+ * Reserved concurrency for the forwarder Lambda
23
+ * Must be a string as required by the CloudFormation template
24
+ * @default "10"
25
+ */
26
+ reservedConcurrency?: string;
27
+ /**
28
+ * Additional Datadog tags (comma-separated)
29
+ * Will be appended to account tag
30
+ */
31
+ additionalTags?: string;
32
+ /**
33
+ * The service tag value
34
+ * @default CDK.VENDOR.DATADOG
35
+ */
36
+ service?: string;
37
+ /**
38
+ * Optional project tag value
39
+ */
40
+ project?: string;
41
+ /**
42
+ * Whether to create CloudFormation events rule
43
+ * @default true
44
+ */
45
+ enableCloudFormationEvents?: boolean;
46
+ /**
47
+ * Whether to extend Datadog role with custom permissions
48
+ * Uses CDK_ENV_DATADOG_ROLE_ARN if set
49
+ * @default true
50
+ */
51
+ enableRoleExtension?: boolean;
52
+ /**
53
+ * Whether to create CloudFormation output for forwarder ARN
54
+ * @default true
55
+ */
56
+ createOutput?: boolean;
57
+ /**
58
+ * Custom export name for the forwarder ARN output
59
+ * @default CDK.IMPORT.DATADOG_LOG_FORWARDER
60
+ */
61
+ exportName?: string;
62
+ /**
63
+ * URL to Datadog forwarder CloudFormation template
64
+ * @default "https://datadog-cloudformation-template.s3.amazonaws.com/aws/forwarder/latest.yaml"
65
+ */
66
+ templateUrl?: string;
67
+ }
68
+ export declare class JaypieDatadogForwarder extends Construct {
69
+ readonly cfnStack: CfnStack;
70
+ readonly forwarderFunction: IFunction;
71
+ readonly eventsRule?: Rule;
72
+ /**
73
+ * Create a new Datadog forwarder with CloudFormation nested stack
74
+ */
75
+ constructor(scope: Construct, idOrProps?: string | JaypieDatadogForwarderProps, propsOrUndefined?: JaypieDatadogForwarderProps);
76
+ }
@@ -0,0 +1,45 @@
1
+ import { Rule, RuleProps } from "aws-cdk-lib/aws-events";
2
+ import { IFunction } from "aws-cdk-lib/aws-lambda";
3
+ import { Construct } from "constructs";
4
+ export interface JaypieEventsRuleProps extends Omit<RuleProps, "targets"> {
5
+ /**
6
+ * Optional construct ID
7
+ * @default Generated from source or "EventsRule"
8
+ */
9
+ id?: string;
10
+ /**
11
+ * Event source(s) to match
12
+ * @default undefined
13
+ */
14
+ source?: string | string[];
15
+ /**
16
+ * Lambda function to target
17
+ * Can be:
18
+ * - An IFunction instance
19
+ * - undefined (will resolve Datadog forwarder)
20
+ * @default Resolves Datadog forwarder via resolveDatadogForwarderFunction
21
+ */
22
+ targetFunction?: IFunction;
23
+ /**
24
+ * The service tag value
25
+ * @default CDK.SERVICE.DATADOG
26
+ */
27
+ service?: string;
28
+ /**
29
+ * The vendor tag value
30
+ * @default CDK.VENDOR.DATADOG
31
+ */
32
+ vendor?: string;
33
+ /**
34
+ * Optional project tag value
35
+ */
36
+ project?: string;
37
+ }
38
+ export declare class JaypieEventsRule extends Construct {
39
+ readonly rule: Rule;
40
+ readonly targetFunction: IFunction;
41
+ /**
42
+ * Create a new EventBridge rule that targets a Lambda function
43
+ */
44
+ constructor(scope: Construct, idOrSourceOrProps?: string | JaypieEventsRuleProps, propsOrUndefined?: JaypieEventsRuleProps);
45
+ }
@@ -0,0 +1,62 @@
1
+ import { IBucket } from "aws-cdk-lib/aws-s3";
2
+ import { Trail } from "aws-cdk-lib/aws-cloudtrail";
3
+ import { Construct } from "constructs";
4
+ export interface JaypieOrganizationTrailProps {
5
+ /**
6
+ * Optional construct ID
7
+ * @default Generated from trail name
8
+ */
9
+ id?: string;
10
+ /**
11
+ * The name of the CloudTrail trail
12
+ * @default Uses PROJECT_NONCE: `organization-cloudtrail-${PROJECT_NONCE}`
13
+ */
14
+ trailName?: string;
15
+ /**
16
+ * The name of the S3 bucket for CloudTrail logs
17
+ * @default Uses PROJECT_NONCE: `organization-cloudtrail-${PROJECT_NONCE}`
18
+ */
19
+ bucketName?: string;
20
+ /**
21
+ * The service tag value
22
+ * @default CDK.SERVICE.INFRASTRUCTURE
23
+ */
24
+ service?: string;
25
+ /**
26
+ * Optional project tag value
27
+ */
28
+ project?: string;
29
+ /**
30
+ * Whether to enable file validation for the trail
31
+ * @default false
32
+ */
33
+ enableFileValidation?: boolean;
34
+ /**
35
+ * Number of days before logs expire
36
+ * @default 365
37
+ */
38
+ expirationDays?: number;
39
+ /**
40
+ * Number of days before transitioning to INFREQUENT_ACCESS storage
41
+ * @default 30
42
+ */
43
+ infrequentAccessTransitionDays?: number;
44
+ /**
45
+ * Number of days before transitioning to GLACIER storage
46
+ * @default 180
47
+ */
48
+ glacierTransitionDays?: number;
49
+ /**
50
+ * Whether to send S3 notifications to Datadog forwarder
51
+ * @default true
52
+ */
53
+ enableDatadogNotifications?: boolean;
54
+ }
55
+ export declare class JaypieOrganizationTrail extends Construct {
56
+ readonly bucket: IBucket;
57
+ readonly trail: Trail;
58
+ /**
59
+ * Create a new organization CloudTrail with S3 bucket and lifecycle policies
60
+ */
61
+ constructor(scope: Construct, idOrProps?: string | JaypieOrganizationTrailProps, propsOrUndefined?: JaypieOrganizationTrailProps);
62
+ }
@@ -0,0 +1,151 @@
1
+ export declare const CDK: {
2
+ ACCOUNT: {
3
+ DEVELOPMENT: string;
4
+ MANAGEMENT: string;
5
+ OPERATIONS: string;
6
+ PRODUCTION: string;
7
+ SANDBOX: string;
8
+ SECURITY: string;
9
+ STAGE: string;
10
+ };
11
+ BUILD: {
12
+ CONFIG: {
13
+ ALL: string;
14
+ API: string;
15
+ INFRASTRUCTURE: string;
16
+ NONE: string;
17
+ WEB: string;
18
+ };
19
+ PERSONAL: string;
20
+ /**
21
+ * @deprecated rename "ephemeral" to "personal" (since 2/24/2025)
22
+ */
23
+ EPHEMERAL: string;
24
+ /**
25
+ * @deprecated as even "ephemeral" builds have static assets (since 7/6/2024)
26
+ */
27
+ STATIC: string;
28
+ };
29
+ CREATION: {
30
+ CDK: string;
31
+ CLOUDFORMATION_TEMPLATE: string;
32
+ MANUAL: string;
33
+ };
34
+ DATADOG: {
35
+ SITE: string;
36
+ LAYER: {
37
+ NODE: number;
38
+ EXTENSION: number;
39
+ };
40
+ };
41
+ DEFAULT: {
42
+ REGION: string;
43
+ };
44
+ DNS: {
45
+ CONFIG: {
46
+ TTL: number;
47
+ };
48
+ RECORD: {
49
+ A: string;
50
+ CNAME: string;
51
+ MX: string;
52
+ NS: string;
53
+ TXT: string;
54
+ };
55
+ };
56
+ DURATION: {
57
+ EXPRESS_API: number;
58
+ LAMBDA_MAXIMUM: number;
59
+ LAMBDA_WORKER: number;
60
+ };
61
+ ENV: {
62
+ DEMO: string;
63
+ DEVELOPMENT: string;
64
+ /** @deprecated */ EPHEMERAL: string;
65
+ LOCAL: string;
66
+ /** @deprecated */ MAIN: string;
67
+ META: string;
68
+ PERSONAL: string;
69
+ PREVIEW: string;
70
+ PRODUCTION: string;
71
+ RELEASE: string;
72
+ REVIEW: string;
73
+ SANDBOX: string;
74
+ TRAINING: string;
75
+ };
76
+ HOST: {
77
+ APEX: string;
78
+ };
79
+ IMPORT: {
80
+ DATADOG_LOG_FORWARDER: string;
81
+ DATADOG_ROLE: string;
82
+ DATADOG_SECRET: string;
83
+ LOG_BUCKET: string;
84
+ OIDC_PROVIDER: string;
85
+ };
86
+ LAMBDA: {
87
+ LOG_RETENTION: number;
88
+ MEMORY_SIZE: number;
89
+ };
90
+ PRINCIPAL: {
91
+ ROUTE53: string;
92
+ };
93
+ PRINCIPAL_TYPE: {
94
+ GROUP: string;
95
+ USER: string;
96
+ };
97
+ PROJECT: {
98
+ INFRASTRUCTURE: string;
99
+ };
100
+ ROLE: {
101
+ API: string;
102
+ DEPLOY: string;
103
+ HOSTING: string;
104
+ MONITORING: string;
105
+ NETWORKING: string;
106
+ PROCESSING: string;
107
+ SECURITY: string;
108
+ STACK: string;
109
+ STORAGE: string;
110
+ TOY: string;
111
+ };
112
+ SERVICE: {
113
+ DATADOG: string;
114
+ INFRASTRUCTURE: string;
115
+ LIBRARIES: string;
116
+ NONE: string;
117
+ SSO: string;
118
+ TRACE: string;
119
+ };
120
+ TAG: {
121
+ BUILD_DATE: string;
122
+ BUILD_HEX: string;
123
+ BUILD_NUMBER: string;
124
+ BUILD_TIME: string;
125
+ BUILD_TYPE: string;
126
+ COMMIT: string;
127
+ CREATION: string;
128
+ ENV: string;
129
+ NONCE: string;
130
+ PROJECT: string;
131
+ ROLE: string;
132
+ SERVICE: string;
133
+ SPONSOR: string;
134
+ STACK: string;
135
+ STACK_SHA: string;
136
+ VENDOR: string;
137
+ VERSION: string;
138
+ };
139
+ TARGET_TYPE: {
140
+ AWS_ACCOUNT: string;
141
+ };
142
+ VENDOR: {
143
+ ANTHROPIC: string;
144
+ AUTH0: string;
145
+ DATADOG: string;
146
+ KNOWTRACE: string;
147
+ MONGODB: string;
148
+ OPENAI: string;
149
+ SPLINTERLANDS: string;
150
+ };
151
+ };
@@ -0,0 +1,31 @@
1
+ import { Policy } from "aws-cdk-lib/aws-iam";
2
+ import { Construct } from "constructs";
3
+ export interface ExtendDatadogRoleOptions {
4
+ /**
5
+ * Optional construct ID for the policy
6
+ * @default "DatadogCustomPolicy"
7
+ */
8
+ id?: string;
9
+ /**
10
+ * The service tag value
11
+ * @default CDK.SERVICE.DATADOG
12
+ */
13
+ service?: string;
14
+ /**
15
+ * Optional project tag value
16
+ */
17
+ project?: string;
18
+ }
19
+ /**
20
+ * Extends the Datadog IAM role with additional permissions
21
+ *
22
+ * Checks for CDK_ENV_DATADOG_ROLE_ARN environment variable.
23
+ * If found, creates a custom policy with:
24
+ * - budgets:ViewBudget
25
+ * - logs:DescribeLogGroups
26
+ *
27
+ * @param scope - The construct scope
28
+ * @param options - Configuration options
29
+ * @returns The created Policy, or undefined if CDK_ENV_DATADOG_ROLE_ARN is not set
30
+ */
31
+ export declare function extendDatadogRole(scope: Construct, options?: ExtendDatadogRoleOptions): Policy | undefined;
@@ -3,8 +3,12 @@ export { constructEnvName } from "./constructEnvName";
3
3
  export { constructStackName } from "./constructStackName";
4
4
  export { constructTagger } from "./constructTagger";
5
5
  export { envHostname } from "./envHostname";
6
+ export { extendDatadogRole, ExtendDatadogRoleOptions } from "./extendDatadogRole";
6
7
  export { isEnv, isProductionEnv, isSandboxEnv } from "./isEnv";
8
+ export { isValidHostname } from "./isValidHostname";
9
+ export { isValidSubdomain } from "./isValidSubdomain";
7
10
  export { jaypieLambdaEnv } from "./jaypieLambdaEnv";
11
+ export { mergeDomain } from "./mergeDomain";
8
12
  export { resolveDatadogForwarderFunction } from "./resolveDatadogForwarderFunction";
9
13
  export { resolveDatadogLayers } from "./resolveDatadogLayers";
10
14
  export { resolveDatadogLoggingDestination } from "./resolveDatadogLoggingDestination";
@@ -0,0 +1 @@
1
+ export declare function isValidHostname(hostname: string): boolean;
@@ -0,0 +1 @@
1
+ export declare function isValidSubdomain(subdomain: string): boolean;
@@ -0,0 +1 @@
1
+ export declare function mergeDomain(subDomain: string, hostedZone: string): string;
@@ -1,10 +1,14 @@
1
- export { CDK } from "@jaypie/cdk";
1
+ export { CDK } from "./constants";
2
+ export { JaypieAccountLoggingBucket, JaypieAccountLoggingBucketProps, } from "./JaypieAccountLoggingBucket";
2
3
  export { JaypieApiGateway } from "./JaypieApiGateway";
3
4
  export { JaypieAppStack } from "./JaypieAppStack";
4
5
  export { JaypieBucketQueuedLambda } from "./JaypieBucketQueuedLambda";
6
+ export { JaypieDatadogBucket, JaypieDatadogBucketProps, } from "./JaypieDatadogBucket";
7
+ export { JaypieDatadogForwarder, JaypieDatadogForwarderProps, } from "./JaypieDatadogForwarder";
5
8
  export { JaypieDatadogSecret } from "./JaypieDatadogSecret";
6
9
  export { JaypieDnsRecord, JaypieDnsRecordProps } from "./JaypieDnsRecord";
7
10
  export { JaypieEnvSecret } from "./JaypieEnvSecret";
11
+ export { JaypieEventsRule, JaypieEventsRuleProps } from "./JaypieEventsRule";
8
12
  export { JaypieGitHubDeployRole, JaypieGitHubDeployRoleProps, } from "./JaypieGitHubDeployRole";
9
13
  export { JaypieExpressLambda } from "./JaypieExpressLambda";
10
14
  export { JaypieHostedZone, JaypieHostedZoneRecordProps, } from "./JaypieHostedZone";
@@ -12,6 +16,7 @@ export { JaypieInfrastructureStack } from "./JaypieInfrastructureStack";
12
16
  export { JaypieLambda } from "./JaypieLambda";
13
17
  export { JaypieMongoDbSecret } from "./JaypieMongoDbSecret";
14
18
  export { JaypieOpenAiSecret } from "./JaypieOpenAiSecret";
19
+ export { JaypieOrganizationTrail, JaypieOrganizationTrailProps, } from "./JaypieOrganizationTrail";
15
20
  export { AccountAssignments, JaypieSsoPermissions, JaypieSsoPermissionsProps, } from "./JaypieSsoPermissions";
16
21
  export { JaypieSsoSyncApplication, JaypieSsoSyncApplicationProps, } from "./JaypieSsoSyncApplication";
17
22
  export { JaypieQueuedLambda } from "./JaypieQueuedLambda";