@cdklabs/cdk-appmod-catalog-blueprints 1.0.0

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.
Files changed (105) hide show
  1. package/.jsii +8644 -0
  2. package/LICENSE +202 -0
  3. package/README.md +212 -0
  4. package/lib/document-processing/agentic-document-processing.d.ts +16 -0
  5. package/lib/document-processing/agentic-document-processing.js +90 -0
  6. package/lib/document-processing/base-document-processing.d.ts +189 -0
  7. package/lib/document-processing/base-document-processing.js +509 -0
  8. package/lib/document-processing/bedrock-document-processing.d.ts +167 -0
  9. package/lib/document-processing/bedrock-document-processing.js +297 -0
  10. package/lib/document-processing/index.d.ts +3 -0
  11. package/lib/document-processing/index.js +20 -0
  12. package/lib/document-processing/resources/default-bedrock-invoke/index.py +63 -0
  13. package/lib/document-processing/resources/default-bedrock-invoke/requirements.txt +4 -0
  14. package/lib/document-processing/resources/default-doc-retrieval-lambda/index.mjs +92 -0
  15. package/lib/document-processing/resources/default-doc-retrieval-lambda/package.json +10 -0
  16. package/lib/document-processing/resources/default-error-handler/index.js +46 -0
  17. package/lib/document-processing/resources/default-error-handler/package.json +4 -0
  18. package/lib/document-processing/resources/default-image-processor/classifier.mjs +665 -0
  19. package/lib/document-processing/resources/default-image-processor/extractors.mjs +465 -0
  20. package/lib/document-processing/resources/default-image-processor/index.mjs +143 -0
  21. package/lib/document-processing/resources/default-image-processor/package-lock.json +12 -0
  22. package/lib/document-processing/resources/default-image-processor/package.json +4 -0
  23. package/lib/document-processing/resources/default-image-validator/index.mjs +76 -0
  24. package/lib/document-processing/resources/default-image-validator/package-lock.json +154 -0
  25. package/lib/document-processing/resources/default-image-validator/package.json +7 -0
  26. package/lib/document-processing/resources/default-pdf-processor/index.js +46 -0
  27. package/lib/document-processing/resources/default-pdf-validator/index.js +36 -0
  28. package/lib/document-processing/resources/default-sqs-consumer/index.py +111 -0
  29. package/lib/document-processing/resources/default-sqs-consumer/requirements.txt +4 -0
  30. package/lib/document-processing/resources/default-sqs-consumer/sample_payload.json +20 -0
  31. package/lib/document-processing/resources/default-sqs-consumer/sample_payload_multi.json +24 -0
  32. package/lib/document-processing/resources/default-strands-agent/index.py +111 -0
  33. package/lib/document-processing/resources/default-strands-agent/requirements.txt +6 -0
  34. package/lib/document-processing/tests/agentic-document-processing-nag.test.d.ts +1 -0
  35. package/lib/document-processing/tests/agentic-document-processing-nag.test.js +107 -0
  36. package/lib/document-processing/tests/agentic-document-processing.test.d.ts +1 -0
  37. package/lib/document-processing/tests/agentic-document-processing.test.js +125 -0
  38. package/lib/document-processing/tests/bedrock-document-processing-nag.test.d.ts +1 -0
  39. package/lib/document-processing/tests/bedrock-document-processing-nag.test.js +101 -0
  40. package/lib/document-processing/tests/bedrock-document-processing.test.d.ts +1 -0
  41. package/lib/document-processing/tests/bedrock-document-processing.test.js +79 -0
  42. package/lib/framework/custom-resource/default-runtimes.d.ts +21 -0
  43. package/lib/framework/custom-resource/default-runtimes.js +34 -0
  44. package/lib/framework/custom-resource/index.d.ts +1 -0
  45. package/lib/framework/custom-resource/index.js +18 -0
  46. package/lib/framework/foundation/access-log.d.ts +69 -0
  47. package/lib/framework/foundation/access-log.js +121 -0
  48. package/lib/framework/foundation/eventbridge-broker.d.ts +18 -0
  49. package/lib/framework/foundation/eventbridge-broker.js +42 -0
  50. package/lib/framework/foundation/index.d.ts +3 -0
  51. package/lib/framework/foundation/index.js +20 -0
  52. package/lib/framework/foundation/network.d.ts +19 -0
  53. package/lib/framework/foundation/network.js +83 -0
  54. package/lib/framework/index.d.ts +2 -0
  55. package/lib/framework/index.js +19 -0
  56. package/lib/framework/quickstart/base-quickstart.d.ts +30 -0
  57. package/lib/framework/quickstart/base-quickstart.js +30 -0
  58. package/lib/index.d.ts +4 -0
  59. package/lib/index.js +21 -0
  60. package/lib/tsconfig.tsbuildinfo +1 -0
  61. package/lib/utilities/cdk-nag-config.d.ts +42 -0
  62. package/lib/utilities/cdk-nag-config.js +194 -0
  63. package/lib/utilities/data-loader-lambda/index.py +282 -0
  64. package/lib/utilities/data-loader-lambda/requirements.txt +3 -0
  65. package/lib/utilities/data-loader.d.ts +173 -0
  66. package/lib/utilities/data-loader.js +447 -0
  67. package/lib/utilities/index.d.ts +3 -0
  68. package/lib/utilities/index.js +20 -0
  69. package/lib/utilities/lambda-iam-utils.d.ts +145 -0
  70. package/lib/utilities/lambda-iam-utils.js +235 -0
  71. package/lib/utilities/lambda_layers/data-masking/layer-construct.d.ts +42 -0
  72. package/lib/utilities/lambda_layers/data-masking/layer-construct.js +53 -0
  73. package/lib/utilities/lambda_layers/data-masking/layer-construct.ts +88 -0
  74. package/lib/utilities/observability/bedrock-observability.d.ts +18 -0
  75. package/lib/utilities/observability/bedrock-observability.js +131 -0
  76. package/lib/utilities/observability/cloudfront-distribution-observability-property-injector.d.ts +6 -0
  77. package/lib/utilities/observability/cloudfront-distribution-observability-property-injector.js +22 -0
  78. package/lib/utilities/observability/index.d.ts +6 -0
  79. package/lib/utilities/observability/index.js +25 -0
  80. package/lib/utilities/observability/lambda-observability-property-injector.d.ts +8 -0
  81. package/lib/utilities/observability/lambda-observability-property-injector.js +43 -0
  82. package/lib/utilities/observability/log-group-data-protection-props.d.ts +19 -0
  83. package/lib/utilities/observability/log-group-data-protection-props.js +5 -0
  84. package/lib/utilities/observability/observability.d.ts +83 -0
  85. package/lib/utilities/observability/observability.js +278 -0
  86. package/lib/utilities/observability/observable.d.ts +32 -0
  87. package/lib/utilities/observability/observable.js +3 -0
  88. package/lib/utilities/observability/powertools-config.d.ts +3 -0
  89. package/lib/utilities/observability/powertools-config.js +25 -0
  90. package/lib/utilities/observability/resources/bedrock-manage-logging-configuration/index.py +27 -0
  91. package/lib/utilities/observability/state-machine-observability-property-injector.d.ts +8 -0
  92. package/lib/utilities/observability/state-machine-observability-property-injector.js +49 -0
  93. package/lib/utilities/tests/data-loader-nag.test.d.ts +1 -0
  94. package/lib/utilities/tests/data-loader-nag.test.js +432 -0
  95. package/lib/utilities/tests/data-loader.test.d.ts +1 -0
  96. package/lib/utilities/tests/data-loader.test.js +284 -0
  97. package/lib/webapp/frontend-construct.d.ts +136 -0
  98. package/lib/webapp/frontend-construct.js +253 -0
  99. package/lib/webapp/index.d.ts +1 -0
  100. package/lib/webapp/index.js +18 -0
  101. package/lib/webapp/tests/frontend-construct-nag.test.d.ts +1 -0
  102. package/lib/webapp/tests/frontend-construct-nag.test.js +266 -0
  103. package/lib/webapp/tests/frontend-construct.test.d.ts +1 -0
  104. package/lib/webapp/tests/frontend-construct.test.js +385 -0
  105. package/package.json +183 -0
@@ -0,0 +1,173 @@
1
+ import { Duration, RemovalPolicy, CustomResource } from 'aws-cdk-lib';
2
+ import { IVpc, ISecurityGroup } from 'aws-cdk-lib/aws-ec2';
3
+ import { PolicyStatement } from 'aws-cdk-lib/aws-iam';
4
+ import { Function as LambdaFunction } from 'aws-cdk-lib/aws-lambda';
5
+ import { IDatabaseCluster, IDatabaseInstance } from 'aws-cdk-lib/aws-rds';
6
+ import { Bucket } from 'aws-cdk-lib/aws-s3';
7
+ import { BucketDeployment } from 'aws-cdk-lib/aws-s3-deployment';
8
+ import { ISecret } from 'aws-cdk-lib/aws-secretsmanager';
9
+ import { StateMachine } from 'aws-cdk-lib/aws-stepfunctions';
10
+ import { Provider } from 'aws-cdk-lib/custom-resources';
11
+ import { Construct } from 'constructs';
12
+ /**
13
+ * Supported database engines
14
+ */
15
+ export declare enum DatabaseEngine {
16
+ MYSQL = "mysql",
17
+ POSTGRESQL = "postgresql"
18
+ }
19
+ /**
20
+ * Supported file types for data loading
21
+ */
22
+ export declare enum FileType {
23
+ /** Standard SQL file */
24
+ SQL = "sql",
25
+ /** MySQL dump file generated by mysqldump */
26
+ MYSQLDUMP = "mysqldump",
27
+ /** PostgreSQL dump file generated by pg_dump */
28
+ PGDUMP = "pgdump"
29
+ }
30
+ /**
31
+ * Database connection configuration
32
+ */
33
+ export interface DatabaseConfig {
34
+ /** Database engine type */
35
+ readonly engine: DatabaseEngine;
36
+ /** Database cluster (for Aurora) */
37
+ readonly cluster?: IDatabaseCluster;
38
+ /** Database instance (for RDS) */
39
+ readonly instance?: IDatabaseInstance;
40
+ /** Database credentials secret */
41
+ readonly secret: ISecret;
42
+ /** Database name to connect to */
43
+ readonly databaseName: string;
44
+ /** VPC where the database is located */
45
+ readonly vpc: IVpc;
46
+ /** Security group for database access */
47
+ readonly securityGroup: ISecurityGroup;
48
+ }
49
+ /**
50
+ * File input configuration
51
+ */
52
+ export interface FileInput {
53
+ /** Path to the file (local path or S3 URI) */
54
+ readonly filePath: string;
55
+ /** Type of file */
56
+ readonly fileType: FileType;
57
+ /** Execution order (lower numbers execute first) */
58
+ readonly executionOrder?: number;
59
+ /** Whether to continue on error */
60
+ readonly continueOnError?: boolean;
61
+ }
62
+ /**
63
+ * Properties for the DataLoader construct
64
+ */
65
+ export interface DataLoaderProps {
66
+ /** Database configuration */
67
+ readonly databaseConfig: DatabaseConfig;
68
+ /** List of files to load */
69
+ readonly fileInputs: FileInput[];
70
+ /** Optional removal policy for resources (defaults to DESTROY) */
71
+ readonly removalPolicy?: RemovalPolicy;
72
+ /** Optional timeout for Lambda function (defaults to 15 minutes) */
73
+ readonly timeout?: Duration;
74
+ /** Optional memory size for Lambda function (defaults to 1024 MB) */
75
+ readonly memorySize?: number;
76
+ }
77
+ /**
78
+ * DataLoader construct for loading data into Aurora/RDS databases
79
+ *
80
+ * This construct provides a simplified solution for loading data from various file formats
81
+ * (SQL, mysqldump, pg_dump) into MySQL or PostgreSQL databases. It uses S3 for file storage,
82
+ * Step Functions for orchestration, and Lambda for processing.
83
+ *
84
+ * Architecture:
85
+ * 1. Files are uploaded to S3 bucket
86
+ * 2. Step Function is triggered with list of S3 keys
87
+ * 3. Step Function iterates over files in execution order
88
+ * 4. Lambda function processes each file against the database
89
+ *
90
+ * Example usage:
91
+ * Create a DataLoader with database configuration and file inputs.
92
+ * The construct will handle uploading files to S3, creating a Step Function
93
+ * to orchestrate processing, and executing the data loading pipeline.
94
+ */
95
+ export declare class DataLoader extends Construct {
96
+ /** The S3 bucket used for storing files */
97
+ readonly bucket: Bucket;
98
+ /** The Step Functions state machine for orchestration */
99
+ readonly stateMachine: StateMachine;
100
+ /** The Lambda function that processes the data loading */
101
+ readonly processorFunction: LambdaFunction;
102
+ /** The bucket deployment for uploading files */
103
+ bucketDeployment?: BucketDeployment;
104
+ /** The custom resource provider for triggering state machine execution */
105
+ readonly customResourceProvider: Provider;
106
+ /** The custom resource that triggers the state machine */
107
+ readonly executionTrigger: CustomResource;
108
+ /** The file inputs configuration */
109
+ private readonly fileInputs;
110
+ constructor(scope: Construct, id: string, props: DataLoaderProps);
111
+ /**
112
+ * Grants additional IAM permissions to the execution trigger Lambda function
113
+ * @param statement The IAM policy statement to add
114
+ */
115
+ grantExecutionTriggerPermissions(statement: PolicyStatement): void;
116
+ /**
117
+ * Validates the construct properties
118
+ * @param props The DataLoader properties
119
+ * @private
120
+ */
121
+ private _validateProps;
122
+ /**
123
+ * Creates the S3 bucket for storing files
124
+ * @param removalPolicy The removal policy to apply
125
+ * @returns The created S3 bucket
126
+ * @private
127
+ */
128
+ private _createBucket;
129
+ /**
130
+ * Creates the Lambda function for processing data loading
131
+ * @param props The DataLoader properties
132
+ * @returns The created Lambda function
133
+ * @private
134
+ */
135
+ private _createProcessorFunction;
136
+ /**
137
+ * Creates the Step Functions state machine
138
+ * @returns The created state machine
139
+ * @private
140
+ */
141
+ private _createStateMachine;
142
+ /**
143
+ * Grants necessary permissions to the Lambda function
144
+ * @param lambdaFunction The Lambda function
145
+ * @param props The DataLoader properties
146
+ * @private
147
+ */
148
+ private _grantPermissions;
149
+ /**
150
+ * Sets up file processing by uploading files to S3
151
+ * @param props The DataLoader properties
152
+ * @private
153
+ */
154
+ private _setupFileProcessing;
155
+ /**
156
+ * Creates a custom resource provider for triggering state machine execution
157
+ * @returns The custom resource provider
158
+ * @private
159
+ */
160
+ private _createCustomResourceProvider;
161
+ /**
162
+ * Creates a custom resource to trigger state machine execution
163
+ * @returns The custom resource
164
+ * @private
165
+ */
166
+ private _createExecutionTrigger;
167
+ /**
168
+ * Gets the ordered file keys for execution
169
+ * @returns Array of S3 keys in execution order
170
+ * @private
171
+ */
172
+ private _getOrderedFileKeys;
173
+ }