diff --git a/packages/@aws-cdk/alexa-ask/package.json b/packages/@aws-cdk/alexa-ask/package.json index 9f896c9ade492..31d248cda96dd 100644 --- a/packages/@aws-cdk/alexa-ask/package.json +++ b/packages/@aws-cdk/alexa-ask/package.json @@ -86,10 +86,12 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/app-delivery/package.json b/packages/@aws-cdk/app-delivery/package.json index b3e87a18f658d..e4d6f312988cd 100644 --- a/packages/@aws-cdk/app-delivery/package.json +++ b/packages/@aws-cdk/app-delivery/package.json @@ -47,7 +47,8 @@ "@aws-cdk/aws-events": "0.0.0", "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0" + "@aws-cdk/cx-api": "0.0.0", + "constructs": "^1.1.2" }, "devDependencies": { "@aws-cdk/assert": "0.0.0", @@ -83,7 +84,8 @@ "@aws-cdk/aws-events": "0.0.0", "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0" + "@aws-cdk/cx-api": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/assert/package.json b/packages/@aws-cdk/assert/package.json index b36243c58f53a..c0c250c382ca7 100644 --- a/packages/@aws-cdk/assert/package.json +++ b/packages/@aws-cdk/assert/package.json @@ -38,11 +38,13 @@ "dependencies": { "@aws-cdk/cloudformation-diff": "0.0.0", "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0" + "@aws-cdk/cx-api": "0.0.0", + "constructs": "^1.1.2" }, "peerDependencies": { "@aws-cdk/core": "0.0.0", - "jest": "^24.9.0" + "jest": "^24.9.0", + "constructs": "^1.1.2" }, "repository": { "url": "https://github.com/aws/aws-cdk.git", diff --git a/packages/@aws-cdk/assets/package.json b/packages/@aws-cdk/assets/package.json index da80e78103a01..b2f4e928e0816 100644 --- a/packages/@aws-cdk/assets/package.json +++ b/packages/@aws-cdk/assets/package.json @@ -78,12 +78,14 @@ "dependencies": { "@aws-cdk/core": "0.0.0", "@aws-cdk/cx-api": "0.0.0", - "minimatch": "^3.0.4" + "minimatch": "^3.0.4", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0" + "@aws-cdk/cx-api": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-accessanalyzer/package.json b/packages/@aws-cdk/aws-accessanalyzer/package.json index 6e39d21bf6c91..118d363371f14 100644 --- a/packages/@aws-cdk/aws-accessanalyzer/package.json +++ b/packages/@aws-cdk/aws-accessanalyzer/package.json @@ -87,10 +87,12 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-acmpca/package.json b/packages/@aws-cdk/aws-acmpca/package.json index e7922fd4033be..9d62cc5baf39e 100644 --- a/packages/@aws-cdk/aws-acmpca/package.json +++ b/packages/@aws-cdk/aws-acmpca/package.json @@ -87,10 +87,12 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-amazonmq/package.json b/packages/@aws-cdk/aws-amazonmq/package.json index 5c5c2d27053cc..76523cd7f94c6 100644 --- a/packages/@aws-cdk/aws-amazonmq/package.json +++ b/packages/@aws-cdk/aws-amazonmq/package.json @@ -86,10 +86,12 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-amplify/package.json b/packages/@aws-cdk/aws-amplify/package.json index fb5c1781a19be..400d2990e656d 100644 --- a/packages/@aws-cdk/aws-amplify/package.json +++ b/packages/@aws-cdk/aws-amplify/package.json @@ -92,14 +92,16 @@ "@aws-cdk/aws-kms": "0.0.0", "@aws-cdk/aws-codebuild": "0.0.0", "@aws-cdk/aws-secretsmanager": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "peerDependencies": { "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-kms": "0.0.0", "@aws-cdk/aws-codebuild": "0.0.0", "@aws-cdk/aws-secretsmanager": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-apigateway/package.json b/packages/@aws-cdk/aws-apigateway/package.json index d3001166e210f..e5db39b7e8d89 100644 --- a/packages/@aws-cdk/aws-apigateway/package.json +++ b/packages/@aws-cdk/aws-apigateway/package.json @@ -76,7 +76,8 @@ "@aws-cdk/aws-elasticloadbalancingv2": "0.0.0", "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { @@ -85,7 +86,8 @@ "@aws-cdk/aws-elasticloadbalancingv2": "0.0.0", "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-apigatewayv2/package.json b/packages/@aws-cdk/aws-apigatewayv2/package.json index d082ac26d95b7..5e196b97f2640 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/package.json +++ b/packages/@aws-cdk/aws-apigatewayv2/package.json @@ -86,10 +86,12 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-appconfig/package.json b/packages/@aws-cdk/aws-appconfig/package.json index 907a26c5a2e25..5293d117dcdd4 100644 --- a/packages/@aws-cdk/aws-appconfig/package.json +++ b/packages/@aws-cdk/aws-appconfig/package.json @@ -71,10 +71,12 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-applicationautoscaling/package.json b/packages/@aws-cdk/aws-applicationautoscaling/package.json index ce1e8e34639f3..651febd767c93 100644 --- a/packages/@aws-cdk/aws-applicationautoscaling/package.json +++ b/packages/@aws-cdk/aws-applicationautoscaling/package.json @@ -74,14 +74,16 @@ "@aws-cdk/aws-autoscaling-common": "0.0.0", "@aws-cdk/aws-cloudwatch": "0.0.0", "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { "@aws-cdk/aws-autoscaling-common": "0.0.0", "@aws-cdk/aws-cloudwatch": "0.0.0", "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-appmesh/package.json b/packages/@aws-cdk/aws-appmesh/package.json index 396c25a26b4ed..d02f4bdcef4a3 100644 --- a/packages/@aws-cdk/aws-appmesh/package.json +++ b/packages/@aws-cdk/aws-appmesh/package.json @@ -76,13 +76,15 @@ "@aws-cdk/aws-ec2": "0.0.0", "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-servicediscovery": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "peerDependencies": { "@aws-cdk/aws-ec2": "0.0.0", "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-servicediscovery": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-appstream/package.json b/packages/@aws-cdk/aws-appstream/package.json index 86ad4b8d49b3f..f8c19c39325fa 100644 --- a/packages/@aws-cdk/aws-appstream/package.json +++ b/packages/@aws-cdk/aws-appstream/package.json @@ -86,10 +86,12 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-appsync/package.json b/packages/@aws-cdk/aws-appsync/package.json index 2c5bcc03ce5f0..35be872b4661c 100644 --- a/packages/@aws-cdk/aws-appsync/package.json +++ b/packages/@aws-cdk/aws-appsync/package.json @@ -90,7 +90,8 @@ "@aws-cdk/aws-dynamodb": "0.0.0", "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { @@ -98,7 +99,8 @@ "@aws-cdk/aws-dynamodb": "0.0.0", "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-athena/package.json b/packages/@aws-cdk/aws-athena/package.json index fa716069bef70..9659b2cbd0be4 100644 --- a/packages/@aws-cdk/aws-athena/package.json +++ b/packages/@aws-cdk/aws-athena/package.json @@ -85,11 +85,13 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-autoscaling-common/package.json b/packages/@aws-cdk/aws-autoscaling-common/package.json index 7f5e846a11e76..a3a62a34528c6 100644 --- a/packages/@aws-cdk/aws-autoscaling-common/package.json +++ b/packages/@aws-cdk/aws-autoscaling-common/package.json @@ -68,12 +68,14 @@ }, "dependencies": { "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "awslint": { "exclude": [ diff --git a/packages/@aws-cdk/aws-autoscaling-hooktargets/package.json b/packages/@aws-cdk/aws-autoscaling-hooktargets/package.json index 80e59899f70d1..9683a64d90285 100644 --- a/packages/@aws-cdk/aws-autoscaling-hooktargets/package.json +++ b/packages/@aws-cdk/aws-autoscaling-hooktargets/package.json @@ -91,7 +91,8 @@ "@aws-cdk/aws-sns": "0.0.0", "@aws-cdk/aws-sns-subscriptions": "0.0.0", "@aws-cdk/aws-sqs": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { @@ -101,7 +102,8 @@ "@aws-cdk/aws-sns": "0.0.0", "@aws-cdk/aws-sns-subscriptions": "0.0.0", "@aws-cdk/aws-sqs": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-autoscaling/lib/auto-scaling-group.ts b/packages/@aws-cdk/aws-autoscaling/lib/auto-scaling-group.ts index a1148fb166ecf..fcfa75f50c6b6 100644 --- a/packages/@aws-cdk/aws-autoscaling/lib/auto-scaling-group.ts +++ b/packages/@aws-cdk/aws-autoscaling/lib/auto-scaling-group.ts @@ -440,7 +440,7 @@ export class AutoScalingGroup extends AutoScalingGroupBase implements // use delayed evaluation const imageConfig = props.machineImage.getImage(this); - this.userData = props.userData || imageConfig.userData || ec2.UserData.forOperatingSystem(imageConfig.osType); + this.userData = props.userData ?? imageConfig.userData; const userDataToken = Lazy.stringValue({ produce: () => Fn.base64(this.userData.render()) }); const securityGroupsToken = Lazy.listValue({ produce: () => this.securityGroups.map(sg => sg.securityGroupId) }); diff --git a/packages/@aws-cdk/aws-autoscaling/lib/lifecycle-hook-target.ts b/packages/@aws-cdk/aws-autoscaling/lib/lifecycle-hook-target.ts index 50fdc77360d9f..b72a3245eb4d5 100644 --- a/packages/@aws-cdk/aws-autoscaling/lib/lifecycle-hook-target.ts +++ b/packages/@aws-cdk/aws-autoscaling/lib/lifecycle-hook-target.ts @@ -1,4 +1,4 @@ -import { Construct } from '@aws-cdk/core/lib/construct'; +import { Construct } from '@aws-cdk/core'; import { ILifecycleHook } from './lifecycle-hook'; /** diff --git a/packages/@aws-cdk/aws-autoscaling/package.json b/packages/@aws-cdk/aws-autoscaling/package.json index 2ea8366a32cab..1ff2c9c4e410e 100644 --- a/packages/@aws-cdk/aws-autoscaling/package.json +++ b/packages/@aws-cdk/aws-autoscaling/package.json @@ -79,7 +79,8 @@ "@aws-cdk/aws-elasticloadbalancingv2": "0.0.0", "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { @@ -90,7 +91,8 @@ "@aws-cdk/aws-elasticloadbalancingv2": "0.0.0", "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-autoscalingplans/package.json b/packages/@aws-cdk/aws-autoscalingplans/package.json index 5c3e927f252fe..781d7f2ebd1d2 100644 --- a/packages/@aws-cdk/aws-autoscalingplans/package.json +++ b/packages/@aws-cdk/aws-autoscalingplans/package.json @@ -85,11 +85,13 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-backup/package.json b/packages/@aws-cdk/aws-backup/package.json index d8270dcae9cce..99d2a9096478f 100644 --- a/packages/@aws-cdk/aws-backup/package.json +++ b/packages/@aws-cdk/aws-backup/package.json @@ -87,10 +87,12 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-batch/package.json b/packages/@aws-cdk/aws-batch/package.json index c259a145ac4b0..63b6fe5bf8e46 100644 --- a/packages/@aws-cdk/aws-batch/package.json +++ b/packages/@aws-cdk/aws-batch/package.json @@ -91,7 +91,8 @@ "@aws-cdk/aws-ec2": "0.0.0", "@aws-cdk/aws-ecr": "0.0.0", "@aws-cdk/aws-ecs": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0" + "@aws-cdk/aws-iam": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { @@ -99,7 +100,8 @@ "@aws-cdk/aws-ec2": "0.0.0", "@aws-cdk/aws-ecr": "0.0.0", "@aws-cdk/aws-ecs": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0" + "@aws-cdk/aws-iam": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-budgets/package.json b/packages/@aws-cdk/aws-budgets/package.json index 4b59ccafef778..f1f6165e4d746 100644 --- a/packages/@aws-cdk/aws-budgets/package.json +++ b/packages/@aws-cdk/aws-budgets/package.json @@ -85,11 +85,13 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-certificatemanager/package.json b/packages/@aws-cdk/aws-certificatemanager/package.json index c1ea375dfbbc1..5191d386e7500 100644 --- a/packages/@aws-cdk/aws-certificatemanager/package.json +++ b/packages/@aws-cdk/aws-certificatemanager/package.json @@ -74,7 +74,8 @@ "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-lambda": "0.0.0", "@aws-cdk/aws-route53": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { @@ -82,7 +83,8 @@ "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-lambda": "0.0.0", "@aws-cdk/aws-route53": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-cloud9/package.json b/packages/@aws-cdk/aws-cloud9/package.json index cdf46d2fe5f0b..5febff949c4ec 100644 --- a/packages/@aws-cdk/aws-cloud9/package.json +++ b/packages/@aws-cdk/aws-cloud9/package.json @@ -85,11 +85,13 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-cloudformation/package.json b/packages/@aws-cdk/aws-cloudformation/package.json index 2883e4bf7ad3d..6887fb31e5395 100644 --- a/packages/@aws-cdk/aws-cloudformation/package.json +++ b/packages/@aws-cdk/aws-cloudformation/package.json @@ -82,7 +82,8 @@ "@aws-cdk/aws-s3": "0.0.0", "@aws-cdk/aws-sns": "0.0.0", "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0" + "@aws-cdk/cx-api": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { @@ -91,7 +92,8 @@ "@aws-cdk/aws-s3": "0.0.0", "@aws-cdk/aws-sns": "0.0.0", "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0" + "@aws-cdk/cx-api": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-cloudfront/package.json b/packages/@aws-cdk/aws-cloudfront/package.json index 2df3d5a494a7a..5a81c9a3802e0 100644 --- a/packages/@aws-cdk/aws-cloudfront/package.json +++ b/packages/@aws-cdk/aws-cloudfront/package.json @@ -77,7 +77,8 @@ "@aws-cdk/aws-kms": "0.0.0", "@aws-cdk/aws-lambda": "0.0.0", "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { @@ -86,7 +87,8 @@ "@aws-cdk/aws-kms": "0.0.0", "@aws-cdk/aws-lambda": "0.0.0", "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-cloudtrail/package.json b/packages/@aws-cdk/aws-cloudtrail/package.json index f9d722d2780a9..7d05018b99955 100644 --- a/packages/@aws-cdk/aws-cloudtrail/package.json +++ b/packages/@aws-cdk/aws-cloudtrail/package.json @@ -78,7 +78,8 @@ "@aws-cdk/aws-kms": "0.0.0", "@aws-cdk/aws-logs": "0.0.0", "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { @@ -87,7 +88,8 @@ "@aws-cdk/aws-kms": "0.0.0", "@aws-cdk/aws-logs": "0.0.0", "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-cloudwatch-actions/package.json b/packages/@aws-cdk/aws-cloudwatch-actions/package.json index 9ec2e602b54a6..ddb2e8e87a472 100644 --- a/packages/@aws-cdk/aws-cloudwatch-actions/package.json +++ b/packages/@aws-cdk/aws-cloudwatch-actions/package.json @@ -90,7 +90,8 @@ "@aws-cdk/aws-cloudwatch": "0.0.0", "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { @@ -99,7 +100,8 @@ "@aws-cdk/aws-cloudwatch": "0.0.0", "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-cloudwatch/package.json b/packages/@aws-cdk/aws-cloudwatch/package.json index 7c27985c54d12..a9a062604d12c 100644 --- a/packages/@aws-cdk/aws-cloudwatch/package.json +++ b/packages/@aws-cdk/aws-cloudwatch/package.json @@ -72,12 +72,14 @@ }, "dependencies": { "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "awslint": { "exclude": [ diff --git a/packages/@aws-cdk/aws-codebuild/package.json b/packages/@aws-cdk/aws-codebuild/package.json index e7fdb0f3e9134..4ede62a03f060 100644 --- a/packages/@aws-cdk/aws-codebuild/package.json +++ b/packages/@aws-cdk/aws-codebuild/package.json @@ -90,7 +90,8 @@ "@aws-cdk/aws-s3": "0.0.0", "@aws-cdk/aws-s3-assets": "0.0.0", "@aws-cdk/aws-secretsmanager": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { @@ -106,7 +107,8 @@ "@aws-cdk/aws-s3": "0.0.0", "@aws-cdk/aws-s3-assets": "0.0.0", "@aws-cdk/aws-secretsmanager": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-codecommit/package.json b/packages/@aws-cdk/aws-codecommit/package.json index d38671d82cf0e..d11f71bd3b41e 100644 --- a/packages/@aws-cdk/aws-codecommit/package.json +++ b/packages/@aws-cdk/aws-codecommit/package.json @@ -80,13 +80,15 @@ "dependencies": { "@aws-cdk/aws-events": "0.0.0", "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { "@aws-cdk/aws-events": "0.0.0", "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-codedeploy/package.json b/packages/@aws-cdk/aws-codedeploy/package.json index 07a20730b3827..33dfbe4ea4a20 100644 --- a/packages/@aws-cdk/aws-codedeploy/package.json +++ b/packages/@aws-cdk/aws-codedeploy/package.json @@ -82,7 +82,8 @@ "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-lambda": "0.0.0", "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { @@ -94,7 +95,8 @@ "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-lambda": "0.0.0", "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-codepipeline-actions/package.json b/packages/@aws-cdk/aws-codepipeline-actions/package.json index bb343a8cdf138..90c2771a96534 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/package.json +++ b/packages/@aws-cdk/aws-codepipeline-actions/package.json @@ -91,7 +91,8 @@ "@aws-cdk/aws-sns": "0.0.0", "@aws-cdk/aws-sns-subscriptions": "0.0.0", "@aws-cdk/core": "0.0.0", - "case": "1.6.2" + "case": "1.6.2", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { @@ -110,7 +111,8 @@ "@aws-cdk/aws-s3": "0.0.0", "@aws-cdk/aws-sns": "0.0.0", "@aws-cdk/aws-sns-subscriptions": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "bundledDependencies": [ "case" diff --git a/packages/@aws-cdk/aws-codepipeline/package.json b/packages/@aws-cdk/aws-codepipeline/package.json index acf4bc39f27dc..2b8c302dac5a0 100644 --- a/packages/@aws-cdk/aws-codepipeline/package.json +++ b/packages/@aws-cdk/aws-codepipeline/package.json @@ -82,7 +82,8 @@ "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-kms": "0.0.0", "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { @@ -90,7 +91,8 @@ "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-kms": "0.0.0", "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-codestar/package.json b/packages/@aws-cdk/aws-codestar/package.json index c8a881ed90b39..700d69f27c761 100644 --- a/packages/@aws-cdk/aws-codestar/package.json +++ b/packages/@aws-cdk/aws-codestar/package.json @@ -87,10 +87,12 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-codestarnotifications/package.json b/packages/@aws-cdk/aws-codestarnotifications/package.json index 1e9668d3ef2a3..4cd5b1209d8a2 100644 --- a/packages/@aws-cdk/aws-codestarnotifications/package.json +++ b/packages/@aws-cdk/aws-codestarnotifications/package.json @@ -87,10 +87,12 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-cognito/README.md b/packages/@aws-cdk/aws-cognito/README.md index 487e538e4bedd..eccf6987b7e70 100644 --- a/packages/@aws-cdk/aws-cognito/README.md +++ b/packages/@aws-cdk/aws-cognito/README.md @@ -162,6 +162,41 @@ When the `smsRole` property is specified, the `smsRoleExternalId` may also be sp assume role policy should be configured to accept this value as the ExternalId. Learn more about [ExternalId here](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-user_externalid.html). +### Attributes + +Attributes represent the various properties of each user that's collected and stored in the user pool. Cognito +provides a set of standard attributes that are available for all user pools. Users are allowed to select any of these +standard attributes to be required. Users will not be able to sign up to the user pool without providing the required +attributes. Besides these, additional attributes can be further defined, and are known as custom attributes. + +Learn more on [attributes in Cognito's +documentation](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-attributes.html). + +The following code sample configures a user pool with two standard attributes (name and address) as required, and adds +four optional attributes. + +```ts +new UserPool(this, 'myuserpool', { + // ... + // ... + requiredAttributes: { + fullname: true, + address: true, + }, + customAttributes: { + 'myappid': new StringAttribute({ minLen: 5, maxLen: 15 }), + 'callingcode': new NumberAttribute({ min: 1, max: 3 }), + 'isEmployee': new BooleanAttribute(), + 'joinedOn': new DateTimeAttribute(), + }, +}); +``` + +As shown in the code snippet, there are data types that are available for custom attributes. The 'String' and 'Number' +data types allow for further constraints on their length and values, respectively. + +Custom attributes cannot be marked as required. + ### Importing User Pools Any user pool that has been created outside of this stack, can be imported into the CDK app. Importing a user pool diff --git a/packages/@aws-cdk/aws-cognito/lib/index.ts b/packages/@aws-cdk/aws-cognito/lib/index.ts index 11171b83add28..d19f4fc1882cf 100644 --- a/packages/@aws-cdk/aws-cognito/lib/index.ts +++ b/packages/@aws-cdk/aws-cognito/lib/index.ts @@ -1,5 +1,5 @@ -// AWS::Cognito CloudFormation Resources: export * from './cognito.generated'; export * from './user-pool'; +export * from './user-pool-attr'; export * from './user-pool-client'; \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cognito/lib/user-pool-attr.ts b/packages/@aws-cdk/aws-cognito/lib/user-pool-attr.ts new file mode 100644 index 0000000000000..aecb817890599 --- /dev/null +++ b/packages/@aws-cdk/aws-cognito/lib/user-pool-attr.ts @@ -0,0 +1,274 @@ +/** + * The set of standard attributes that can be marked as required. + * + * @see https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-attributes.html#cognito-user-pools-standard-attributes + */ +export interface RequiredAttributes { + /** + * Whether the user's postal address is a required attribute. + * @default false + */ + readonly address?: boolean; + + /** + * Whether the user's birthday, represented as an ISO 8601:2004 format, is a required attribute. + * @default false + */ + readonly birthdate?: boolean; + + /** + * Whether theb user's e-mail address, represented as an RFC 5322 [RFC5322] addr-spec, is a required attribute. + * @default false + */ + readonly email?: boolean; + + /** + * Whether the surname or last name of the user is a required attribute. + * @default false + */ + readonly familyName?: boolean; + + /** + * Whether the user's gender is a required attribute. + * @default false + */ + readonly gender?: boolean; + + /** + * Whether the user's first name or give name is a required attribute. + * @default false + */ + readonly givenName?: boolean; + + /** + * Whether the user's locale, represented as a BCP47 [RFC5646] language tag, is a required attribute. + * @default false + */ + readonly locale?: boolean; + + /** + * Whether the user's middle name is a required attribute. + * @default false + */ + readonly middleName?: boolean; + + /** + * Whether user's full name in displayable form, including all name parts, titles and suffixes, is a required attibute. + * @default false + */ + readonly fullname?: boolean; + + /** + * Whether the user's nickname or casual name is a required attribute. + * @default false + */ + readonly nickname?: boolean; + + /** + * Whether the user's telephone number is a required attribute. + * @default false + */ + readonly phoneNumber?: boolean; + + /** + * Whether the URL to the user's profile picture is a required attribute. + * @default false + */ + readonly profilePicture?: boolean; + + /** + * Whether the user's preffered username, different from the immutable user name, is a required attribute. + * @default false + */ + readonly preferredUsername?: boolean; + + /** + * Whether the URL to the user's profile page is a required attribute. + * @default false + */ + readonly profilePage?: boolean; + + /** + * Whether the user's time zone is a required attribute. + * @default false + */ + readonly timezone?: boolean; + + /** + * Whether the time, the user's information was last updated, is a required attribute. + * @default false + */ + readonly lastUpdateTime?: boolean; + + /** + * Whether the URL to the user's web page or blog is a required attribute. + * @default false + */ + readonly website?: boolean; +} + +/** + * Represents a custom attribute type. + */ +export interface ICustomAttribute { + /** + * Bind this custom attribute type to the values as expected by CloudFormation + */ + bind(): CustomAttributeConfig; +} + +/** + * Configuration that will be fed into CloudFormation for any custom attribute type. + */ +export interface CustomAttributeConfig { + // tslint:disable:max-line-length + /** + * The data type of the custom attribute. + * + * @see https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_SchemaAttributeType.html#CognitoUserPools-Type-SchemaAttributeType-AttributeDataType + */ + readonly dataType: string; + // tslint:enable:max-line-length + + /** + * The constraints for a custom attribute of 'String' data type. + * @default - None. + */ + readonly stringConstraints?: StringAttributeConstraints; + + /** + * The constraints for a custom attribute of the 'Number' data type. + * @default - None. + */ + readonly numberConstraints?: NumberAttributeConstraints; +} + +/** + * Constraints that can be applied to a custom attribute of string type. + */ +export interface StringAttributeConstraints { + /** + * Minimum length of this attribute. + * @default 0 + */ + readonly minLen?: number; + + /** + * Maximum length of this attribute. + * @default 2048 + */ + readonly maxLen?: number; +} + +/** + * Props for constructing a StringAttr + */ +export interface StringAttributeProps extends StringAttributeConstraints { +} + +/** + * The String custom attribute type. + */ +export class StringAttribute implements ICustomAttribute { + private readonly minLen?: number; + private readonly maxLen?: number; + + constructor(props: StringAttributeProps = {}) { + if (props.minLen && props.minLen < 0) { + throw new Error(`minLen cannot be less than 0 (value: ${props.minLen}).`); + } + if (props.maxLen && props.maxLen > 2048) { + throw new Error(`maxLen cannot be greater than 2048 (value: ${props.maxLen}).`); + } + this.minLen = props?.minLen; + this.maxLen = props?.maxLen; + } + + public bind(): CustomAttributeConfig { + let stringConstraints: StringAttributeConstraints | undefined; + if (this.minLen || this.maxLen) { + stringConstraints = { + minLen: this.minLen, + maxLen: this.maxLen, + }; + } + + return { + dataType: 'String', + stringConstraints, + }; + } +} + +/** + * Constraints that can be applied to a custom attribute of number type. + */ +export interface NumberAttributeConstraints { + /** + * Minimum value of this attribute. + * @default - no minimum value + */ + readonly min?: number; + + /** + * Maximum value of this attribute. + * @default - no maximum value + */ + readonly max?: number; +} + +/** + * Props for NumberAttr + */ +export interface NumberAttributeProps extends NumberAttributeConstraints { +} + +/** + * The Number custom attribute type. + */ +export class NumberAttribute implements ICustomAttribute { + private readonly min?: number; + private readonly max?: number; + + constructor(props: NumberAttributeProps = {}) { + this.min = props?.min; + this.max = props?.max; + } + + public bind(): CustomAttributeConfig { + let numberConstraints: NumberAttributeConstraints | undefined; + if (this.min || this.max) { + numberConstraints = { + min: this.min, + max: this.max, + }; + } + + return { + dataType: 'Number', + numberConstraints, + }; + } +} + +/** + * The Boolean custom attribute type. + */ +export class BooleanAttribute implements ICustomAttribute { + public bind(): CustomAttributeConfig { + return { + dataType: 'Boolean' + }; + } +} + +/** + * The DateTime custom attribute type. + */ +export class DateTimeAttribute implements ICustomAttribute { + public bind(): CustomAttributeConfig { + return { + dataType: 'DateTime' + }; + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cognito/lib/user-pool.ts b/packages/@aws-cdk/aws-cognito/lib/user-pool.ts index 43a41541ac136..5e617af440097 100644 --- a/packages/@aws-cdk/aws-cognito/lib/user-pool.ts +++ b/packages/@aws-cdk/aws-cognito/lib/user-pool.ts @@ -2,123 +2,7 @@ import { IRole, PolicyDocument, PolicyStatement, Role, ServicePrincipal } from ' import * as lambda from '@aws-cdk/aws-lambda'; import { Construct, IResource, Lazy, Resource, Stack } from '@aws-cdk/core'; import { CfnUserPool } from './cognito.generated'; - -/** - * Standard attributes - * Specified following the OpenID Connect spec - * @see https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims - */ -export enum UserPoolAttribute { - /** - * End-User's preferred postal address. - */ - ADDRESS = 'address', - - /** - * End-User's birthday, represented as an ISO 8601:2004 [ISO8601‑2004] YYYY-MM-DD format. - * The year MAY be 0000, indicating that it is omitted. - * To represent only the year, YYYY format is allowed. - */ - BIRTHDATE = 'birthdate', - - /** - * End-User's preferred e-mail address. - * Its value MUST conform to the RFC 5322 [RFC5322] addr-spec syntax. - */ - EMAIL = 'email', - - /** - * Surname(s) or last name(s) of the End-User. - * Note that in some cultures, people can have multiple family names or no family name; - * all can be present, with the names being separated by space characters. - */ - FAMILY_NAME = 'family_name', - - /** - * End-User's gender. - */ - GENDER = 'gender', - - /** - * Given name(s) or first name(s) of the End-User. - * Note that in some cultures, people can have multiple given names; - * all can be present, with the names being separated by space characters. - */ - GIVEN_NAME = 'given_name', - - /** - * End-User's locale, represented as a BCP47 [RFC5646] language tag. - * This is typically an ISO 639-1 Alpha-2 [ISO639‑1] language code in lowercase - * and an ISO 3166-1 Alpha-2 [ISO3166‑1] country code in uppercase, separated by a dash. - * For example, en-US or fr-CA. - */ - LOCALE = 'locale', - - /** - * Middle name(s) of the End-User. - * Note that in some cultures, people can have multiple middle names; - * all can be present, with the names being separated by space characters. - * Also note that in some cultures, middle names are not used. - */ - MIDDLE_NAME = 'middle_name', - - /** - * End-User's full name in displayable form including all name parts, - * possibly including titles and suffixes, ordered according to the End-User's locale and preferences. - */ - NAME = 'name', - - /** - * Casual name of the End-User that may or may not be the same as the given_name. - * For instance, a nickname value of Mike might be returned alongside a given_name value of Michael. - */ - NICKNAME = 'nickname', - - /** - * End-User's preferred telephone number. - * E.164 [E.164] is RECOMMENDED as the format of this Claim, for example, +1 (425) 555-1212 or +56 (2) 687 2400. - * If the phone number contains an extension, it is RECOMMENDED that the extension be represented using the - * RFC 3966 [RFC3966] extension syntax, for example, +1 (604) 555-1234;ext=5678. - */ - PHONE_NUMBER = 'phone_number', - - /** - * URL of the End-User's profile picture. - * This URL MUST refer to an image file (for example, a PNG, JPEG, or GIF image file), - * rather than to a Web page containing an image. - * Note that this URL SHOULD specifically reference a profile photo of the End-User - * suitable for displaying when describing the End-User, rather than an arbitrary photo taken by the End-User - */ - PICTURE = 'picture', - - /** - * Shorthand name by which the End-User wishes to be referred to. - */ - PREFERRED_USERNAME = 'preferred_username', - - /** - * URL of the End-User's profile page. The contents of this Web page SHOULD be about the End-User. - */ - PROFILE = 'profile', - - /** - * The End-User's time zone - */ - TIMEZONE = 'zoneinfo', - - /** - * Time the End-User's information was last updated. - * Its value is a JSON number representing the number of seconds from 1970-01-01T0:0:0Z - * as measured in UTC until the date/time. - */ - UPDATED_AT = 'updated_at', - - /** - * URL of the End-User's Web page or blog. - * This Web page SHOULD contain information published by the End-User or an organization that the End-User is affiliated with. - */ - WEBSITE = 'website' -} +import { ICustomAttribute, RequiredAttributes } from './user-pool-attr'; /** * The different ways in which users of this pool can sign up or sign in. @@ -372,6 +256,21 @@ export interface UserPoolProps { */ readonly autoVerify?: AutoVerifiedAttrs; + /** + * The set of attributes that are required for every user in the user pool. + * Read more on attributes here - https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-attributes.html + * + * @default - No attributes are required. + */ + readonly requiredAttributes?: RequiredAttributes; + + /** + * Define a set of custom attributes that can be configured for each user in the user pool. + * + * @default - No custom attributes. + */ + readonly customAttributes?: { [key: string]: ICustomAttribute }; + /** * Lambda functions to use for supported Cognito triggers. * @@ -507,6 +406,7 @@ export class UserPool extends Resource implements IUserPool { emailVerificationSubject, smsVerificationMessage, verificationMessageTemplate, + schema: this.schemaConfiguration(props), }); this.userPoolId = userPool.ref; @@ -647,24 +547,24 @@ export class UserPool extends Resource implements IUserPool { if (signIn.username) { aliasAttrs = []; - if (signIn.email) { aliasAttrs.push(UserPoolAttribute.EMAIL); } - if (signIn.phone) { aliasAttrs.push(UserPoolAttribute.PHONE_NUMBER); } - if (signIn.preferredUsername) { aliasAttrs.push(UserPoolAttribute.PREFERRED_USERNAME); } + if (signIn.email) { aliasAttrs.push(StandardAttribute.EMAIL); } + if (signIn.phone) { aliasAttrs.push(StandardAttribute.PHONE_NUMBER); } + if (signIn.preferredUsername) { aliasAttrs.push(StandardAttribute.PREFERRED_USERNAME); } if (aliasAttrs.length === 0) { aliasAttrs = undefined; } } else { usernameAttrs = []; - if (signIn.email) { usernameAttrs.push(UserPoolAttribute.EMAIL); } - if (signIn.phone) { usernameAttrs.push(UserPoolAttribute.PHONE_NUMBER); } + if (signIn.email) { usernameAttrs.push(StandardAttribute.EMAIL); } + if (signIn.phone) { usernameAttrs.push(StandardAttribute.PHONE_NUMBER); } } if (props.autoVerify) { autoVerifyAttrs = []; - if (props.autoVerify.email) { autoVerifyAttrs.push(UserPoolAttribute.EMAIL); } - if (props.autoVerify.phone) { autoVerifyAttrs.push(UserPoolAttribute.PHONE_NUMBER); } + if (props.autoVerify.email) { autoVerifyAttrs.push(StandardAttribute.EMAIL); } + if (props.autoVerify.phone) { autoVerifyAttrs.push(StandardAttribute.PHONE_NUMBER); } } else if (signIn.email || signIn.phone) { autoVerifyAttrs = []; - if (signIn.email) { autoVerifyAttrs.push(UserPoolAttribute.EMAIL); } - if (signIn.phone) { autoVerifyAttrs.push(UserPoolAttribute.PHONE_NUMBER); } + if (signIn.email) { autoVerifyAttrs.push(StandardAttribute.EMAIL); } + if (signIn.phone) { autoVerifyAttrs.push(StandardAttribute.PHONE_NUMBER); } } return { usernameAttrs, aliasAttrs, autoVerifyAttrs }; @@ -706,4 +606,81 @@ export class UserPool extends Resource implements IUserPool { }; } } + + private schemaConfiguration(props: UserPoolProps): CfnUserPool.SchemaAttributeProperty[] | undefined { + const schema: CfnUserPool.SchemaAttributeProperty[] = []; + + if (props.requiredAttributes) { + const stdAttributes: StandardAttribute[] = []; + + if (props.requiredAttributes.address) { stdAttributes.push(StandardAttribute.ADDRESS); } + if (props.requiredAttributes.birthdate) { stdAttributes.push(StandardAttribute.BIRTHDATE); } + if (props.requiredAttributes.email) { stdAttributes.push(StandardAttribute.EMAIL); } + if (props.requiredAttributes.familyName) { stdAttributes.push(StandardAttribute.FAMILY_NAME); } + if (props.requiredAttributes.fullname) { stdAttributes.push(StandardAttribute.NAME); } + if (props.requiredAttributes.gender) { stdAttributes.push(StandardAttribute.GENDER); } + if (props.requiredAttributes.givenName) { stdAttributes.push(StandardAttribute.GIVEN_NAME); } + if (props.requiredAttributes.lastUpdateTime) { stdAttributes.push(StandardAttribute.LAST_UPDATE_TIME); } + if (props.requiredAttributes.locale) { stdAttributes.push(StandardAttribute.LOCALE); } + if (props.requiredAttributes.middleName) { stdAttributes.push(StandardAttribute.MIDDLE_NAME); } + if (props.requiredAttributes.nickname) { stdAttributes.push(StandardAttribute.NICKNAME); } + if (props.requiredAttributes.phoneNumber) { stdAttributes.push(StandardAttribute.PHONE_NUMBER); } + if (props.requiredAttributes.preferredUsername) { stdAttributes.push(StandardAttribute.PREFERRED_USERNAME); } + if (props.requiredAttributes.profilePage) { stdAttributes.push(StandardAttribute.PROFILE_URL); } + if (props.requiredAttributes.profilePicture) { stdAttributes.push(StandardAttribute.PICTURE_URL); } + if (props.requiredAttributes.timezone) { stdAttributes.push(StandardAttribute.TIMEZONE); } + if (props.requiredAttributes.website) { stdAttributes.push(StandardAttribute.WEBSITE); } + + schema.push(...stdAttributes.map((attr) => { + return { name: attr, required: true }; + })); + } + + if (props.customAttributes) { + const customAttrs = Object.keys(props.customAttributes).map((attrName) => { + const attrConfig = props.customAttributes![attrName].bind(); + const numberConstraints: CfnUserPool.NumberAttributeConstraintsProperty = { + minValue: attrConfig.numberConstraints?.min?.toString(), + maxValue: attrConfig.numberConstraints?.max?.toString(), + }; + const stringConstraints: CfnUserPool.StringAttributeConstraintsProperty = { + minLength: attrConfig.stringConstraints?.minLen?.toString(), + maxLength: attrConfig.stringConstraints?.maxLen?.toString(), + }; + + return { + name: attrName, + attributeDataType: attrConfig.dataType, + numberAttributeConstraints: (attrConfig.numberConstraints) ? numberConstraints : undefined, + stringAttributeConstraints: (attrConfig.stringConstraints) ? stringConstraints : undefined, + }; + }); + schema.push(...customAttrs); + } + + if (schema.length === 0) { + return undefined; + } + return schema; + } +} + +const enum StandardAttribute { + ADDRESS = 'address', + BIRTHDATE = 'birthdate', + EMAIL = 'email', + FAMILY_NAME = 'family_name', + GENDER = 'gender', + GIVEN_NAME = 'given_name', + LOCALE = 'locale', + MIDDLE_NAME = 'middle_name', + NAME = 'name', + NICKNAME = 'nickname', + PHONE_NUMBER = 'phone_number', + PICTURE_URL = 'picture', + PREFERRED_USERNAME = 'preferred_username', + PROFILE_URL = 'profile', + TIMEZONE = 'zoneinfo', + LAST_UPDATE_TIME = 'updated_at', + WEBSITE = 'website', } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cognito/package.json b/packages/@aws-cdk/aws-cognito/package.json index 2fe3ec4222d97..bd9a6f9868468 100644 --- a/packages/@aws-cdk/aws-cognito/package.json +++ b/packages/@aws-cdk/aws-cognito/package.json @@ -74,13 +74,15 @@ "dependencies": { "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "jest": {}, "engines": { @@ -88,7 +90,6 @@ }, "awslint": { "exclude": [ - "no-unused-type:@aws-cdk/aws-cognito.UserPoolAttribute", "props-default-doc:@aws-cdk/aws-cognito.UserPoolTriggers.verifyAuthChallengeResponse", "props-default-doc:@aws-cdk/aws-cognito.UserPoolTriggers.userMigration", "props-default-doc:@aws-cdk/aws-cognito.UserPoolTriggers.preTokenGeneration", diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-explicit-props.expected.json b/packages/@aws-cdk/aws-cognito/test/integ.user-pool-explicit-props.expected.json index f7b8a29230d8d..80f45f3a73d6c 100644 --- a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-explicit-props.expected.json +++ b/packages/@aws-cdk/aws-cognito/test/integ.user-pool-explicit-props.expected.json @@ -58,6 +58,48 @@ "EmailVerificationMessage": "verification email body from the integ test. Code is {####}.", "EmailVerificationSubject": "verification email subject from the integ test", "LambdaConfig": {}, + "Schema": [ + { + "Name": "email", + "Required": true + }, + { + "Name": "name", + "Required": true + }, + { + "AttributeDataType": "String", + "Name": "some-string-attr" + }, + { + "AttributeDataType": "String", + "Name": "another-string-attr", + "StringAttributeConstraints": { + "MaxLength": "100", + "MinLength": "4" + } + }, + { + "AttributeDataType": "Number", + "Name": "some-number-attr" + }, + { + "AttributeDataType": "Number", + "Name": "another-number-attr", + "NumberAttributeConstraints": { + "MaxValue": "50", + "MinValue": "10" + } + }, + { + "AttributeDataType": "Boolean", + "Name": "some-boolean-attr" + }, + { + "AttributeDataType": "DateTime", + "Name": "some-datetime-attr" + } + ], "SmsConfiguration": { "ExternalId": "integuserpoolmyuserpoolDA38443C", "SnsCallerArn": { @@ -77,5 +119,12 @@ } } } + }, + "Outputs": { + "userpoolId": { + "Value": { + "Ref": "myuserpool01998219" + } + } } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-explicit-props.ts b/packages/@aws-cdk/aws-cognito/test/integ.user-pool-explicit-props.ts index 316beb5d3a494..4478eeb35077a 100644 --- a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-explicit-props.ts +++ b/packages/@aws-cdk/aws-cognito/test/integ.user-pool-explicit-props.ts @@ -1,10 +1,10 @@ -import { App, Stack } from '@aws-cdk/core'; -import { UserPool } from '../lib'; +import { App, CfnOutput, Stack } from '@aws-cdk/core'; +import { BooleanAttribute, DateTimeAttribute, NumberAttribute, StringAttribute, UserPool } from '../lib'; const app = new App(); const stack = new Stack(app, 'integ-user-pool'); -new UserPool(stack, 'myuserpool', { +const userpool = new UserPool(stack, 'myuserpool', { userPoolName: 'MyUserPool', userInvitation: { emailSubject: 'invitation email subject from the integ test', @@ -25,4 +25,20 @@ new UserPool(stack, 'myuserpool', { email: true, phone: true, }, + requiredAttributes: { + fullname: true, + email: true, + }, + customAttributes: { + 'some-string-attr': new StringAttribute(), + 'another-string-attr': new StringAttribute({ minLen: 4, maxLen: 100 }), + 'some-number-attr': new NumberAttribute(), + 'another-number-attr': new NumberAttribute({ min: 10, max: 50 }), + 'some-boolean-attr': new BooleanAttribute(), + 'some-datetime-attr': new DateTimeAttribute(), + } +}); + +new CfnOutput(stack, 'userpoolId', { + value: userpool.userPoolId }); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool.expected.json b/packages/@aws-cdk/aws-cognito/test/integ.user-pool.expected.json index a90b415dd7cb9..7b6f4b86e66bd 100644 --- a/packages/@aws-cdk/aws-cognito/test/integ.user-pool.expected.json +++ b/packages/@aws-cdk/aws-cognito/test/integ.user-pool.expected.json @@ -65,5 +65,12 @@ } } } + }, + "Outputs": { + "userpoolid": { + "Value": { + "Ref": "myuserpool01998219" + } + } } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool.ts b/packages/@aws-cdk/aws-cognito/test/integ.user-pool.ts index c053d9d5e0d89..565a6b1dd549e 100644 --- a/packages/@aws-cdk/aws-cognito/test/integ.user-pool.ts +++ b/packages/@aws-cdk/aws-cognito/test/integ.user-pool.ts @@ -1,9 +1,13 @@ -import { App, Stack } from '@aws-cdk/core'; +import { App, CfnOutput, Stack } from '@aws-cdk/core'; import { UserPool } from '../lib'; const app = new App(); const stack = new Stack(app, 'integ-user-pool'); -new UserPool(stack, 'myuserpool', { +const userpool = new UserPool(stack, 'myuserpool', { userPoolName: 'MyUserPool', +}); + +new CfnOutput(stack, 'user-pool-id', { + value: userpool.userPoolId, }); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cognito/test/user-pool-attr.test.ts b/packages/@aws-cdk/aws-cognito/test/user-pool-attr.test.ts new file mode 100644 index 0000000000000..e420571cc47dd --- /dev/null +++ b/packages/@aws-cdk/aws-cognito/test/user-pool-attr.test.ts @@ -0,0 +1,101 @@ +import '@aws-cdk/assert/jest'; +import { BooleanAttribute, DateTimeAttribute, NumberAttribute, StringAttribute } from '../lib'; + +describe('User Pool Attributes', () => { + describe('StringAttribute', () => { + test('default', () => { + // GIVEN + const attr = new StringAttribute(); + + // WHEN + const bound = attr.bind(); + + // THEN + expect(bound.dataType).toEqual('String'); + expect(bound.stringConstraints).toBeUndefined(); + expect(bound.numberConstraints).toBeUndefined(); + }); + + test('specified constraints are recognized', () => { + // GIVEN + const attr = new StringAttribute({ minLen: 10, maxLen: 60 }); + + // WHEN + const bound = attr.bind(); + + // THEN + expect(bound.stringConstraints).toEqual({ + minLen: 10, + maxLen: 60, + }); + expect(bound.numberConstraints).toBeUndefined(); + }); + + test('throws error when crossing limits', () => { + expect(() => new StringAttribute({ minLen: -10 })) + .toThrow(/minLen cannot be less than/); + expect(() => new StringAttribute({ maxLen: 5000 })) + .toThrow(/maxLen cannot be greater than/); + }); + }); + + describe('NumberAttribute', () => { + test('default', () => { + // GIVEN + const attr = new NumberAttribute(); + + // WHEN + const bound = attr.bind(); + + // THEN + expect(bound.dataType).toEqual('Number'); + expect(bound.stringConstraints).toBeUndefined(); + expect(bound.numberConstraints).toBeUndefined(); + }); + + test('specified constraints are recognized', () => { + // GIVEN + const attr = new NumberAttribute({ min: 5, max: 600 }); + + // WHEN + const bound = attr.bind(); + + // THEN + expect(bound.numberConstraints).toEqual({ + min: 5, + max: 600, + }); + expect(bound.stringConstraints).toBeUndefined(); + }); + }); + + describe('BooleanAttribute', () => { + test('default', () => { + // GIVEN + const attr = new BooleanAttribute(); + + // WHEN + const bound = attr.bind(); + + // THEN + expect(bound.dataType).toEqual('Boolean'); + expect(bound.stringConstraints).toBeUndefined(); + expect(bound.numberConstraints).toBeUndefined(); + }); + }); + + describe('DateTimeAttribute', () => { + test('default', () => { + // GIVEN + const attr = new DateTimeAttribute(); + + // WHEN + const bound = attr.bind(); + + // THEN + expect(bound.dataType).toEqual('DateTime'); + expect(bound.stringConstraints).toBeUndefined(); + expect(bound.numberConstraints).toBeUndefined(); + }); + }); +}); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cognito/test/user-pool.test.ts b/packages/@aws-cdk/aws-cognito/test/user-pool.test.ts index 16cfc7b9b051b..2203af67bdbe6 100644 --- a/packages/@aws-cdk/aws-cognito/test/user-pool.test.ts +++ b/packages/@aws-cdk/aws-cognito/test/user-pool.test.ts @@ -3,7 +3,7 @@ import { ABSENT } from '@aws-cdk/assert/lib/assertions/have-resource'; import { Role } from '@aws-cdk/aws-iam'; import * as lambda from '@aws-cdk/aws-lambda'; import { Stack, Tag } from '@aws-cdk/core'; -import { UserPool, VerificationEmailStyle } from '../lib'; +import { NumberAttribute, StringAttribute, UserPool, VerificationEmailStyle } from '../lib'; describe('User Pool', () => { test('default setup', () => { @@ -436,4 +436,123 @@ describe('User Pool', () => { AutoVerifiedAttributes: [ 'email', 'phone_number' ], }); }); + + test('required attributes', () => { + // GIVEN + const stack = new Stack(); + + // WHEN + new UserPool(stack, 'Pool', { + requiredAttributes: { + fullname: true, + timezone: true, + } + }); + + // THEN + expect(stack).toHaveResourceLike('AWS::Cognito::UserPool', { + Schema: [ + { + Name: 'name', + Required: true + }, + { + Name: 'zoneinfo', + Required: true + }, + ] + }); + }); + + test('schema is absent when required attributes are specified but as false', () => { + // GIVEN + const stack = new Stack(); + + // WHEN + new UserPool(stack, 'Pool1', { + userPoolName: 'Pool1', + }); + new UserPool(stack, 'Pool2', { + userPoolName: 'Pool2', + requiredAttributes: { + familyName: false, + } + }); + + // THEN + expect(stack).toHaveResourceLike('AWS::Cognito::UserPool', { + UserPoolName: 'Pool1', + Schema: ABSENT + }); + expect(stack).toHaveResourceLike('AWS::Cognito::UserPool', { + UserPoolName: 'Pool2', + Schema: ABSENT + }); + }); + + test('custom attributes with default constraints', () => { + // GIVEN + const stack = new Stack(); + + // WHEN + new UserPool(stack, 'Pool', { + customAttributes: { + 'custom-string-attr': new StringAttribute(), + 'custom-number-attr': new NumberAttribute(), + } + }); + + // THEN + expect(stack).toHaveResourceLike('AWS::Cognito::UserPool', { + Schema: [ + { + Name: 'custom-string-attr', + AttributeDataType: 'String', + StringAttributeConstraints: ABSENT, + NumberAttributeConstraints: ABSENT, + }, + { + Name: 'custom-number-attr', + AttributeDataType: 'Number', + StringAttributeConstraints: ABSENT, + NumberAttributeConstraints: ABSENT, + } + ] + }); + }); + + test('custom attributes with constraints', () => { + // GIVEN + const stack = new Stack(); + + // WHEN + new UserPool(stack, 'Pool', { + customAttributes: { + 'custom-string-attr': new StringAttribute({ minLen: 5, maxLen: 50 }), + 'custom-number-attr': new NumberAttribute({ min: 500, max: 2000 }), + } + }); + + // THEN + expect(stack).toHaveResourceLike('AWS::Cognito::UserPool', { + Schema: [ + { + AttributeDataType: 'String', + Name: 'custom-string-attr', + StringAttributeConstraints: { + MaxLength: '50', + MinLength: '5', + } + }, + { + AttributeDataType: 'Number', + Name: 'custom-number-attr', + NumberAttributeConstraints: { + MaxValue: '2000', + MinValue: '500', + } + } + ] + }); + }); }); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-config/package.json b/packages/@aws-cdk/aws-config/package.json index 43fd56f67f746..2d6deffff35a4 100644 --- a/packages/@aws-cdk/aws-config/package.json +++ b/packages/@aws-cdk/aws-config/package.json @@ -76,7 +76,8 @@ "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-lambda": "0.0.0", "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { @@ -84,7 +85,8 @@ "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-lambda": "0.0.0", "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-datapipeline/package.json b/packages/@aws-cdk/aws-datapipeline/package.json index bf2ebe2516297..0cfc3affa0de3 100644 --- a/packages/@aws-cdk/aws-datapipeline/package.json +++ b/packages/@aws-cdk/aws-datapipeline/package.json @@ -85,11 +85,13 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-dax/package.json b/packages/@aws-cdk/aws-dax/package.json index 53710eaac8d12..9a2da4eae0ec2 100644 --- a/packages/@aws-cdk/aws-dax/package.json +++ b/packages/@aws-cdk/aws-dax/package.json @@ -85,11 +85,13 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-directoryservice/package.json b/packages/@aws-cdk/aws-directoryservice/package.json index 0450516f9fcd7..99b96c21f2948 100644 --- a/packages/@aws-cdk/aws-directoryservice/package.json +++ b/packages/@aws-cdk/aws-directoryservice/package.json @@ -85,11 +85,13 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-dlm/package.json b/packages/@aws-cdk/aws-dlm/package.json index f66e559f0178c..9674f5fbb2f43 100644 --- a/packages/@aws-cdk/aws-dlm/package.json +++ b/packages/@aws-cdk/aws-dlm/package.json @@ -86,10 +86,12 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-dms/package.json b/packages/@aws-cdk/aws-dms/package.json index 071c60bc5502b..88e1e996d9e25 100644 --- a/packages/@aws-cdk/aws-dms/package.json +++ b/packages/@aws-cdk/aws-dms/package.json @@ -85,11 +85,13 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-docdb/package.json b/packages/@aws-cdk/aws-docdb/package.json index afa64f59a95af..d5b7388e27f59 100644 --- a/packages/@aws-cdk/aws-docdb/package.json +++ b/packages/@aws-cdk/aws-docdb/package.json @@ -87,10 +87,12 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-dynamodb-global/package.json b/packages/@aws-cdk/aws-dynamodb-global/package.json index 0ab4cdfe230de..d185652f1cceb 100644 --- a/packages/@aws-cdk/aws-dynamodb-global/package.json +++ b/packages/@aws-cdk/aws-dynamodb-global/package.json @@ -50,7 +50,8 @@ "@aws-cdk/aws-dynamodb": "0.0.0", "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "devDependencies": { "@aws-cdk/assert": "0.0.0", @@ -66,7 +67,8 @@ "@aws-cdk/aws-dynamodb": "0.0.0", "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "scripts": { "build": "cdk-build", diff --git a/packages/@aws-cdk/aws-dynamodb/package.json b/packages/@aws-cdk/aws-dynamodb/package.json index be8bf3ee29ace..190ecde2dec12 100644 --- a/packages/@aws-cdk/aws-dynamodb/package.json +++ b/packages/@aws-cdk/aws-dynamodb/package.json @@ -80,7 +80,8 @@ "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-lambda": "0.0.0", "@aws-cdk/core": "0.0.0", - "@aws-cdk/custom-resources": "0.0.0" + "@aws-cdk/custom-resources": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { @@ -90,7 +91,8 @@ "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-lambda": "0.0.0", "@aws-cdk/core": "0.0.0", - "@aws-cdk/custom-resources": "0.0.0" + "@aws-cdk/custom-resources": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-ec2/lib/instance.ts b/packages/@aws-cdk/aws-ec2/lib/instance.ts index 71806016851b0..52803783bdb6d 100644 --- a/packages/@aws-cdk/aws-ec2/lib/instance.ts +++ b/packages/@aws-cdk/aws-ec2/lib/instance.ts @@ -280,7 +280,7 @@ export class Instance extends Resource implements IInstance { // use delayed evaluation const imageConfig = props.machineImage.getImage(this); - this.userData = props.userData || imageConfig.userData || UserData.forOperatingSystem(imageConfig.osType); + this.userData = props.userData ?? imageConfig.userData; const userDataToken = Lazy.stringValue({ produce: () => Fn.base64(this.userData.render()) }); const securityGroupsToken = Lazy.listValue({ produce: () => this.securityGroups.map(sg => sg.securityGroupId) }); diff --git a/packages/@aws-cdk/aws-ec2/lib/machine-image.ts b/packages/@aws-cdk/aws-ec2/lib/machine-image.ts index c07a7051c68f3..8cdaded5a1626 100644 --- a/packages/@aws-cdk/aws-ec2/lib/machine-image.ts +++ b/packages/@aws-cdk/aws-ec2/lib/machine-image.ts @@ -97,10 +97,8 @@ export interface MachineImageConfig { /** * Initial UserData for this image - * - * @default - Default UserData appropriate for the osType is created */ - readonly userData?: UserData; + readonly userData: UserData; } /** @@ -139,7 +137,7 @@ export class WindowsImage implements IMachineImage { const ami = ssm.StringParameter.valueForTypedStringParameter(scope, parameterName, ssm.ParameterType.AWS_EC2_IMAGE_ID); return { imageId: ami, - userData: this.props.userData, + userData: this.props.userData ?? UserData.forWindows(), osType: OperatingSystemType.WINDOWS, }; } @@ -233,7 +231,7 @@ export class AmazonLinuxImage implements IMachineImage { return { imageId: ami, - userData: this.props.userData, + userData: this.props.userData ?? UserData.forLinux(), osType: OperatingSystemType.LINUX, }; } @@ -348,7 +346,7 @@ export class GenericLinuxImage implements IMachineImage { return { imageId: ami, - userData: this.props.userData, + userData: this.props.userData ?? UserData.forLinux(), osType: OperatingSystemType.LINUX, }; } @@ -376,7 +374,7 @@ export class GenericWindowsImage implements IMachineImage { return { imageId: ami, - userData: this.props.userData, + userData: this.props.userData ?? UserData.forWindows(), osType: OperatingSystemType.WINDOWS, }; } @@ -430,10 +428,12 @@ export class LookupMachineImage implements IMachineImage { throw new Error(`Response to AMI lookup invalid, got: ${value}`); } + const osType = this.props.windows ? OperatingSystemType.WINDOWS : OperatingSystemType.LINUX; + return { imageId: value, - osType: this.props.windows ? OperatingSystemType.WINDOWS : OperatingSystemType.LINUX, - userData: this.props.userData + osType, + userData: this.props.userData ?? UserData.forOperatingSystem(osType), }; } } diff --git a/packages/@aws-cdk/aws-ec2/package.json b/packages/@aws-cdk/aws-ec2/package.json index 240dc7ac08698..d41709148e84c 100644 --- a/packages/@aws-cdk/aws-ec2/package.json +++ b/packages/@aws-cdk/aws-ec2/package.json @@ -77,7 +77,8 @@ "@aws-cdk/aws-s3": "0.0.0", "@aws-cdk/aws-ssm": "0.0.0", "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0" + "@aws-cdk/cx-api": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { @@ -87,7 +88,8 @@ "@aws-cdk/aws-s3": "0.0.0", "@aws-cdk/aws-ssm": "0.0.0", "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0" + "@aws-cdk/cx-api": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-ec2/test/test.machine-image.ts b/packages/@aws-cdk/aws-ec2/test/test.machine-image.ts index 0a1e8570e9983..6970f7cab5c63 100644 --- a/packages/@aws-cdk/aws-ec2/test/test.machine-image.ts +++ b/packages/@aws-cdk/aws-ec2/test/test.machine-image.ts @@ -2,13 +2,19 @@ import { App, Stack } from '@aws-cdk/core'; import { Test } from 'nodeunit'; import * as ec2 from '../lib'; +let app: App; +let stack: Stack; + export = { - 'can make and use a Windows image'(test: Test) { - // GIVEN - const stack = new Stack(undefined, undefined, { - env: { region: 'testregion' } + 'setUp'(cb: () => void) { + app = new App(); + stack = new Stack(app, 'Stack', { + env: { account: '1234', region: 'testregion' } }); + cb(); + }, + 'can make and use a Windows image'(test: Test) { // WHEN const image = new ec2.GenericWindowsImage({ testregion: 'ami-1234' @@ -22,12 +28,7 @@ export = { test.done(); }, - 'WindowsImage retains userdata'(test: Test) { - // GIVEN - const stack = new Stack(undefined, undefined, { - env: { region: 'testregion' } - }); - + 'WindowsImage retains userdata if given'(test: Test) { // WHEN const ud = ec2.UserData.forWindows(); @@ -44,12 +45,21 @@ export = { test.done(); }, + 'WindowsImage creates UserData if not given'(test: Test) { + // WHEN + const image = new ec2.GenericWindowsImage({ + testregion: 'ami-1234', + }); + + // THEN + const details = image.getImage(stack); + test.ok(isWindowsUserData(details.userData)); + + test.done(); + }, + 'LookupMachineImage default search'(test: Test) { // GIVEN - const app = new App(); - const stack = new Stack(app, 'Stack', { - env: { account: '1234', region: 'testregion' } - }); // WHEN new ec2.LookupMachineImage({ name: 'bla*', owners: ['amazon'] }).getImage(stack); @@ -74,5 +84,24 @@ export = { ]); test.done(); - } + }, + + 'LookupMachineImage creates correct type of UserData'(test: Test) { + // WHEN + const linuxDetails = new ec2.LookupMachineImage({ name: 'bla*', owners: ['amazon'] }).getImage(stack); + const windowsDetails = new ec2.LookupMachineImage({ name: 'bla*', owners: ['amazon'], windows: true }).getImage(stack); + + // THEN + test.ok(isWindowsUserData(windowsDetails.userData)); + test.ok(isLinuxUserData(linuxDetails.userData)); + test.done(); + }, }; + +function isWindowsUserData(ud: ec2.UserData) { + return ud.render().indexOf('powershell') > -1; +} + +function isLinuxUserData(ud: ec2.UserData) { + return ud.render().indexOf('bash') > -1; +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecr-assets/package.json b/packages/@aws-cdk/aws-ecr-assets/package.json index a8e3a1b8e6fa1..ca11e9c91c70f 100644 --- a/packages/@aws-cdk/aws-ecr-assets/package.json +++ b/packages/@aws-cdk/aws-ecr-assets/package.json @@ -78,7 +78,8 @@ "@aws-cdk/aws-s3": "0.0.0", "@aws-cdk/core": "0.0.0", "@aws-cdk/cx-api": "0.0.0", - "minimatch": "^3.0.4" + "minimatch": "^3.0.4", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { @@ -89,7 +90,8 @@ "@aws-cdk/aws-lambda": "0.0.0", "@aws-cdk/aws-s3": "0.0.0", "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0" + "@aws-cdk/cx-api": "0.0.0", + "constructs": "^1.1.2" }, "nyc": { "statements": 70 diff --git a/packages/@aws-cdk/aws-ecr/package.json b/packages/@aws-cdk/aws-ecr/package.json index f89bfe9348f18..c7bb75f0faab9 100644 --- a/packages/@aws-cdk/aws-ecr/package.json +++ b/packages/@aws-cdk/aws-ecr/package.json @@ -77,13 +77,15 @@ "dependencies": { "@aws-cdk/aws-events": "0.0.0", "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { "@aws-cdk/aws-events": "0.0.0", "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-ecs-patterns/package.json b/packages/@aws-cdk/aws-ecs-patterns/package.json index 5311b7c9f7543..a169c76b9813e 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/package.json +++ b/packages/@aws-cdk/aws-ecs-patterns/package.json @@ -82,7 +82,8 @@ "@aws-cdk/aws-route53-targets": "0.0.0", "@aws-cdk/aws-servicediscovery": "0.0.0", "@aws-cdk/aws-sqs": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { @@ -98,7 +99,8 @@ "@aws-cdk/aws-route53-targets": "0.0.0", "@aws-cdk/aws-servicediscovery": "0.0.0", "@aws-cdk/aws-sqs": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-ecs/lib/cluster.ts b/packages/@aws-cdk/aws-ecs/lib/cluster.ts index cf7fc1877f1df..1b608f8cd3d46 100644 --- a/packages/@aws-cdk/aws-ecs/lib/cluster.ts +++ b/packages/@aws-cdk/aws-ecs/lib/cluster.ts @@ -378,9 +378,11 @@ export class EcsOptimizedAmi implements ec2.IMachineImage { */ public getImage(scope: Construct): ec2.MachineImageConfig { const ami = ssm.StringParameter.valueForTypedStringParameter(scope, this.amiParameterName, ssm.ParameterType.AWS_EC2_IMAGE_ID); + const osType = this.windowsVersion ? ec2.OperatingSystemType.WINDOWS : ec2.OperatingSystemType.LINUX; return { imageId: ami, - osType: this.windowsVersion ? ec2.OperatingSystemType.WINDOWS : ec2.OperatingSystemType.LINUX + osType, + userData: ec2.UserData.forOperatingSystem(osType), }; } } @@ -449,9 +451,11 @@ export class EcsOptimizedImage implements ec2.IMachineImage { */ public getImage(scope: Construct): ec2.MachineImageConfig { const ami = ssm.StringParameter.valueForTypedStringParameter(scope, this.amiParameterName, ssm.ParameterType.AWS_EC2_IMAGE_ID); + const osType = this.windowsVersion ? ec2.OperatingSystemType.WINDOWS : ec2.OperatingSystemType.LINUX; return { imageId: ami, - osType: this.windowsVersion ? ec2.OperatingSystemType.WINDOWS : ec2.OperatingSystemType.LINUX + osType, + userData: ec2.UserData.forOperatingSystem(osType), }; } } diff --git a/packages/@aws-cdk/aws-ecs/package.json b/packages/@aws-cdk/aws-ecs/package.json index 04760f9b47477..924755615f3b7 100644 --- a/packages/@aws-cdk/aws-ecs/package.json +++ b/packages/@aws-cdk/aws-ecs/package.json @@ -96,7 +96,8 @@ "@aws-cdk/aws-sqs": "0.0.0", "@aws-cdk/aws-ssm": "0.0.0", "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0" + "@aws-cdk/cx-api": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { @@ -122,7 +123,8 @@ "@aws-cdk/aws-sqs": "0.0.0", "@aws-cdk/aws-ssm": "0.0.0", "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0" + "@aws-cdk/cx-api": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-efs/package.json b/packages/@aws-cdk/aws-efs/package.json index 9c71b82dc5875..f57e1461156bf 100644 --- a/packages/@aws-cdk/aws-efs/package.json +++ b/packages/@aws-cdk/aws-efs/package.json @@ -88,14 +88,16 @@ "@aws-cdk/core": "0.0.0", "@aws-cdk/aws-ec2": "0.0.0", "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/cx-api": "0.0.0" + "@aws-cdk/cx-api": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { "@aws-cdk/core": "0.0.0", "@aws-cdk/aws-ec2": "0.0.0", "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/cx-api": "0.0.0" + "@aws-cdk/cx-api": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-eks-legacy/lib/cluster.ts b/packages/@aws-cdk/aws-eks-legacy/lib/cluster.ts index 4491aff79dfdd..ed0125c0a99b1 100644 --- a/packages/@aws-cdk/aws-eks-legacy/lib/cluster.ts +++ b/packages/@aws-cdk/aws-eks-legacy/lib/cluster.ts @@ -846,7 +846,8 @@ export class EksOptimizedImage implements ec2.IMachineImage { const ami = ssm.StringParameter.valueForStringParameter(scope, this.amiParameterName); return { imageId: ami, - osType: ec2.OperatingSystemType.LINUX + osType: ec2.OperatingSystemType.LINUX, + userData: ec2.UserData.forLinux(), }; } } diff --git a/packages/@aws-cdk/aws-eks-legacy/package.json b/packages/@aws-cdk/aws-eks-legacy/package.json index ede4c465d3206..3c7a9a639e092 100644 --- a/packages/@aws-cdk/aws-eks-legacy/package.json +++ b/packages/@aws-cdk/aws-eks-legacy/package.json @@ -77,7 +77,8 @@ "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-lambda": "0.0.0", "@aws-cdk/aws-ssm": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { @@ -87,7 +88,8 @@ "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-lambda": "0.0.0", "@aws-cdk/aws-ssm": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-eks/lib/cluster.ts b/packages/@aws-cdk/aws-eks/lib/cluster.ts index 2e7c250c1fb4c..1e22e47a335f8 100644 --- a/packages/@aws-cdk/aws-eks/lib/cluster.ts +++ b/packages/@aws-cdk/aws-eks/lib/cluster.ts @@ -896,7 +896,8 @@ export class EksOptimizedImage implements ec2.IMachineImage { const ami = ssm.StringParameter.valueForStringParameter(scope, this.amiParameterName); return { imageId: ami, - osType: ec2.OperatingSystemType.LINUX + osType: ec2.OperatingSystemType.LINUX, + userData: ec2.UserData.forLinux(), }; } } diff --git a/packages/@aws-cdk/aws-eks/package.json b/packages/@aws-cdk/aws-eks/package.json index 131429e422e53..2b8d7d024a951 100644 --- a/packages/@aws-cdk/aws-eks/package.json +++ b/packages/@aws-cdk/aws-eks/package.json @@ -80,7 +80,8 @@ "@aws-cdk/aws-lambda": "0.0.0", "@aws-cdk/aws-ssm": "0.0.0", "@aws-cdk/core": "0.0.0", - "@aws-cdk/custom-resources": "0.0.0" + "@aws-cdk/custom-resources": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { @@ -91,7 +92,8 @@ "@aws-cdk/aws-lambda": "0.0.0", "@aws-cdk/aws-ssm": "0.0.0", "@aws-cdk/core": "0.0.0", - "@aws-cdk/custom-resources": "0.0.0" + "@aws-cdk/custom-resources": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-elasticache/package.json b/packages/@aws-cdk/aws-elasticache/package.json index efda232fb1bb1..eec1f93c6f69c 100644 --- a/packages/@aws-cdk/aws-elasticache/package.json +++ b/packages/@aws-cdk/aws-elasticache/package.json @@ -85,11 +85,13 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-elasticbeanstalk/package.json b/packages/@aws-cdk/aws-elasticbeanstalk/package.json index 64827c5b90225..db1d6f47890f8 100644 --- a/packages/@aws-cdk/aws-elasticbeanstalk/package.json +++ b/packages/@aws-cdk/aws-elasticbeanstalk/package.json @@ -85,11 +85,13 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-elasticloadbalancing/package.json b/packages/@aws-cdk/aws-elasticloadbalancing/package.json index d5885636da648..8d248e18fa9ff 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancing/package.json +++ b/packages/@aws-cdk/aws-elasticloadbalancing/package.json @@ -72,12 +72,14 @@ }, "dependencies": { "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/package.json b/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/package.json index 2057dc0e1aba4..46ad5b72589c4 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/package.json +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/package.json @@ -89,7 +89,8 @@ "@aws-cdk/aws-elasticloadbalancingv2": "0.0.0", "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { @@ -98,7 +99,8 @@ "@aws-cdk/aws-elasticloadbalancingv2": "0.0.0", "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/package.json b/packages/@aws-cdk/aws-elasticloadbalancingv2/package.json index 9634ea4f514f1..09164a324b167 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/package.json +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2/package.json @@ -77,7 +77,8 @@ "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-lambda": "0.0.0", "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { @@ -87,7 +88,8 @@ "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-lambda": "0.0.0", "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-elasticsearch/package.json b/packages/@aws-cdk/aws-elasticsearch/package.json index 52384a64a310a..e36dab4f56ff2 100644 --- a/packages/@aws-cdk/aws-elasticsearch/package.json +++ b/packages/@aws-cdk/aws-elasticsearch/package.json @@ -85,11 +85,13 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-emr/package.json b/packages/@aws-cdk/aws-emr/package.json index 8f0530297a63d..53f841861f2ab 100644 --- a/packages/@aws-cdk/aws-emr/package.json +++ b/packages/@aws-cdk/aws-emr/package.json @@ -85,11 +85,13 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-events-targets/package.json b/packages/@aws-cdk/aws-events-targets/package.json index 28c78dc2ce8fa..ed77f9653b20d 100644 --- a/packages/@aws-cdk/aws-events-targets/package.json +++ b/packages/@aws-cdk/aws-events-targets/package.json @@ -106,7 +106,8 @@ "@aws-cdk/aws-sns-subscriptions": "0.0.0", "@aws-cdk/aws-sqs": "0.0.0", "@aws-cdk/aws-stepfunctions": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { @@ -122,7 +123,8 @@ "@aws-cdk/aws-sns-subscriptions": "0.0.0", "@aws-cdk/aws-sqs": "0.0.0", "@aws-cdk/aws-stepfunctions": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-events/package.json b/packages/@aws-cdk/aws-events/package.json index 1a207f65c0cdd..3985757665207 100644 --- a/packages/@aws-cdk/aws-events/package.json +++ b/packages/@aws-cdk/aws-events/package.json @@ -72,12 +72,14 @@ }, "dependencies": { "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-eventschemas/package.json b/packages/@aws-cdk/aws-eventschemas/package.json index bd3f583a6f68c..fcd5f8ed704ad 100644 --- a/packages/@aws-cdk/aws-eventschemas/package.json +++ b/packages/@aws-cdk/aws-eventschemas/package.json @@ -87,10 +87,12 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-fms/package.json b/packages/@aws-cdk/aws-fms/package.json index ae42986660cb5..acf83133fdef0 100644 --- a/packages/@aws-cdk/aws-fms/package.json +++ b/packages/@aws-cdk/aws-fms/package.json @@ -71,10 +71,12 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-fsx/package.json b/packages/@aws-cdk/aws-fsx/package.json index 7a1ac31b18b0e..f61c60bc0f70a 100644 --- a/packages/@aws-cdk/aws-fsx/package.json +++ b/packages/@aws-cdk/aws-fsx/package.json @@ -87,10 +87,12 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-gamelift/package.json b/packages/@aws-cdk/aws-gamelift/package.json index dce25f2c4896b..b6d598cec5712 100644 --- a/packages/@aws-cdk/aws-gamelift/package.json +++ b/packages/@aws-cdk/aws-gamelift/package.json @@ -85,11 +85,13 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-glue/package.json b/packages/@aws-cdk/aws-glue/package.json index b3c3dd08b13d9..c89e79fe1a6ab 100644 --- a/packages/@aws-cdk/aws-glue/package.json +++ b/packages/@aws-cdk/aws-glue/package.json @@ -74,14 +74,16 @@ "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-kms": "0.0.0", "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-kms": "0.0.0", "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-greengrass/package.json b/packages/@aws-cdk/aws-greengrass/package.json index c90cffebffd82..6814d1f8ba5ac 100644 --- a/packages/@aws-cdk/aws-greengrass/package.json +++ b/packages/@aws-cdk/aws-greengrass/package.json @@ -87,10 +87,12 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-guardduty/package.json b/packages/@aws-cdk/aws-guardduty/package.json index 9d57bdd608a72..91f8e2ae5a20b 100644 --- a/packages/@aws-cdk/aws-guardduty/package.json +++ b/packages/@aws-cdk/aws-guardduty/package.json @@ -85,11 +85,13 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-iam/package.json b/packages/@aws-cdk/aws-iam/package.json index c835261df8618..9ae5c9df291cf 100644 --- a/packages/@aws-cdk/aws-iam/package.json +++ b/packages/@aws-cdk/aws-iam/package.json @@ -73,11 +73,13 @@ }, "dependencies": { "@aws-cdk/core": "0.0.0", - "@aws-cdk/region-info": "0.0.0" + "@aws-cdk/region-info": "0.0.0", + "constructs": "^1.1.2" }, "peerDependencies": { "@aws-cdk/core": "0.0.0", - "@aws-cdk/region-info": "0.0.0" + "@aws-cdk/region-info": "0.0.0", + "constructs": "^1.1.2" }, "jest": { "moduleFileExtensions": [ diff --git a/packages/@aws-cdk/aws-inspector/package.json b/packages/@aws-cdk/aws-inspector/package.json index d9bf7450a6534..fb74115397b3c 100644 --- a/packages/@aws-cdk/aws-inspector/package.json +++ b/packages/@aws-cdk/aws-inspector/package.json @@ -85,11 +85,13 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-iot/package.json b/packages/@aws-cdk/aws-iot/package.json index d7e1cda88f754..02676b7bbe827 100644 --- a/packages/@aws-cdk/aws-iot/package.json +++ b/packages/@aws-cdk/aws-iot/package.json @@ -85,11 +85,13 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-iot1click/package.json b/packages/@aws-cdk/aws-iot1click/package.json index 667bc0b041e32..8c5139cd4c2ee 100644 --- a/packages/@aws-cdk/aws-iot1click/package.json +++ b/packages/@aws-cdk/aws-iot1click/package.json @@ -86,10 +86,12 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-iotanalytics/package.json b/packages/@aws-cdk/aws-iotanalytics/package.json index 3783016c618e7..8a72cc88ee316 100644 --- a/packages/@aws-cdk/aws-iotanalytics/package.json +++ b/packages/@aws-cdk/aws-iotanalytics/package.json @@ -87,10 +87,12 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-iotevents/package.json b/packages/@aws-cdk/aws-iotevents/package.json index a2e5bf56ecaaf..b9e159e7a5aa5 100644 --- a/packages/@aws-cdk/aws-iotevents/package.json +++ b/packages/@aws-cdk/aws-iotevents/package.json @@ -87,10 +87,12 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-iotthingsgraph/package.json b/packages/@aws-cdk/aws-iotthingsgraph/package.json index e835496c1260b..ab03e52c5e6f1 100644 --- a/packages/@aws-cdk/aws-iotthingsgraph/package.json +++ b/packages/@aws-cdk/aws-iotthingsgraph/package.json @@ -87,10 +87,12 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-kinesis/package.json b/packages/@aws-cdk/aws-kinesis/package.json index b28d7309bebcc..7d0794959a658 100644 --- a/packages/@aws-cdk/aws-kinesis/package.json +++ b/packages/@aws-cdk/aws-kinesis/package.json @@ -72,14 +72,16 @@ "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-kms": "0.0.0", "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-kms": "0.0.0", "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-kinesisanalytics/package.json b/packages/@aws-cdk/aws-kinesisanalytics/package.json index 975062827fdf8..b10a8f48e019e 100644 --- a/packages/@aws-cdk/aws-kinesisanalytics/package.json +++ b/packages/@aws-cdk/aws-kinesisanalytics/package.json @@ -88,11 +88,13 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-kinesisfirehose/package.json b/packages/@aws-cdk/aws-kinesisfirehose/package.json index 261a969439975..18300dba913c3 100644 --- a/packages/@aws-cdk/aws-kinesisfirehose/package.json +++ b/packages/@aws-cdk/aws-kinesisfirehose/package.json @@ -85,11 +85,13 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-kms/package.json b/packages/@aws-cdk/aws-kms/package.json index 14d54a9d13433..2c6372fc6e818 100644 --- a/packages/@aws-cdk/aws-kms/package.json +++ b/packages/@aws-cdk/aws-kms/package.json @@ -72,12 +72,14 @@ }, "dependencies": { "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-lakeformation/package.json b/packages/@aws-cdk/aws-lakeformation/package.json index ee302db305eac..a1948e9d70a1a 100644 --- a/packages/@aws-cdk/aws-lakeformation/package.json +++ b/packages/@aws-cdk/aws-lakeformation/package.json @@ -87,10 +87,12 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-lambda-destinations/package.json b/packages/@aws-cdk/aws-lambda-destinations/package.json index b3810afe0a43a..db41e6fc76773 100644 --- a/packages/@aws-cdk/aws-lambda-destinations/package.json +++ b/packages/@aws-cdk/aws-lambda-destinations/package.json @@ -89,7 +89,8 @@ "@aws-cdk/aws-lambda": "0.0.0", "@aws-cdk/aws-sns": "0.0.0", "@aws-cdk/aws-sqs": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { @@ -98,7 +99,8 @@ "@aws-cdk/aws-lambda": "0.0.0", "@aws-cdk/aws-sns": "0.0.0", "@aws-cdk/aws-sqs": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-lambda-event-sources/package.json b/packages/@aws-cdk/aws-lambda-event-sources/package.json index d91e822391edd..541517aa1c045 100644 --- a/packages/@aws-cdk/aws-lambda-event-sources/package.json +++ b/packages/@aws-cdk/aws-lambda-event-sources/package.json @@ -77,7 +77,8 @@ "@aws-cdk/aws-sns": "0.0.0", "@aws-cdk/aws-sns-subscriptions": "0.0.0", "@aws-cdk/aws-sqs": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { @@ -92,7 +93,8 @@ "@aws-cdk/aws-sns": "0.0.0", "@aws-cdk/aws-sns-subscriptions": "0.0.0", "@aws-cdk/aws-sqs": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-lambda-nodejs/package.json b/packages/@aws-cdk/aws-lambda-nodejs/package.json index f36b42a2b800f..f90cefb0181bd 100644 --- a/packages/@aws-cdk/aws-lambda-nodejs/package.json +++ b/packages/@aws-cdk/aws-lambda-nodejs/package.json @@ -93,12 +93,14 @@ }, "dependencies": { "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-lambda/package.json b/packages/@aws-cdk/aws-lambda/package.json index c445d81baf24a..83028cb4300c5 100644 --- a/packages/@aws-cdk/aws-lambda/package.json +++ b/packages/@aws-cdk/aws-lambda/package.json @@ -77,7 +77,7 @@ "cdk-integ-tools": "0.0.0", "cfn2ts": "0.0.0", "lodash": "^4.17.15", - "nock": "^12.0.2", + "nock": "^12.0.3", "nodeunit": "^0.11.3", "pkglint": "0.0.0", "sinon": "^9.0.1" @@ -92,7 +92,8 @@ "@aws-cdk/aws-s3-assets": "0.0.0", "@aws-cdk/aws-sqs": "0.0.0", "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0" + "@aws-cdk/cx-api": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { @@ -105,7 +106,8 @@ "@aws-cdk/aws-s3-assets": "0.0.0", "@aws-cdk/aws-sqs": "0.0.0", "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0" + "@aws-cdk/cx-api": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-logs-destinations/package.json b/packages/@aws-cdk/aws-logs-destinations/package.json index 64fa576b585d9..c42cdfa6f31d2 100644 --- a/packages/@aws-cdk/aws-logs-destinations/package.json +++ b/packages/@aws-cdk/aws-logs-destinations/package.json @@ -88,7 +88,8 @@ "@aws-cdk/aws-kinesis": "0.0.0", "@aws-cdk/aws-lambda": "0.0.0", "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { @@ -96,7 +97,8 @@ "@aws-cdk/aws-kinesis": "0.0.0", "@aws-cdk/aws-lambda": "0.0.0", "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-logs/package.json b/packages/@aws-cdk/aws-logs/package.json index 9d664782dad0c..d4921b22ee27d 100644 --- a/packages/@aws-cdk/aws-logs/package.json +++ b/packages/@aws-cdk/aws-logs/package.json @@ -73,13 +73,15 @@ "dependencies": { "@aws-cdk/aws-cloudwatch": "0.0.0", "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { "@aws-cdk/aws-cloudwatch": "0.0.0", "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-managedblockchain/package.json b/packages/@aws-cdk/aws-managedblockchain/package.json index 8c35afb0ba185..9ed523d3e6ca6 100644 --- a/packages/@aws-cdk/aws-managedblockchain/package.json +++ b/packages/@aws-cdk/aws-managedblockchain/package.json @@ -87,10 +87,12 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-mediaconvert/package.json b/packages/@aws-cdk/aws-mediaconvert/package.json index de2577e27d8c7..f064863048544 100644 --- a/packages/@aws-cdk/aws-mediaconvert/package.json +++ b/packages/@aws-cdk/aws-mediaconvert/package.json @@ -87,10 +87,12 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-medialive/package.json b/packages/@aws-cdk/aws-medialive/package.json index 8ed260c015621..7a2037d46322f 100644 --- a/packages/@aws-cdk/aws-medialive/package.json +++ b/packages/@aws-cdk/aws-medialive/package.json @@ -87,10 +87,12 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-mediastore/package.json b/packages/@aws-cdk/aws-mediastore/package.json index 5a2ce94195e1e..d12c577b06d50 100644 --- a/packages/@aws-cdk/aws-mediastore/package.json +++ b/packages/@aws-cdk/aws-mediastore/package.json @@ -87,10 +87,12 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-msk/package.json b/packages/@aws-cdk/aws-msk/package.json index 23fd7f7edc3d5..664fcab0c9933 100644 --- a/packages/@aws-cdk/aws-msk/package.json +++ b/packages/@aws-cdk/aws-msk/package.json @@ -87,10 +87,12 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-neptune/package.json b/packages/@aws-cdk/aws-neptune/package.json index 578e89072d3ef..062620c80bcc9 100644 --- a/packages/@aws-cdk/aws-neptune/package.json +++ b/packages/@aws-cdk/aws-neptune/package.json @@ -86,10 +86,12 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-opsworks/package.json b/packages/@aws-cdk/aws-opsworks/package.json index d7c5546b22f24..166e28e16e3c6 100644 --- a/packages/@aws-cdk/aws-opsworks/package.json +++ b/packages/@aws-cdk/aws-opsworks/package.json @@ -85,11 +85,13 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-opsworkscm/package.json b/packages/@aws-cdk/aws-opsworkscm/package.json index 30afebc3cf2bc..b761413a52569 100644 --- a/packages/@aws-cdk/aws-opsworkscm/package.json +++ b/packages/@aws-cdk/aws-opsworkscm/package.json @@ -87,10 +87,12 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-pinpoint/package.json b/packages/@aws-cdk/aws-pinpoint/package.json index 76a4ef5e609b3..de52bdc5c0fdb 100644 --- a/packages/@aws-cdk/aws-pinpoint/package.json +++ b/packages/@aws-cdk/aws-pinpoint/package.json @@ -87,10 +87,12 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-pinpointemail/package.json b/packages/@aws-cdk/aws-pinpointemail/package.json index 3d296354db435..5bf807d9f3c9d 100644 --- a/packages/@aws-cdk/aws-pinpointemail/package.json +++ b/packages/@aws-cdk/aws-pinpointemail/package.json @@ -87,10 +87,12 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-qldb/package.json b/packages/@aws-cdk/aws-qldb/package.json index eb62ce3aa9c48..d51e664860609 100644 --- a/packages/@aws-cdk/aws-qldb/package.json +++ b/packages/@aws-cdk/aws-qldb/package.json @@ -87,10 +87,12 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-ram/package.json b/packages/@aws-cdk/aws-ram/package.json index abc7ec647d28c..2f95f4e302f73 100644 --- a/packages/@aws-cdk/aws-ram/package.json +++ b/packages/@aws-cdk/aws-ram/package.json @@ -87,10 +87,12 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-rds/package.json b/packages/@aws-cdk/aws-rds/package.json index 57197b466e78f..b1d67f53fec4a 100644 --- a/packages/@aws-cdk/aws-rds/package.json +++ b/packages/@aws-cdk/aws-rds/package.json @@ -80,7 +80,8 @@ "@aws-cdk/aws-lambda": "0.0.0", "@aws-cdk/aws-logs": "0.0.0", "@aws-cdk/aws-secretsmanager": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { @@ -92,7 +93,8 @@ "@aws-cdk/aws-lambda": "0.0.0", "@aws-cdk/aws-logs": "0.0.0", "@aws-cdk/aws-secretsmanager": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-redshift/package.json b/packages/@aws-cdk/aws-redshift/package.json index 89007c1427f58..a3770c4f258cc 100644 --- a/packages/@aws-cdk/aws-redshift/package.json +++ b/packages/@aws-cdk/aws-redshift/package.json @@ -85,11 +85,13 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-robomaker/package.json b/packages/@aws-cdk/aws-robomaker/package.json index 7063eb3fc4074..86813d3de7405 100644 --- a/packages/@aws-cdk/aws-robomaker/package.json +++ b/packages/@aws-cdk/aws-robomaker/package.json @@ -87,10 +87,12 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-route53-patterns/package.json b/packages/@aws-cdk/aws-route53-patterns/package.json index 8654c54b32f38..955ab4e4148ca 100644 --- a/packages/@aws-cdk/aws-route53-patterns/package.json +++ b/packages/@aws-cdk/aws-route53-patterns/package.json @@ -91,7 +91,8 @@ "@aws-cdk/aws-route53-targets": "0.0.0", "@aws-cdk/aws-s3": "0.0.0", "@aws-cdk/core": "0.0.0", - "@aws-cdk/region-info": "0.0.0" + "@aws-cdk/region-info": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { @@ -102,7 +103,8 @@ "@aws-cdk/aws-route53-targets": "0.0.0", "@aws-cdk/aws-s3": "0.0.0", "@aws-cdk/core": "0.0.0", - "@aws-cdk/region-info": "0.0.0" + "@aws-cdk/region-info": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-route53-targets/package.json b/packages/@aws-cdk/aws-route53-targets/package.json index 142624e1ed124..ab21497db133a 100644 --- a/packages/@aws-cdk/aws-route53-targets/package.json +++ b/packages/@aws-cdk/aws-route53-targets/package.json @@ -95,7 +95,8 @@ "@aws-cdk/aws-route53": "0.0.0", "@aws-cdk/aws-s3": "0.0.0", "@aws-cdk/core": "0.0.0", - "@aws-cdk/region-info": "0.0.0" + "@aws-cdk/region-info": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { @@ -108,7 +109,8 @@ "@aws-cdk/aws-route53": "0.0.0", "@aws-cdk/aws-s3": "0.0.0", "@aws-cdk/core": "0.0.0", - "@aws-cdk/region-info": "0.0.0" + "@aws-cdk/region-info": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-route53/package.json b/packages/@aws-cdk/aws-route53/package.json index 19c62197bc85c..4fe47795a0bd1 100644 --- a/packages/@aws-cdk/aws-route53/package.json +++ b/packages/@aws-cdk/aws-route53/package.json @@ -75,14 +75,16 @@ "@aws-cdk/aws-ec2": "0.0.0", "@aws-cdk/aws-logs": "0.0.0", "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0" + "@aws-cdk/cx-api": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { "@aws-cdk/aws-ec2": "0.0.0", "@aws-cdk/aws-logs": "0.0.0", "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0" + "@aws-cdk/cx-api": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-route53resolver/package.json b/packages/@aws-cdk/aws-route53resolver/package.json index 77572a18fa207..b782084c9eb10 100644 --- a/packages/@aws-cdk/aws-route53resolver/package.json +++ b/packages/@aws-cdk/aws-route53resolver/package.json @@ -86,10 +86,12 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-s3-assets/package.json b/packages/@aws-cdk/aws-s3-assets/package.json index 6aae9b41c654d..5192d2a746dfa 100644 --- a/packages/@aws-cdk/aws-s3-assets/package.json +++ b/packages/@aws-cdk/aws-s3-assets/package.json @@ -75,7 +75,8 @@ "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-s3": "0.0.0", "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0" + "@aws-cdk/cx-api": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { @@ -83,7 +84,8 @@ "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-s3": "0.0.0", "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0" + "@aws-cdk/cx-api": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-s3-deployment/package.json b/packages/@aws-cdk/aws-s3-deployment/package.json index ff25556a8c4ac..8f3e568845fcf 100644 --- a/packages/@aws-cdk/aws-s3-deployment/package.json +++ b/packages/@aws-cdk/aws-s3-deployment/package.json @@ -90,7 +90,8 @@ "@aws-cdk/aws-lambda": "0.0.0", "@aws-cdk/aws-s3": "0.0.0", "@aws-cdk/aws-s3-assets": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { @@ -100,7 +101,8 @@ "@aws-cdk/aws-lambda": "0.0.0", "@aws-cdk/aws-s3": "0.0.0", "@aws-cdk/aws-s3-assets": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-s3-notifications/package.json b/packages/@aws-cdk/aws-s3-notifications/package.json index 6380de3039d41..29c6ca5a76d83 100644 --- a/packages/@aws-cdk/aws-s3-notifications/package.json +++ b/packages/@aws-cdk/aws-s3-notifications/package.json @@ -87,7 +87,8 @@ "@aws-cdk/aws-s3": "0.0.0", "@aws-cdk/aws-sns": "0.0.0", "@aws-cdk/aws-sqs": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { @@ -96,7 +97,8 @@ "@aws-cdk/aws-s3": "0.0.0", "@aws-cdk/aws-sns": "0.0.0", "@aws-cdk/aws-sqs": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-s3/package.json b/packages/@aws-cdk/aws-s3/package.json index b6f8f9bc9fe75..eed9863ba2fb9 100644 --- a/packages/@aws-cdk/aws-s3/package.json +++ b/packages/@aws-cdk/aws-s3/package.json @@ -74,14 +74,16 @@ "@aws-cdk/aws-events": "0.0.0", "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { "@aws-cdk/aws-events": "0.0.0", "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-sagemaker/package.json b/packages/@aws-cdk/aws-sagemaker/package.json index e47d7dc1a176c..d2573988d1efd 100644 --- a/packages/@aws-cdk/aws-sagemaker/package.json +++ b/packages/@aws-cdk/aws-sagemaker/package.json @@ -86,10 +86,12 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-sam/package.json b/packages/@aws-cdk/aws-sam/package.json index 197d98acb19f4..a2c0275ba2b82 100644 --- a/packages/@aws-cdk/aws-sam/package.json +++ b/packages/@aws-cdk/aws-sam/package.json @@ -72,10 +72,12 @@ "ts-jest": "^25.2.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "jest": {}, "engines": { diff --git a/packages/@aws-cdk/aws-sdb/package.json b/packages/@aws-cdk/aws-sdb/package.json index 4c3d1493ed401..85c8cec6a0d7c 100644 --- a/packages/@aws-cdk/aws-sdb/package.json +++ b/packages/@aws-cdk/aws-sdb/package.json @@ -85,11 +85,13 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-secretsmanager/package.json b/packages/@aws-cdk/aws-secretsmanager/package.json index 7363dd6d85ad5..a56213a17bad3 100644 --- a/packages/@aws-cdk/aws-secretsmanager/package.json +++ b/packages/@aws-cdk/aws-secretsmanager/package.json @@ -77,7 +77,8 @@ "@aws-cdk/aws-kms": "0.0.0", "@aws-cdk/aws-lambda": "0.0.0", "@aws-cdk/aws-sam": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "peerDependencies": { "@aws-cdk/aws-ec2": "0.0.0", @@ -85,7 +86,8 @@ "@aws-cdk/aws-kms": "0.0.0", "@aws-cdk/aws-lambda": "0.0.0", "@aws-cdk/aws-sam": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-securityhub/package.json b/packages/@aws-cdk/aws-securityhub/package.json index 67a328421121d..85bc568ec6483 100644 --- a/packages/@aws-cdk/aws-securityhub/package.json +++ b/packages/@aws-cdk/aws-securityhub/package.json @@ -87,10 +87,12 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-servicecatalog/package.json b/packages/@aws-cdk/aws-servicecatalog/package.json index 5b0f74640782e..bbecc451762e1 100644 --- a/packages/@aws-cdk/aws-servicecatalog/package.json +++ b/packages/@aws-cdk/aws-servicecatalog/package.json @@ -85,11 +85,13 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-servicediscovery/package.json b/packages/@aws-cdk/aws-servicediscovery/package.json index faaa82bd5557a..43e23a8359e4d 100644 --- a/packages/@aws-cdk/aws-servicediscovery/package.json +++ b/packages/@aws-cdk/aws-servicediscovery/package.json @@ -74,14 +74,16 @@ "@aws-cdk/aws-ec2": "0.0.0", "@aws-cdk/aws-elasticloadbalancingv2": "0.0.0", "@aws-cdk/aws-route53": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { "@aws-cdk/aws-ec2": "0.0.0", "@aws-cdk/aws-elasticloadbalancingv2": "0.0.0", "@aws-cdk/aws-route53": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-ses-actions/package.json b/packages/@aws-cdk/aws-ses-actions/package.json index 5468d8df17695..5bd444f705d67 100644 --- a/packages/@aws-cdk/aws-ses-actions/package.json +++ b/packages/@aws-cdk/aws-ses-actions/package.json @@ -91,7 +91,8 @@ "@aws-cdk/aws-s3": "0.0.0", "@aws-cdk/aws-ses": "0.0.0", "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { @@ -101,7 +102,8 @@ "@aws-cdk/aws-s3": "0.0.0", "@aws-cdk/aws-ses": "0.0.0", "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-ses/package.json b/packages/@aws-cdk/aws-ses/package.json index 997f20271adff..17b8687e46442 100644 --- a/packages/@aws-cdk/aws-ses/package.json +++ b/packages/@aws-cdk/aws-ses/package.json @@ -73,13 +73,15 @@ "dependencies": { "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-sns-subscriptions/package.json b/packages/@aws-cdk/aws-sns-subscriptions/package.json index b7713c26010dd..3d03b4f7d688f 100644 --- a/packages/@aws-cdk/aws-sns-subscriptions/package.json +++ b/packages/@aws-cdk/aws-sns-subscriptions/package.json @@ -88,7 +88,8 @@ "@aws-cdk/aws-lambda": "0.0.0", "@aws-cdk/aws-sns": "0.0.0", "@aws-cdk/aws-sqs": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { @@ -96,7 +97,8 @@ "@aws-cdk/aws-lambda": "0.0.0", "@aws-cdk/aws-sns": "0.0.0", "@aws-cdk/aws-sqs": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-sns/package.json b/packages/@aws-cdk/aws-sns/package.json index a737a4b675493..ebf17f4d664da 100644 --- a/packages/@aws-cdk/aws-sns/package.json +++ b/packages/@aws-cdk/aws-sns/package.json @@ -79,7 +79,8 @@ "@aws-cdk/aws-events": "0.0.0", "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { @@ -87,7 +88,8 @@ "@aws-cdk/aws-events": "0.0.0", "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-sqs/package.json b/packages/@aws-cdk/aws-sqs/package.json index 6db263c265630..46fd5d3b2341d 100644 --- a/packages/@aws-cdk/aws-sqs/package.json +++ b/packages/@aws-cdk/aws-sqs/package.json @@ -76,14 +76,16 @@ "@aws-cdk/aws-cloudwatch": "0.0.0", "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { "@aws-cdk/aws-cloudwatch": "0.0.0", "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-ssm/package.json b/packages/@aws-cdk/aws-ssm/package.json index b014210edeb0d..6111fcd08100d 100644 --- a/packages/@aws-cdk/aws-ssm/package.json +++ b/packages/@aws-cdk/aws-ssm/package.json @@ -74,14 +74,16 @@ "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-kms": "0.0.0", "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0" + "@aws-cdk/cx-api": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { "@aws-cdk/aws-iam": "0.0.0", "@aws-cdk/aws-kms": "0.0.0", "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0" + "@aws-cdk/cx-api": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/package.json b/packages/@aws-cdk/aws-stepfunctions-tasks/package.json index 466b62e54e6d2..f8b3cecdb6e22 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/package.json +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/package.json @@ -102,7 +102,8 @@ "@aws-cdk/aws-sns": "0.0.0", "@aws-cdk/aws-sqs": "0.0.0", "@aws-cdk/aws-stepfunctions": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { @@ -121,14 +122,14 @@ "@aws-cdk/aws-sns": "0.0.0", "@aws-cdk/aws-sqs": "0.0.0", "@aws-cdk/aws-stepfunctions": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" }, "stability": "experimental", "awslint": { - "exclude": [ - ] + "exclude": [] } } diff --git a/packages/@aws-cdk/aws-stepfunctions/package.json b/packages/@aws-cdk/aws-stepfunctions/package.json index 6bd5abcb60006..ad092c8f65d8b 100644 --- a/packages/@aws-cdk/aws-stepfunctions/package.json +++ b/packages/@aws-cdk/aws-stepfunctions/package.json @@ -74,14 +74,16 @@ "@aws-cdk/aws-cloudwatch": "0.0.0", "@aws-cdk/aws-events": "0.0.0", "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { "@aws-cdk/aws-cloudwatch": "0.0.0", "@aws-cdk/aws-events": "0.0.0", "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-transfer/package.json b/packages/@aws-cdk/aws-transfer/package.json index d26d217f98b42..1d5d069feba8b 100644 --- a/packages/@aws-cdk/aws-transfer/package.json +++ b/packages/@aws-cdk/aws-transfer/package.json @@ -87,10 +87,12 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-waf/package.json b/packages/@aws-cdk/aws-waf/package.json index 9c90689d682c2..f38f4a056553d 100644 --- a/packages/@aws-cdk/aws-waf/package.json +++ b/packages/@aws-cdk/aws-waf/package.json @@ -85,11 +85,13 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-wafregional/package.json b/packages/@aws-cdk/aws-wafregional/package.json index 779baff57e884..7cd59e6a2c2ce 100644 --- a/packages/@aws-cdk/aws-wafregional/package.json +++ b/packages/@aws-cdk/aws-wafregional/package.json @@ -85,11 +85,13 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-wafv2/package.json b/packages/@aws-cdk/aws-wafv2/package.json index a6f4dda8e8ba7..017552814964c 100644 --- a/packages/@aws-cdk/aws-wafv2/package.json +++ b/packages/@aws-cdk/aws-wafv2/package.json @@ -87,10 +87,12 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/aws-workspaces/package.json b/packages/@aws-cdk/aws-workspaces/package.json index 86fc88d4c395a..3c3ffdc875b7a 100644 --- a/packages/@aws-cdk/aws-workspaces/package.json +++ b/packages/@aws-cdk/aws-workspaces/package.json @@ -85,11 +85,13 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/core/lib/app.ts b/packages/@aws-cdk/core/lib/app.ts index b03b07a5d5fc6..619ecc19a20da 100644 --- a/packages/@aws-cdk/core/lib/app.ts +++ b/packages/@aws-cdk/core/lib/app.ts @@ -1,5 +1,5 @@ import * as cxapi from '@aws-cdk/cx-api'; -import { Construct, ConstructNode } from './construct'; +import { Construct, ConstructNode } from './construct-compat'; import { collectRuntimeInformation } from './private/runtime-info'; import { TreeMetadata } from './private/tree-metadata'; diff --git a/packages/@aws-cdk/core/lib/aspect.ts b/packages/@aws-cdk/core/lib/aspect.ts index c6382e132cfdf..17534e2139f0f 100644 --- a/packages/@aws-cdk/core/lib/aspect.ts +++ b/packages/@aws-cdk/core/lib/aspect.ts @@ -1,4 +1,4 @@ -import { IConstruct } from './construct'; +import { IConstruct } from './construct-compat'; /** * Represents an Aspect diff --git a/packages/@aws-cdk/core/lib/cfn-condition.ts b/packages/@aws-cdk/core/lib/cfn-condition.ts index 492bd2dbc0e3c..75e55f184cbfc 100644 --- a/packages/@aws-cdk/core/lib/cfn-condition.ts +++ b/packages/@aws-cdk/core/lib/cfn-condition.ts @@ -1,5 +1,5 @@ import { CfnElement } from './cfn-element'; -import { Construct } from './construct'; +import { Construct } from './construct-compat'; import { IResolvable, IResolveContext } from './resolvable'; export interface CfnConditionProps { diff --git a/packages/@aws-cdk/core/lib/cfn-element.ts b/packages/@aws-cdk/core/lib/cfn-element.ts index 1a01c42febf0c..c423380c2766f 100644 --- a/packages/@aws-cdk/core/lib/cfn-element.ts +++ b/packages/@aws-cdk/core/lib/cfn-element.ts @@ -1,5 +1,5 @@ import * as cxapi from '@aws-cdk/cx-api'; -import { Construct } from "./construct"; +import { Construct } from "./construct-compat"; import { Lazy } from "./lazy"; import { Token } from './token'; diff --git a/packages/@aws-cdk/core/lib/cfn-include.ts b/packages/@aws-cdk/core/lib/cfn-include.ts index 5bc3662ec04bc..61f70072f47a6 100644 --- a/packages/@aws-cdk/core/lib/cfn-include.ts +++ b/packages/@aws-cdk/core/lib/cfn-include.ts @@ -1,5 +1,5 @@ import { CfnElement } from './cfn-element'; -import { Construct } from './construct'; +import { Construct } from './construct-compat'; export interface CfnIncludeProps { /** diff --git a/packages/@aws-cdk/core/lib/cfn-mapping.ts b/packages/@aws-cdk/core/lib/cfn-mapping.ts index cdafb76ddb27e..56949342d32ca 100644 --- a/packages/@aws-cdk/core/lib/cfn-mapping.ts +++ b/packages/@aws-cdk/core/lib/cfn-mapping.ts @@ -1,6 +1,6 @@ import { CfnRefElement } from './cfn-element'; import { Fn } from './cfn-fn'; -import { Construct } from './construct'; +import { Construct } from './construct-compat'; import { Token } from './token'; export interface CfnMappingProps { diff --git a/packages/@aws-cdk/core/lib/cfn-output.ts b/packages/@aws-cdk/core/lib/cfn-output.ts index ecc8fd03bb7bb..606e6fcebab03 100644 --- a/packages/@aws-cdk/core/lib/cfn-output.ts +++ b/packages/@aws-cdk/core/lib/cfn-output.ts @@ -1,5 +1,5 @@ import { CfnElement } from './cfn-element'; -import { Construct } from './construct'; +import { Construct } from './construct-compat'; export interface CfnOutputProps { /** diff --git a/packages/@aws-cdk/core/lib/cfn-parameter.ts b/packages/@aws-cdk/core/lib/cfn-parameter.ts index 51359fd4fb434..12854250794a8 100644 --- a/packages/@aws-cdk/core/lib/cfn-parameter.ts +++ b/packages/@aws-cdk/core/lib/cfn-parameter.ts @@ -1,5 +1,5 @@ import { CfnElement } from './cfn-element'; -import { Construct } from './construct'; +import { Construct } from './construct-compat'; import { CfnReference } from './private/cfn-reference'; import { IResolvable, IResolveContext } from './resolvable'; import { Token } from './token'; diff --git a/packages/@aws-cdk/core/lib/cfn-pseudo.ts b/packages/@aws-cdk/core/lib/cfn-pseudo.ts index 4326a1ab7eec5..be824c172f124 100644 --- a/packages/@aws-cdk/core/lib/cfn-pseudo.ts +++ b/packages/@aws-cdk/core/lib/cfn-pseudo.ts @@ -1,4 +1,4 @@ -import { Construct } from './construct'; +import { Construct } from './construct-compat'; import { CfnReference } from './private/cfn-reference'; import { Token } from './token'; diff --git a/packages/@aws-cdk/core/lib/cfn-resource.ts b/packages/@aws-cdk/core/lib/cfn-resource.ts index 97cbd26a72bad..3a8eb02d0cdb0 100644 --- a/packages/@aws-cdk/core/lib/cfn-resource.ts +++ b/packages/@aws-cdk/core/lib/cfn-resource.ts @@ -4,7 +4,7 @@ import { CfnCondition } from './cfn-condition'; // tslint:disable-next-line:ordered-imports import { CfnRefElement } from './cfn-element'; import { CfnCreationPolicy, CfnDeletionPolicy, CfnUpdatePolicy } from './cfn-resource-policy'; -import { Construct, IConstruct } from './construct'; +import { Construct, IConstruct } from './construct-compat'; import { addDependency } from './deps'; import { CfnReference } from './private/cfn-reference'; import { Reference } from './reference'; diff --git a/packages/@aws-cdk/core/lib/cfn-rule.ts b/packages/@aws-cdk/core/lib/cfn-rule.ts index 9ce9417eff7e9..83c8d40c8fba2 100644 --- a/packages/@aws-cdk/core/lib/cfn-rule.ts +++ b/packages/@aws-cdk/core/lib/cfn-rule.ts @@ -1,6 +1,6 @@ import { ICfnConditionExpression } from './cfn-condition'; import { CfnRefElement } from './cfn-element'; -import { Construct } from './construct'; +import { Construct } from './construct-compat'; import { capitalizePropertyNames } from './util'; /** diff --git a/packages/@aws-cdk/core/lib/construct-compat.ts b/packages/@aws-cdk/core/lib/construct-compat.ts new file mode 100644 index 0000000000000..4b64b1a6bcc15 --- /dev/null +++ b/packages/@aws-cdk/core/lib/construct-compat.ts @@ -0,0 +1,493 @@ +/** + * Constructs compatibility layer. + * + * This file includes types that shadow types in the "constructs" module in + * order to allow backwards-compatiblity in the AWS CDK v1.0 release line. + * + * There are pretty ugly hacks here, which mostly involve downcasting types to + * adhere to legacy AWS CDK APIs. + * + * This file, in its entirety, is expected to be removed in v2.0. + */ + +import * as cxapi from '@aws-cdk/cx-api'; +import * as constructs from 'constructs'; +import { IAspect } from './aspect'; +import { IDependable } from './dependency'; + +const ORIGINAL_CONSTRUCT_NODE_SYMBOL = Symbol.for('@aws-cdk/core.ConstructNode'); +const CONSTRUCT_SYMBOL = Symbol.for('@aws-cdk/core.Construct'); + +/** + * Represents a construct. + */ +export interface IConstruct extends constructs.IConstruct { + /** + * The construct tree node for this construct. + */ + readonly node: ConstructNode; +} + +/** + * Represents a single session of synthesis. Passed into `Construct.synthesize()` methods. + */ +export interface ISynthesisSession { + /** + * The output directory for this synthesis session. + */ + outdir: string; + + /** + * Cloud assembly builder. + */ + assembly: cxapi.CloudAssemblyBuilder; +} + +/** + * Represents the building block of the construct graph. + * + * All constructs besides the root construct must be created within the scope of + * another construct. + */ +export class Construct extends constructs.Construct implements IConstruct { + /** + * Return whether the given object is a Construct + */ + public static isConstruct(x: any): x is Construct { + return typeof x === 'object' && x !== null && CONSTRUCT_SYMBOL in x; + } + + /** + * The construct tree node associated with this construct. + */ + public readonly node: ConstructNode; + + constructor(scope: Construct, id: string) { + super(scope, id, { + nodeFactory: { + createNode: (h: constructs.Construct, s: constructs.IConstruct, i: string) => + new ConstructNode(h as Construct, s as IConstruct, i)._actualNode + } + }); + + Object.defineProperty(this, CONSTRUCT_SYMBOL, { value: true }); + this.node = ConstructNode._unwrap(constructs.Node.of(this)); + + const disableTrace = this.node.tryGetContext(cxapi.DISABLE_METADATA_STACK_TRACE); + if (disableTrace) { + this.node.setContext(constructs.ConstructMetadata.DISABLE_STACK_TRACE_IN_METADATA, true); + } + } + + /** + * Validate the current construct. + * + * This method can be implemented by derived constructs in order to perform + * validation logic. It is called on all constructs before synthesis. + * + * @returns An array of validation error messages, or an empty array if there the construct is valid. + */ + protected onValidate(): string[] { + return this.validate(); + } + + /** + * Perform final modifications before synthesis + * + * This method can be implemented by derived constructs in order to perform + * final changes before synthesis. prepare() will be called after child + * constructs have been prepared. + * + * This is an advanced framework feature. Only use this if you + * understand the implications. + */ + protected onPrepare(): void { + this.prepare(); + } + + /** + * Allows this construct to emit artifacts into the cloud assembly during synthesis. + * + * This method is usually implemented by framework-level constructs such as `Stack` and `Asset` + * as they participate in synthesizing the cloud assembly. + * + * @param session The synthesis session. + */ + protected onSynthesize(session: constructs.ISynthesisSession): void { + this.synthesize({ + outdir: session.outdir, + assembly: session.assembly! + }); + } + + /** + * Validate the current construct. + * + * This method can be implemented by derived constructs in order to perform + * validation logic. It is called on all constructs before synthesis. + * + * @returns An array of validation error messages, or an empty array if there the construct is valid. + */ + protected validate(): string[] { + return []; + } + + /** + * Perform final modifications before synthesis + * + * This method can be implemented by derived constructs in order to perform + * final changes before synthesis. prepare() will be called after child + * constructs have been prepared. + * + * This is an advanced framework feature. Only use this if you + * understand the implications. + */ + protected prepare(): void { + return; + } + + /** + * Allows this construct to emit artifacts into the cloud assembly during synthesis. + * + * This method is usually implemented by framework-level constructs such as `Stack` and `Asset` + * as they participate in synthesizing the cloud assembly. + * + * @param session The synthesis session. + */ + protected synthesize(session: ISynthesisSession): void { + ignore(session); + } +} + +/** + * In what order to return constructs + */ +export enum ConstructOrder { + /** + * Depth-first, pre-order + */ + PREORDER, + + /** + * Depth-first, post-order (leaf nodes first) + */ + POSTORDER +} + +/** + * Options for synthesis. + */ +export interface SynthesisOptions extends cxapi.AssemblyBuildOptions { + /** + * The output directory into which to synthesize the cloud assembly. + * @default - creates a temporary directory + */ + readonly outdir?: string; + + /** + * Whether synthesis should skip the validation phase. + * @default false + */ + readonly skipValidation?: boolean; +} + +/** + * Represents the construct node in the scope tree. + */ +export class ConstructNode { + /** + * Separator used to delimit construct path components. + */ + public static readonly PATH_SEP = '/'; + + /** + * Returns the wrapping `@aws-cdk/core.ConstructNode` instance from a `constructs.ConstructNode`. + * + * @internal + */ + public static _unwrap(c: constructs.Node): ConstructNode { + const x = (c as any)[ORIGINAL_CONSTRUCT_NODE_SYMBOL]; + if (!x) { + throw new Error(`invalid ConstructNode type`); + } + + return x; + } + + /** + * Synthesizes a CloudAssembly from a construct tree. + * @param root The root of the construct tree. + * @param options Synthesis options. + */ + public static synth(root: ConstructNode, options: SynthesisOptions = { }): cxapi.CloudAssembly { + const builder = new cxapi.CloudAssemblyBuilder(options.outdir); + + root._actualNode.synthesize({ + outdir: builder.outdir, + skipValidation: options.skipValidation, + sessionContext: { + assembly: builder + } + }); + + return builder.buildAssembly(options); + } + + /** + * Invokes "prepare" on all constructs (depth-first, post-order) in the tree under `node`. + * @param node The root node + */ + public static prepare(node: ConstructNode) { + return node._actualNode.prepare(); + } + + /** + * Invokes "validate" on all constructs in the tree (depth-first, pre-order) and returns + * the list of all errors. An empty list indicates that there are no errors. + * + * @param node The root node + */ + public static validate(node: ConstructNode): ValidationError[] { + return node._actualNode.validate().map(e => ({ source: e.source as Construct, message: e.message })); + } + + /** + * @internal + */ + public readonly _actualNode: constructs.Node; + + constructor(host: Construct, scope: IConstruct, id: string) { + this._actualNode = new constructs.Node(host, scope, id); + + // store a back reference on _actualNode so we can our ConstructNode from it + Object.defineProperty(this._actualNode, ORIGINAL_CONSTRUCT_NODE_SYMBOL, { + value: this, + configurable: false, + enumerable: false + }); + } + + /** + * Returns the scope in which this construct is defined. + * + * The value is `undefined` at the root of the construct scope tree. + */ + public get scope(): IConstruct | undefined { + return this._actualNode.scope as IConstruct; + } + + /** + * The id of this construct within the current scope. + * + * This is a a scope-unique id. To obtain an app-unique id for this construct, use `uniqueId`. + */ + public get id() { return this._actualNode.id; } + + /** + * The full, absolute path of this construct in the tree. + * + * Components are separated by '/'. + */ + public get path(): string { return this._actualNode.path; } + + /** + * A tree-global unique alphanumeric identifier for this construct. + * Includes all components of the tree. + */ + public get uniqueId(): string { return this._actualNode.uniqueId; } + + /** + * Return a direct child by id, or undefined + * + * @param id Identifier of direct child + * @returns the child if found, or undefined + */ + public tryFindChild(id: string): IConstruct | undefined { return this._actualNode.tryFindChild(id) as IConstruct; } + + /** + * Return a direct child by id + * + * Throws an error if the child is not found. + * + * @param id Identifier of direct child + * @returns Child with the given id. + */ + public findChild(id: string): IConstruct { return this._actualNode.findChild(id) as IConstruct; } + + /** + * Returns the child construct that has the id `Default` or `Resource"`. + * This is usually the construct that provides the bulk of the underlying functionality. + * Useful for modifications of the underlying construct that are not available at the higher levels. + * + * @throws if there is more than one child + * @returns a construct or undefined if there is no default child + */ + public get defaultChild(): IConstruct | undefined { return this._actualNode.defaultChild as IConstruct; } + + /** + * Override the defaultChild property. + * + * This should only be used in the cases where the correct + * default child is not named 'Resource' or 'Default' as it + * should be. + * + * If you set this to undefined, the default behavior of finding + * the child named 'Resource' or 'Default' will be used. + */ + public set defaultChild(value: IConstruct | undefined) { this._actualNode.defaultChild = value; } + + /** + * All direct children of this construct. + */ + public get children(): IConstruct[] { return this._actualNode.children as IConstruct[]; } + + /** + * Return this construct and all of its children in the given order + */ + public findAll(order: ConstructOrder = ConstructOrder.PREORDER): IConstruct[] { return this._actualNode.findAll(order) as IConstruct[]; } + + /** + * This can be used to set contextual values. + * Context must be set before any children are added, since children may consult context info during construction. + * If the key already exists, it will be overridden. + * @param key The context key + * @param value The context value + */ + public setContext(key: string, value: any) { this._actualNode.setContext(key, value); } + + /** + * Retrieves a value from tree context. + * + * Context is usually initialized at the root, but can be overridden at any point in the tree. + * + * @param key The context key + * @returns The context value or `undefined` if there is no context value for thie key. + */ + public tryGetContext(key: string): any { return this._actualNode.tryGetContext(key); } + + /** + * An immutable array of metadata objects associated with this construct. + * This can be used, for example, to implement support for deprecation notices, source mapping, etc. + */ + public get metadata() { return this._actualNode.metadata as cxapi.MetadataEntry[]; } + + /** + * Adds a metadata entry to this construct. + * Entries are arbitrary values and will also include a stack trace to allow tracing back to + * the code location for when the entry was added. It can be used, for example, to include source + * mapping in CloudFormation templates to improve diagnostics. + * + * @param type a string denoting the type of metadata + * @param data the value of the metadata (can be a Token). If null/undefined, metadata will not be added. + * @param fromFunction a function under which to restrict the metadata entry's stack trace (defaults to this.addMetadata) + */ + public addMetadata(type: string, data: any, fromFunction?: any): void { this._actualNode.addMetadata(type, data, fromFunction); } + + /** + * Adds a { "info": } metadata entry to this construct. + * The toolkit will display the info message when apps are synthesized. + * @param message The info message. + */ + public addInfo(message: string): void { + this._actualNode.addMetadata(cxapi.INFO_METADATA_KEY, message); + } + + /** + * Adds a { "warning": } metadata entry to this construct. + * The toolkit will display the warning when an app is synthesized, or fail + * if run in --strict mode. + * @param message The warning message. + */ + public addWarning(message: string): void { + this._actualNode.addMetadata(cxapi.WARNING_METADATA_KEY, message); + } + + /** + * Adds an { "error": } metadata entry to this construct. + * The toolkit will fail synthesis when errors are reported. + * @param message The error message. + */ + public addError(message: string) { + this._actualNode.addMetadata(cxapi.ERROR_METADATA_KEY, message); + } + + /** + * Applies the aspect to this Constructs node + */ + public applyAspect(aspect: IAspect): void { this._actualNode.applyAspect(aspect); } + + /** + * All parent scopes of this construct. + * + * @returns a list of parent scopes. The last element in the list will always + * be the current construct and the first element will be the root of the + * tree. + */ + public get scopes(): IConstruct[] { return this._actualNode.scopes as IConstruct[]; } + + /** + * @returns The root of the construct tree. + */ + public get root(): IConstruct { return this._actualNode.root as IConstruct; } + + /** + * Returns true if this construct or the scopes in which it is defined are + * locked. + */ + public get locked() { return this._actualNode.locked; } + + /** + * Add an ordering dependency on another Construct. + * + * All constructs in the dependency's scope will be deployed before any + * construct in this construct's scope. + */ + public addDependency(...dependencies: IDependable[]) { this._actualNode.addDependency(...dependencies); } + + /** + * Return all dependencies registered on this node or any of its children + */ + public get dependencies(): Dependency[] { return this._actualNode.dependencies as Dependency[]; } + + /** + * Remove the child with the given name, if present. + * + * @returns Whether a child with the given name was deleted. + * @experimental + */ + public tryRemoveChild(childName: string): boolean { return this._actualNode.tryRemoveChild(childName); } +} + +/** + * An error returned during the validation phase. + */ +export interface ValidationError { + /** + * The construct which emitted the error. + */ + readonly source: Construct; + + /** + * The error message. + */ + readonly message: string; +} + +/** + * A single dependency + */ +export interface Dependency { + /** + * Source the dependency + */ + readonly source: IConstruct; + + /** + * Target of the dependency + */ + readonly target: IConstruct; +} + +function ignore(_x: any) { + return; +} diff --git a/packages/@aws-cdk/core/lib/construct.ts b/packages/@aws-cdk/core/lib/construct.ts deleted file mode 100644 index f895849010727..0000000000000 --- a/packages/@aws-cdk/core/lib/construct.ts +++ /dev/null @@ -1,681 +0,0 @@ -import * as cxapi from '@aws-cdk/cx-api'; -import { IAspect } from './aspect'; -import { DependableTrait, IDependable } from './dependency'; -import { makeUniqueId } from './private/uniqueid'; -import { captureStackTrace } from './stack-trace'; -import { Token } from './token'; - -const CONSTRUCT_SYMBOL = Symbol.for('@aws-cdk/core.Construct'); - -/** - * Represents a construct. - */ -export interface IConstruct extends IDependable { - /** - * The construct node in the tree. - */ - readonly node: ConstructNode; -} - -/** - * Represents the construct node in the scope tree. - */ -export class ConstructNode { - /** - * Separator used to delimit construct path components. - */ - public static readonly PATH_SEP = '/'; - - /** - * Synthesizes a CloudAssembly from a construct tree. - * @param root The root of the construct tree. - * @param options Synthesis options. - */ - public static synth(root: ConstructNode, options: SynthesisOptions = { }): cxapi.CloudAssembly { - const builder = new cxapi.CloudAssemblyBuilder(options.outdir); - - // the three holy phases of synthesis: prepare, validate and synthesize - - // prepare - this.prepare(root); - - // validate - const validate = options.skipValidation === undefined ? true : !options.skipValidation; - if (validate) { - const errors = this.validate(root); - if (errors.length > 0) { - const errorList = errors.map(e => `[${e.source.node.path}] ${e.message}`).join('\n '); - throw new Error(`Validation failed with the following errors:\n ${errorList}`); - } - } - - // synthesize (leaves first) - for (const construct of root.findAll(ConstructOrder.POSTORDER)) { - try { - construct.node._lock(); - (construct as any).synthesize({ assembly: builder }); // "as any" is needed because we want to keep "synthesize" protected - } finally { - construct.node._unlock(); - } - } - - // write session manifest and lock store - return builder.buildAssembly(options); - } - - /** - * Invokes "prepare" on all constructs (depth-first, post-order) in the tree under `node`. - * @param node The root node - */ - public static prepare(node: ConstructNode) { - const constructs = node.findAll(ConstructOrder.PREORDER); - - // Aspects are applied root to leaf - for (const construct of constructs) { - construct.node.invokeAspects(); - } - - // Use .reverse() to achieve post-order traversal - for (const construct of constructs.reverse()) { - if (Construct.isConstruct(construct)) { - (construct as any).prepare(); // "as any" is needed because we want to keep "prepare" protected - } - } - } - - /** - * Invokes "validate" on all constructs in the tree (depth-first, pre-order) and returns - * the list of all errors. An empty list indicates that there are no errors. - * - * @param node The root node - */ - public static validate(node: ConstructNode) { - let errors = new Array(); - - for (const child of node.children) { - errors = errors.concat(this.validate(child.node)); - } - - const localErrors: string[] = (node.host as any).validate(); // "as any" is needed because we want to keep "validate" protected - return errors.concat(localErrors.map(msg => ({ source: node.host, message: msg }))); - } - - /** - * Returns the scope in which this construct is defined. - * - * The value is `undefined` at the root of the construct scope tree. - */ - public readonly scope?: IConstruct; - - /** - * The id of this construct within the current scope. - * - * This is a a scope-unique id. To obtain an app-unique id for this construct, use `uniqueId`. - */ - public readonly id: string; - - private _locked = false; // if this is "true", addChild will fail - private readonly _aspects: IAspect[] = []; - private readonly _children: { [id: string]: IConstruct } = { }; - private readonly _context: { [key: string]: any } = { }; - private readonly _metadata = new Array(); - private readonly _dependencies = new Set(); - private readonly invokedAspects: IAspect[] = []; - private _defaultChild: IConstruct | undefined; - - constructor(private readonly host: Construct, scope: IConstruct, id: string) { - id = id || ''; // if undefined, convert to empty string - - this.id = sanitizeId(id); - this.scope = scope; - - // We say that scope is required, but root scopes will bypass the type - // checks and actually pass in 'undefined'. - if (scope != null) { - if (id === '') { - throw new Error('Only root constructs may have an empty name'); - } - - // Has side effect so must be very last thing in constructor - scope.node.addChild(host, this.id); - } else { - // This is a root construct. - this.id = id; - } - - if (Token.isUnresolved(id)) { - throw new Error(`Cannot use tokens in construct ID: ${id}`); - } - } - - /** - * The full, absolute path of this construct in the tree. - * - * Components are separated by '/'. - */ - public get path(): string { - const components = this.scopes.slice(1).map(c => c.node.id); - return components.join(ConstructNode.PATH_SEP); - } - - /** - * A tree-global unique alphanumeric identifier for this construct. - * Includes all components of the tree. - */ - public get uniqueId(): string { - const components = this.scopes.slice(1).map(c => c.node.id); - return components.length > 0 ? makeUniqueId(components) : ''; - } - - /** - * Return a direct child by id, or undefined - * - * @param id Identifier of direct child - * @returns the child if found, or undefined - */ - public tryFindChild(id: string): IConstruct | undefined { - return this._children[sanitizeId(id)]; - } - - /** - * Return a direct child by id - * - * Throws an error if the child is not found. - * - * @param id Identifier of direct child - * @returns Child with the given id. - */ - public findChild(id: string): IConstruct { - const ret = this.tryFindChild(id); - if (!ret) { - throw new Error(`No child with id: '${id}'`); - } - return ret; - } - - /** - * Returns the child construct that has the id `Default` or `Resource"`. - * This is usually the construct that provides the bulk of the underlying functionality. - * Useful for modifications of the underlying construct that are not available at the higher levels. - * - * @throws if there is more than one child - * @returns a construct or undefined if there is no default child - */ - public get defaultChild(): IConstruct | undefined { - if (this._defaultChild !== undefined) { - return this._defaultChild; - } - - const resourceChild = this.tryFindChild('Resource'); - const defaultChild = this.tryFindChild('Default'); - if (resourceChild && defaultChild) { - throw new Error(`Cannot determine default child for ${this.path}. There is both a child with id "Resource" and id "Default"`); - } - - return defaultChild || resourceChild; - } - - /** - * Override the defaultChild property. - * - * This should only be used in the cases where the correct - * default child is not named 'Resource' or 'Default' as it - * should be. - * - * If you set this to undefined, the default behavior of finding - * the child named 'Resource' or 'Default' will be used. - */ - public set defaultChild(value: IConstruct | undefined) { - this._defaultChild = value; - } - - /** - * All direct children of this construct. - */ - public get children() { - return Object.values(this._children); - } - - /** - * Return this construct and all of its children in the given order - */ - public findAll(order: ConstructOrder = ConstructOrder.PREORDER): IConstruct[] { - const ret = new Array(); - visit(this.host); - return ret; - - function visit(node: IConstruct) { - if (order === ConstructOrder.PREORDER) { - ret.push(node); - } - - for (const child of node.node.children) { - visit(child); - } - - if (order === ConstructOrder.POSTORDER) { - ret.push(node); - } - } - } - - /** - * This can be used to set contextual values. - * Context must be set before any children are added, since children may consult context info during construction. - * If the key already exists, it will be overridden. - * @param key The context key - * @param value The context value - */ - public setContext(key: string, value: any) { - if (Token.isUnresolved(key)) { - throw new Error(`Invalid context key "${key}". It contains unresolved tokens`); - } - - if (this.children.length > 0) { - const names = this.children.map(c => c.node.id); - throw new Error('Cannot set context after children have been added: ' + names.join(',')); - } - this._context[key] = value; - } - - /** - * Retrieves a value from tree context. - * - * Context is usually initialized at the root, but can be overridden at any point in the tree. - * - * @param key The context key - * @returns The context value or `undefined` if there is no context value for thie key. - */ - public tryGetContext(key: string): any { - if (Token.isUnresolved(key)) { - throw new Error(`Invalid context key "${key}". It contains unresolved tokens`); - } - - const value = this._context[key]; - if (value !== undefined) { return value; } - - return this.scope && this.scope.node.tryGetContext(key); - } - - /** - * An immutable array of metadata objects associated with this construct. - * This can be used, for example, to implement support for deprecation notices, source mapping, etc. - */ - public get metadata() { - return [ ...this._metadata ]; - } - - /** - * Adds a metadata entry to this construct. - * Entries are arbitrary values and will also include a stack trace to allow tracing back to - * the code location for when the entry was added. It can be used, for example, to include source - * mapping in CloudFormation templates to improve diagnostics. - * - * @param type a string denoting the type of metadata - * @param data the value of the metadata (can be a Token). If null/undefined, metadata will not be added. - * @param from a function under which to restrict the metadata entry's stack trace (defaults to this.addMetadata) - */ - public addMetadata(type: string, data: any, from?: any): void { - if (data == null) { - return; - } - - const trace = this.tryGetContext(cxapi.DISABLE_METADATA_STACK_TRACE) ? undefined : captureStackTrace(from || this.addMetadata); - this._metadata.push({ type, data, trace }); - } - - /** - * Adds a { "aws:cdk:info": } metadata entry to this construct. - * The toolkit will display the info message when apps are synthesized. - * @param message The info message. - */ - public addInfo(message: string): void { - this.addMetadata(cxapi.INFO_METADATA_KEY, message); - } - - /** - * Adds a { warning: } metadata entry to this construct. - * The toolkit will display the warning when an app is synthesized, or fail - * if run in --strict mode. - * @param message The warning message. - */ - public addWarning(message: string): void { - this.addMetadata(cxapi.WARNING_METADATA_KEY, message); - } - - /** - * Adds an { error: } metadata entry to this construct. - * The toolkit will fail synthesis when errors are reported. - * @param message The error message. - */ - public addError(message: string) { - this.addMetadata(cxapi.ERROR_METADATA_KEY, message); - } - - /** - * Applies the aspect to this Constructs node - */ - public applyAspect(aspect: IAspect): void { - this._aspects.push(aspect); - return; - } - - /** - * All parent scopes of this construct. - * - * @returns a list of parent scopes. The last element in the list will always - * be the current construct and the first element will be the root of the - * tree. - */ - public get scopes(): IConstruct[] { - const ret = new Array(); - - let curr: IConstruct | undefined = this.host; - while (curr) { - ret.unshift(curr); - curr = curr.node && curr.node.scope; - } - - return ret; - } - - /** - * @returns The root of the construct tree. - */ - public get root() { - return this.scopes[0]; - } - - /** - * Returns true if this construct or the scopes in which it is defined are - * locked. - */ - public get locked() { - if (this._locked) { - return true; - } - - if (this.scope && this.scope.node.locked) { - return true; - } - - return false; - } - - /** - * Add an ordering dependency on another Construct. - * - * All constructs in the dependency's scope will be deployed before any - * construct in this construct's scope. - */ - public addDependency(...dependencies: IDependable[]) { - for (const dependency of dependencies) { - this._dependencies.add(dependency); - } - } - - /** - * Return all dependencies registered on this node or any of its children - */ - public get dependencies(): Dependency[] { - const found = new Map>(); // Deduplication map - const ret = new Array(); - - for (const source of this.findAll()) { - for (const dependable of source.node._dependencies) { - for (const target of DependableTrait.get(dependable).dependencyRoots) { - let foundTargets = found.get(source); - if (!foundTargets) { found.set(source, foundTargets = new Set()); } - - if (!foundTargets.has(target)) { - ret.push({ source, target }); - foundTargets.add(target); - } - } - } - } - - return ret; - } - - /** - * Remove the child with the given name, if present. - * - * @returns Whether a child with the given name was deleted. - * @experimental - */ - public tryRemoveChild(childName: string): boolean { - if (!(childName in this._children)) { return false; } - delete this._children[childName]; - return true; - } - - /** - * Locks this construct from allowing more children to be added. After this - * call, no more children can be added to this construct or to any children. - * @internal - */ - private _lock() { - this._locked = true; - } - - /** - * Unlocks this costruct and allows mutations (adding children). - * @internal - */ - private _unlock() { - this._locked = false; - } - - /** - * Adds a child construct to this node. - * - * @param child The child construct - * @param childName The type name of the child construct. - * @returns The resolved path part name of the child - */ - private addChild(child: Construct, childName: string) { - if (this.locked) { - - // special error if root is locked - if (!this.path) { - throw new Error('Cannot add children during synthesis'); - } - - throw new Error(`Cannot add children to "${this.path}" during synthesis`); - } - - if (childName in this._children) { - const name = this.id || ''; - const typeName = this.host.constructor.name; - throw new Error(`There is already a Construct with name '${childName}' in ${typeName}${name.length > 0 ? ' [' + name + ']' : ''}`); - } - - this._children[childName] = child; - } - - /** - * Triggers each aspect to invoke visit - */ - private invokeAspects(): void { - const descendants = this.findAll(); - for (const aspect of this._aspects) { - if (this.invokedAspects.includes(aspect)) { - continue; - } - descendants.forEach( member => aspect.visit(member)); - this.invokedAspects.push(aspect); - } - } -} - -/** - * Represents the building block of the construct graph. - * - * All constructs besides the root construct must be created within the scope of - * another construct. - */ -export class Construct implements IConstruct { - /** - * Return whether the given object is a Construct - */ - public static isConstruct(x: any): x is Construct { - return typeof x === 'object' && x !== null && CONSTRUCT_SYMBOL in x; - } - - /** - * Construct tree node which offers APIs for interacting with the construct tree. - */ - public readonly node: ConstructNode; - - /** - * Creates a new construct node. - * - * @param scope The scope in which to define this construct - * @param id The scoped construct ID. Must be unique amongst siblings. If - * the ID includes a path separator (`/`), then it will be replaced by double - * dash `--`. - */ - constructor(scope: Construct, id: string) { - Object.defineProperty(this, CONSTRUCT_SYMBOL, { value: true }); - - this.node = new ConstructNode(this, scope, id); - - // implement IDependable privately - DependableTrait.implement(this, { - dependencyRoots: [ this ] - }); - } - - /** - * Returns a string representation of this construct. - */ - public toString() { - return this.node.path || ''; - } - - /** - * Validate the current construct. - * - * This method can be implemented by derived constructs in order to perform - * validation logic. It is called on all constructs before synthesis. - * - * @returns An array of validation error messages, or an empty array if there the construct is valid. - */ - protected validate(): string[] { - return []; - } - - /** - * Perform final modifications before synthesis - * - * This method can be implemented by derived constructs in order to perform - * final changes before synthesis. prepare() will be called after child - * constructs have been prepared. - * - * This is an advanced framework feature. Only use this if you - * understand the implications. - */ - protected prepare(): void { - return; - } - - /** - * Allows this construct to emit artifacts into the cloud assembly during synthesis. - * - * This method is usually implemented by framework-level constructs such as `Stack` and `Asset` - * as they participate in synthesizing the cloud assembly. - * - * @param session The synthesis session. - */ - protected synthesize(session: ISynthesisSession): void { - ignore(session); - } -} - -/** - * An error returned during the validation phase. - */ -export interface ValidationError { - /** - * The construct which emitted the error. - */ - readonly source: Construct; - - /** - * The error message. - */ - readonly message: string; -} - -/** - * In what order to return constructs - */ -export enum ConstructOrder { - /** - * Depth-first, pre-order - */ - PREORDER, - - /** - * Depth-first, post-order (leaf nodes first) - */ - POSTORDER -} - -/** - * A single dependency - */ -export interface Dependency { - /** - * Source the dependency - */ - readonly source: IConstruct; - - /** - * Target of the dependency - */ - readonly target: IConstruct; -} - -/** - * Represents a single session of synthesis. Passed into `Construct.synthesize()` methods. - */ -export interface ISynthesisSession { - /** - * The cloud assembly being synthesized. - */ - assembly: cxapi.CloudAssemblyBuilder; -} - -/** - * Options for synthesis. - */ -export interface SynthesisOptions extends cxapi.AssemblyBuildOptions { - /** - * The output directory into which to synthesize the cloud assembly. - * @default - creates a temporary directory - */ - readonly outdir?: string; - - /** - * Whether synthesis should skip the validation phase. - * @default false - */ - readonly skipValidation?: boolean; -} - -function ignore(_x: any) { - return; -} - -// Import this _after_ everything else to help node work the classes out in the correct order... -const PATH_SEP_REGEX = new RegExp(`${ConstructNode.PATH_SEP}`, 'g'); - -/** - * Return a sanitized version of an arbitrary string, so it can be used as an ID - */ -function sanitizeId(id: string) { - // Escape path seps as double dashes - return id.replace(PATH_SEP_REGEX, '--'); -} diff --git a/packages/@aws-cdk/core/lib/context-provider.ts b/packages/@aws-cdk/core/lib/context-provider.ts index 77da770e1de87..9382187ea733a 100644 --- a/packages/@aws-cdk/core/lib/context-provider.ts +++ b/packages/@aws-cdk/core/lib/context-provider.ts @@ -1,5 +1,5 @@ import * as cxapi from '@aws-cdk/cx-api'; -import { Construct } from './construct'; +import { Construct } from './construct-compat'; import { Stack } from './stack'; import { Token } from './token'; diff --git a/packages/@aws-cdk/core/lib/dependency.ts b/packages/@aws-cdk/core/lib/dependency.ts index 6f0bc0e302dd3..ac8e5bbeb41b4 100644 --- a/packages/@aws-cdk/core/lib/dependency.ts +++ b/packages/@aws-cdk/core/lib/dependency.ts @@ -1,4 +1,4 @@ -import { IConstruct } from "./construct"; +import { IConstruct } from "./construct-compat"; /** * Trait marker for classes that can be depended upon diff --git a/packages/@aws-cdk/core/lib/index.ts b/packages/@aws-cdk/core/lib/index.ts index 6c961fd24ee84..1fd26c2652b2d 100644 --- a/packages/@aws-cdk/core/lib/index.ts +++ b/packages/@aws-cdk/core/lib/index.ts @@ -1,7 +1,7 @@ export * from './aspect'; export * from './tag-aspect'; -export * from './construct'; +export * from './construct-compat'; export * from './token'; export * from './resolvable'; export * from './lazy'; diff --git a/packages/@aws-cdk/core/lib/private/asset-parameters.ts b/packages/@aws-cdk/core/lib/private/asset-parameters.ts index 727491de55159..d6077c2063bb9 100644 --- a/packages/@aws-cdk/core/lib/private/asset-parameters.ts +++ b/packages/@aws-cdk/core/lib/private/asset-parameters.ts @@ -1,5 +1,5 @@ import { CfnParameter } from '../cfn-parameter'; -import { Construct } from '../construct'; +import { Construct } from '../construct-compat'; export class FileAssetParameters extends Construct { public readonly bucketNameParameter: CfnParameter; diff --git a/packages/@aws-cdk/core/lib/private/cfn-reference.ts b/packages/@aws-cdk/core/lib/private/cfn-reference.ts index a6173b8551449..02cceb7fb4e4e 100644 --- a/packages/@aws-cdk/core/lib/private/cfn-reference.ts +++ b/packages/@aws-cdk/core/lib/private/cfn-reference.ts @@ -127,7 +127,7 @@ export class CfnReference extends Reference { } import { CfnElement } from "../cfn-element"; -import { Construct, IConstruct } from "../construct"; +import { Construct, IConstruct } from "../construct-compat"; import { IResolvable, IResolveContext } from "../resolvable"; import { Stack } from "../stack"; import { Token } from "../token"; diff --git a/packages/@aws-cdk/core/lib/private/resolve.ts b/packages/@aws-cdk/core/lib/private/resolve.ts index d18ea357b0e3b..494d2375b0deb 100644 --- a/packages/@aws-cdk/core/lib/private/resolve.ts +++ b/packages/@aws-cdk/core/lib/private/resolve.ts @@ -1,4 +1,4 @@ -import { IConstruct } from '../construct'; +import { IConstruct } from '../construct-compat'; import { DefaultTokenResolver, IPostProcessor, IResolvable, IResolveContext, ITokenResolver, StringConcat } from '../resolvable'; import { TokenizedStringFragments } from '../string-fragments'; import { containsListTokenElement, TokenString, unresolved } from "./encoding"; diff --git a/packages/@aws-cdk/core/lib/private/tree-metadata.ts b/packages/@aws-cdk/core/lib/private/tree-metadata.ts index e5b307ffac670..70a847128ac27 100644 --- a/packages/@aws-cdk/core/lib/private/tree-metadata.ts +++ b/packages/@aws-cdk/core/lib/private/tree-metadata.ts @@ -2,7 +2,7 @@ import * as fs from 'fs'; import * as path from 'path'; import { ArtifactType } from '@aws-cdk/cx-api'; -import { Construct, IConstruct, ISynthesisSession } from '../construct'; +import { Construct, IConstruct, ISynthesisSession } from '../construct-compat'; import { Stack } from '../stack'; import { IInspectable, TreeInspector } from '../tree'; diff --git a/packages/@aws-cdk/core/lib/reference.ts b/packages/@aws-cdk/core/lib/reference.ts index 022b507a82b35..8c142d20f697f 100644 --- a/packages/@aws-cdk/core/lib/reference.ts +++ b/packages/@aws-cdk/core/lib/reference.ts @@ -26,4 +26,4 @@ export abstract class Reference extends Intrinsic { } } -import { IConstruct } from './construct'; +import { IConstruct } from './construct-compat'; diff --git a/packages/@aws-cdk/core/lib/resolvable.ts b/packages/@aws-cdk/core/lib/resolvable.ts index b6ca4a7c209f9..59c8f62871329 100644 --- a/packages/@aws-cdk/core/lib/resolvable.ts +++ b/packages/@aws-cdk/core/lib/resolvable.ts @@ -1,4 +1,4 @@ -import { IConstruct } from "./construct"; +import { IConstruct } from "./construct-compat"; import { TokenString } from "./private/encoding"; import { TokenMap } from "./private/token-map"; import { TokenizedStringFragments } from "./string-fragments"; diff --git a/packages/@aws-cdk/core/lib/resource.ts b/packages/@aws-cdk/core/lib/resource.ts index 99885d5b04a62..8348e66279d57 100644 --- a/packages/@aws-cdk/core/lib/resource.ts +++ b/packages/@aws-cdk/core/lib/resource.ts @@ -1,5 +1,5 @@ import { ArnComponents } from './arn'; -import { Construct, IConstruct } from './construct'; +import { Construct, IConstruct } from './construct-compat'; import { Lazy } from './lazy'; import { generatePhysicalName, isGeneratedWhenNeededMarker } from './private/physical-name-generator'; import { IResolveContext } from './resolvable'; diff --git a/packages/@aws-cdk/core/lib/runtime.ts b/packages/@aws-cdk/core/lib/runtime.ts index ff8d3673a0e44..6458be9a670ef 100644 --- a/packages/@aws-cdk/core/lib/runtime.ts +++ b/packages/@aws-cdk/core/lib/runtime.ts @@ -1,4 +1,4 @@ -import { Construct } from './construct'; +import { Construct } from './construct-compat'; // ---------------------------------------------------------------------- // PROPERTY MAPPERS diff --git a/packages/@aws-cdk/core/lib/stack.ts b/packages/@aws-cdk/core/lib/stack.ts index 30a0119cbebd8..235dbe0235e5a 100644 --- a/packages/@aws-cdk/core/lib/stack.ts +++ b/packages/@aws-cdk/core/lib/stack.ts @@ -3,7 +3,7 @@ import * as crypto from 'crypto'; import * as fs from 'fs'; import * as path from 'path'; import { DockerImageAssetLocation, DockerImageAssetSource, FileAssetLocation , FileAssetPackaging, FileAssetSource } from './assets'; -import { Construct, ConstructNode, IConstruct, ISynthesisSession } from './construct'; +import { Construct, ConstructNode, IConstruct, ISynthesisSession } from './construct-compat'; import { ContextProvider } from './context-provider'; import { Environment } from './environment'; import { FileAssetParameters } from './private/asset-parameters'; diff --git a/packages/@aws-cdk/core/lib/tag-aspect.ts b/packages/@aws-cdk/core/lib/tag-aspect.ts index d8992ba0d5e4b..b15c4eb46160b 100644 --- a/packages/@aws-cdk/core/lib/tag-aspect.ts +++ b/packages/@aws-cdk/core/lib/tag-aspect.ts @@ -1,6 +1,6 @@ // import * as cxapi from '@aws-cdk/cx-api'; import { IAspect } from './aspect'; -import { Construct, IConstruct } from './construct'; +import { Construct, IConstruct } from './construct-compat'; import { ITaggable, TagManager } from './tag-manager'; /** diff --git a/packages/@aws-cdk/core/lib/token.ts b/packages/@aws-cdk/core/lib/token.ts index 26c260c913143..b889e0e8e6d98 100644 --- a/packages/@aws-cdk/core/lib/token.ts +++ b/packages/@aws-cdk/core/lib/token.ts @@ -1,4 +1,4 @@ -import { IConstruct } from "./construct"; +import { IConstruct } from "./construct-compat"; import { Lazy } from "./lazy"; import { unresolved } from "./private/encoding"; import { Intrinsic } from "./private/intrinsic"; diff --git a/packages/@aws-cdk/core/lib/util.ts b/packages/@aws-cdk/core/lib/util.ts index ca0fdce24194e..ffc42798484aa 100644 --- a/packages/@aws-cdk/core/lib/util.ts +++ b/packages/@aws-cdk/core/lib/util.ts @@ -1,4 +1,4 @@ -import { IConstruct } from "./construct"; +import { IConstruct } from "./construct-compat"; import { Intrinsic } from "./private/intrinsic"; import { IPostProcessor, IResolveContext } from "./resolvable"; import { Stack } from "./stack"; diff --git a/packages/@aws-cdk/core/package.json b/packages/@aws-cdk/core/package.json index 3e32e60453cd7..d5a9fafb8a42c 100644 --- a/packages/@aws-cdk/core/package.json +++ b/packages/@aws-cdk/core/package.json @@ -146,11 +146,13 @@ "pkglint": "0.0.0" }, "dependencies": { - "@aws-cdk/cx-api": "0.0.0" + "@aws-cdk/cx-api": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { - "@aws-cdk/cx-api": "0.0.0" + "@aws-cdk/cx-api": "0.0.0", + "constructs": "^1.1.2" }, "engines": { "node": ">= 10.3.0" diff --git a/packages/@aws-cdk/core/test/test.aspect.ts b/packages/@aws-cdk/core/test/test.aspect.ts index 76bd9546ce80c..5c9a3ae9b57fe 100644 --- a/packages/@aws-cdk/core/test/test.aspect.ts +++ b/packages/@aws-cdk/core/test/test.aspect.ts @@ -1,7 +1,7 @@ import { Test } from 'nodeunit'; import { App } from '../lib'; import { IAspect } from '../lib/aspect'; -import { Construct, ConstructNode, IConstruct } from '../lib/construct'; +import { Construct, ConstructNode, IConstruct } from '../lib/construct-compat'; class MyConstruct extends Construct { public static IsMyConstruct(x: any): x is MyConstruct { diff --git a/packages/@aws-cdk/core/test/test.construct.ts b/packages/@aws-cdk/core/test/test.construct.ts index d53782a08f012..9051f19ece674 100644 --- a/packages/@aws-cdk/core/test/test.construct.ts +++ b/packages/@aws-cdk/core/test/test.construct.ts @@ -258,7 +258,7 @@ export = { test.deepEqual(con.node.metadata[0].data, 'value'); test.deepEqual(con.node.metadata[1].data, 103); test.deepEqual(con.node.metadata[2].data, [ 123, 456 ]); - test.ok(con.node.metadata[0].trace && con.node.metadata[0].trace[0].indexOf('FIND_ME') !== -1, 'First stack line should include this function\s name'); + test.ok(con.node.metadata[0].trace && con.node.metadata[0].trace[1].indexOf('FIND_ME') !== -1, 'First stack line should include this function\s name'); test.done(); }, @@ -381,11 +381,11 @@ export = { class LockableConstruct extends Construct { public lockMe() { - (this.node as any)._lock(); + (this.node._actualNode as any)._lock(); } public unlockMe() { - (this.node as any)._unlock(); + (this.node._actualNode as any)._unlock(); } } diff --git a/packages/@aws-cdk/custom-resources/package.json b/packages/@aws-cdk/custom-resources/package.json index 351ede6e3adce..05da19ffe6ebd 100644 --- a/packages/@aws-cdk/custom-resources/package.json +++ b/packages/@aws-cdk/custom-resources/package.json @@ -79,7 +79,7 @@ "cdk-integ-tools": "0.0.0", "cfn2ts": "0.0.0", "fs-extra": "^8.1.0", - "nock": "^12.0.2", + "nock": "^12.0.3", "pkglint": "0.0.0", "sinon": "^9.0.1" }, @@ -91,7 +91,8 @@ "@aws-cdk/aws-sns": "0.0.0", "@aws-cdk/aws-stepfunctions": "0.0.0", "@aws-cdk/aws-stepfunctions-tasks": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { @@ -102,7 +103,8 @@ "@aws-cdk/aws-sns": "0.0.0", "@aws-cdk/aws-stepfunctions": "0.0.0", "@aws-cdk/aws-stepfunctions-tasks": "0.0.0", - "@aws-cdk/core": "0.0.0" + "@aws-cdk/core": "0.0.0", + "constructs": "^1.1.2" }, "jest": { "moduleFileExtensions": [ diff --git a/packages/@monocdk-experiment/assert/.gitignore b/packages/@monocdk-experiment/assert/.gitignore index 02dc0fa7cdb6a..4e50e617a222c 100644 --- a/packages/@monocdk-experiment/assert/.gitignore +++ b/packages/@monocdk-experiment/assert/.gitignore @@ -9,3 +9,11 @@ jest.ts *.js *.d.ts + +dist +.LAST_PACKAGE +.LAST_BUILD +*.snk +.nyc_output +coverage +nyc.config.js \ No newline at end of file diff --git a/packages/@monocdk-experiment/assert/package.json b/packages/@monocdk-experiment/assert/package.json index 0ac59369e38fc..435a036abf6c7 100644 --- a/packages/@monocdk-experiment/assert/package.json +++ b/packages/@monocdk-experiment/assert/package.json @@ -46,14 +46,16 @@ "pkglint": "0.0.0", "ts-jest": "^25.2.0", "@monocdk-experiment/rewrite-imports": "0.0.0", - "monocdk-experiment": "0.0.0" + "monocdk-experiment": "0.0.0", + "constructs": "^1.1.2" }, "dependencies": { "@aws-cdk/cloudformation-diff": "0.0.0" }, "peerDependencies": { "jest": "^24.9.0", - "monocdk-experiment": "^0.0.0" + "monocdk-experiment": "^0.0.0", + "constructs": "^1.1.0" }, "repository": { "url": "https://github.com/aws/aws-cdk.git", diff --git a/packages/@monocdk-experiment/rewrite-imports/.gitignore b/packages/@monocdk-experiment/rewrite-imports/.gitignore index 2ba0ace08521c..092442480fa6f 100644 --- a/packages/@monocdk-experiment/rewrite-imports/.gitignore +++ b/packages/@monocdk-experiment/rewrite-imports/.gitignore @@ -1,3 +1,8 @@ node_modules *.js *.d.ts + +dist +.LAST_PACKAGE +.LAST_BUILD +*.snk \ No newline at end of file diff --git a/packages/@monocdk-experiment/rewrite-imports/.npmignore b/packages/@monocdk-experiment/rewrite-imports/.npmignore new file mode 100644 index 0000000000000..00ebd39741c58 --- /dev/null +++ b/packages/@monocdk-experiment/rewrite-imports/.npmignore @@ -0,0 +1,7 @@ + +dist +.LAST_PACKAGE +*.tsbuildinfo +tsconfig.json +.LAST_BUILD +*.snk \ No newline at end of file diff --git a/packages/@monocdk-experiment/rewrite-imports/LICENSE b/packages/@monocdk-experiment/rewrite-imports/LICENSE new file mode 100644 index 0000000000000..b71ec1688783a --- /dev/null +++ b/packages/@monocdk-experiment/rewrite-imports/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/packages/@monocdk-experiment/rewrite-imports/NOTICE b/packages/@monocdk-experiment/rewrite-imports/NOTICE new file mode 100644 index 0000000000000..bfccac9a7f69c --- /dev/null +++ b/packages/@monocdk-experiment/rewrite-imports/NOTICE @@ -0,0 +1,2 @@ +AWS Cloud Development Kit (AWS CDK) +Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@monocdk-experiment/rewrite-imports/package.json b/packages/@monocdk-experiment/rewrite-imports/package.json index 35319a9110df7..5938b2f497894 100644 --- a/packages/@monocdk-experiment/rewrite-imports/package.json +++ b/packages/@monocdk-experiment/rewrite-imports/package.json @@ -33,5 +33,15 @@ "cdk-build-tools": "0.0.0", "pkglint": "0.0.0", "@types/node": "^10.17.17" + }, + "repository": { + "type": "git", + "url": "https://github.com/aws/aws-cdk.git", + "directory": "packages/@monocdk-experiment/rewrite-imports" + }, + "homepage": "https://github.com/aws/aws-cdk", + "stability": "experimental", + "engines": { + "node": ">= 10.3.0" } } diff --git a/packages/aws-cdk/lib/api/bootstrap/bootstrap-template.json b/packages/aws-cdk/lib/api/bootstrap/bootstrap-template.json index 2c074641ef119..38c95a3b58ecf 100644 --- a/packages/aws-cdk/lib/api/bootstrap/bootstrap-template.json +++ b/packages/aws-cdk/lib/api/bootstrap/bootstrap-template.json @@ -356,6 +356,17 @@ "Fn::Sub": "${CloudFormationExecutionRole.Arn}" }, "Effect": "Allow" + }, + { + "Sid": "CliPermissions", + "Action": [ + "cloudformation:DescribeStackEvents", + "cloudformation:GetTemplate", + "cloudformation:DeleteStack", + "sts:GetCallerIdentity" + ], + "Resource": "*", + "Effect": "Allow" } ], "Version": "2012-10-17" diff --git a/packages/aws-cdk/package.json b/packages/aws-cdk/package.json index 44b9b152b5b0d..d8a812e533144 100644 --- a/packages/aws-cdk/package.json +++ b/packages/aws-cdk/package.json @@ -53,7 +53,7 @@ "@types/semver": "^7.1.0", "@types/sinon": "^7.5.2", "@types/table": "^4.0.7", - "@types/uuid": "^7.0.0", + "@types/uuid": "^7.0.1", "@types/yaml": "^1.2.0", "@types/yargs": "^15.0.4", "aws-sdk-mock": "^5.1.0", diff --git a/packages/decdk/package.json b/packages/decdk/package.json index 98af2b7eae0e4..bb8addf70d288 100644 --- a/packages/decdk/package.json +++ b/packages/decdk/package.json @@ -168,6 +168,7 @@ "fs-extra": "^8.1.0", "jsii-reflect": "^1.0.0", "jsonschema": "^1.2.5", + "constructs": "^1.1.2", "yaml": "1.8.2", "yargs": "^15.3.1" }, diff --git a/packages/monocdk-experiment/build.sh b/packages/monocdk-experiment/build.sh index 527d319cb4260..5199751871258 100755 --- a/packages/monocdk-experiment/build.sh +++ b/packages/monocdk-experiment/build.sh @@ -2,6 +2,8 @@ set -euo pipefail scriptdir=$(cd $(dirname $0) && pwd) +constructs_version="$(node -p "require('./package.json').devDependencies.constructs")" + rm -fr dist/js echo "collecting all modules..." @@ -22,7 +24,7 @@ tarball=$PWD/monocdk-experiment-*.tgz echo "verifying package..." cd $(mktemp -d) npm init -y -npm install ${tarball} +npm install ${tarball} constructs@${constructs_version} node -e "require('monocdk-experiment')" unpacked=$(node -p 'path.dirname(require.resolve("monocdk-experiment/package.json"))') diff --git a/packages/monocdk-experiment/gen.js b/packages/monocdk-experiment/gen.js index 96a57d1984ca3..3196aedf7eeb7 100644 --- a/packages/monocdk-experiment/gen.js +++ b/packages/monocdk-experiment/gen.js @@ -52,7 +52,8 @@ async function main() { throw new Error(`@types/node must be defined in devDependencies`); } const devDeps = manifest.devDependencies = { - '@types/node': nodeTypes + '@types/node': nodeTypes, + 'constructs': manifest.devDependencies['constructs'] }; if (manifest.dependencies) { @@ -110,7 +111,6 @@ async function main() { const shouldIncludeDevDep = d => include_dev_deps.find(pred => pred(d)); for (const [ devDep, devDepVersion ] of Object.entries(meta.devDependencies || {})) { - if (!shouldIncludeDevDep(devDep)) { continue; } diff --git a/packages/monocdk-experiment/package.json b/packages/monocdk-experiment/package.json index b17dcab03b465..8cf65e1dfda0c 100644 --- a/packages/monocdk-experiment/package.json +++ b/packages/monocdk-experiment/package.json @@ -23,6 +23,7 @@ }, "license": "Apache-2.0", "devDependencies": { + "constructs": "1.1.2", "@aws-cdk/alexa-ask": "0.0.0", "@aws-cdk/app-delivery": "0.0.0", "@aws-cdk/assets": "0.0.0", @@ -162,6 +163,9 @@ "@aws-cdk/aws-chatbot": "0.0.0", "@aws-cdk/aws-codestarconnections": "0.0.0" }, + "peerDependencies": { + "constructs": "^1.1.2" + }, "homepage": "https://github.com/aws/aws-cdk", "engines": { "node": ">= 10.3.0" diff --git a/scripts/builddown b/scripts/builddown index cc9ad4ceb5c7c..6d75589573fff 100755 --- a/scripts/builddown +++ b/scripts/builddown @@ -11,4 +11,4 @@ export NODE_OPTIONS="--max-old-space-size=4096 ${NODE_OPTIONS:-}" scriptdir=$(cd $(dirname $0) && pwd) export PATH=$(cd $scriptdir && npm bin):$PATH scope=$(${scriptdir}/current-scope) -exec lerna run build --scope ${scope} --include-dependents +exec lerna run ${1:-build} --scope ${scope} --include-dependents diff --git a/tools/awslint/lib/rules/cloudwatch-events.ts b/tools/awslint/lib/rules/cloudwatch-events.ts index 13536b2393b71..5557d4851f350 100644 --- a/tools/awslint/lib/rules/cloudwatch-events.ts +++ b/tools/awslint/lib/rules/cloudwatch-events.ts @@ -25,7 +25,7 @@ eventsLinter.add({ message: `'onXxx()' methods should also be defined on construct interface`, eval: e => { for (const method of e.ctx.directEventMethods.concat(e.ctx.cloudTrailEventMethods)) { - e.assert(!e.ctx.interfaceType || e.ctx.interfaceType.allMethods.some(m => m.name === method.name), `${e.ctx.fqn}.${method.name}`); + e.assert(!e.ctx.interfaceType || e.ctx.interfaceType.allMethods.filter(m => !m.protected).some(m => m.name === method.name), `${e.ctx.fqn}.${method.name}`); } } }); @@ -51,6 +51,10 @@ eventsLinter.add({ message: `all 'onXxx()' methods should have the CloudWatch Events signature (id: string, options: events.OnEventOptions = {}) => events.Rule`, eval: e => { for (const method of e.ctx.directEventMethods) { + // give slack to protected methods like "onSynthesize", "onPrepare", ... + if (method.protected) { + continue; + } e.assertSignature(method, { parameters: [ { type: 'string' }, @@ -63,7 +67,7 @@ eventsLinter.add({ }); function isDirectEventMethod(m: reflect.Method) { - return m.name.startsWith('on') && ! m.name.startsWith('onCloudTrail'); + return !m.protected && m.name.startsWith('on') && ! m.name.startsWith('onCloudTrail'); } function isCloudTrailEventMethod(m: reflect.Method) { diff --git a/tools/pkglint/lib/rules.ts b/tools/pkglint/lib/rules.ts index 83fc603002941..fcb776c78b0e5 100644 --- a/tools/pkglint/lib/rules.ts +++ b/tools/pkglint/lib/rules.ts @@ -1054,6 +1054,44 @@ export class YarnNohoistBundledDependencies extends ValidationRule { } } +export class ConstructsDependency extends ValidationRule { + public readonly name = 'constructs/dependency'; + + public validate(pkg: PackageJson) { + const REQUIRED_VERSION = '^1.1.2'; + + if (pkg.devDependencies?.constructs && pkg.devDependencies?.constructs !== REQUIRED_VERSION) { + pkg.report({ + ruleName: this.name, + message: `"constructs" must have a version requirement ${REQUIRED_VERSION}`, + fix: () => { + pkg.addDevDependency('constructs', REQUIRED_VERSION); + } + }); + } + + if (pkg.dependencies.constructs && pkg.dependencies.constructs !== REQUIRED_VERSION) { + pkg.report({ + ruleName: this.name, + message: `"constructs" must have a version requirement ${REQUIRED_VERSION}`, + fix: () => { + pkg.addDependency('constructs', REQUIRED_VERSION); + } + }); + + if (!pkg.peerDependencies.constructs || pkg.peerDependencies.constructs !== REQUIRED_VERSION) { + pkg.report({ + ruleName: this.name, + message: `"constructs" must have a version requirement ${REQUIRED_VERSION} in peerDependencies`, + fix: () => { + pkg.addPeerDependency('constructs', REQUIRED_VERSION); + } + }); + } + } + } +} + /** * Determine whether this is a JSII package * diff --git a/yarn.lock b/yarn.lock index 590df0e8a39ee..b95e04f496caf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2084,10 +2084,10 @@ resolved "https://registry.yarnpkg.com/@types/table/-/table-4.0.7.tgz#c21100d37d4924abbbde85414170260d4d7b0316" integrity sha512-HKtXvBxU8U8evZCSlUi9HbfT/SFW7nSGCoiBEheB06jAhXeW6JbGh8biEAqIFG5rZo9f8xeJVdIn455sddmIcw== -"@types/uuid@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-7.0.0.tgz#9f6993ccc8210efa90bda7e1afabbb06a9f860cd" - integrity sha512-RiX1I0lK9WFLFqy2xOxke396f0wKIzk5sAll0tL4J4XDYJXURI7JOs96XQb3nP+2gEpQ/LutBb66jgiT5oQshQ== +"@types/uuid@^7.0.1": + version "7.0.1" + resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-7.0.1.tgz#6c7290f24c06dada2d3939bb16d65415588bafc8" + integrity sha512-nWG+LfyZLiaaOUxcqpvK4MDQNm5qaLM1LtwbGJ7MgoZ+twQHpQ9Bd46COkiJur75iXRqDFR26mPgWSJIrlemsg== "@types/yaml@1.2.0", "@types/yaml@^1.2.0": version "1.2.0" @@ -3535,6 +3535,11 @@ constants-browserify@^1.0.0: resolved "https://registry.yarnpkg.com/constants-browserify/-/constants-browserify-1.0.0.tgz#c20b96d8c617748aaf1c16021760cd27fcb8cb75" integrity sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U= +constructs@1.1.2, constructs@^1.1.2: + version "1.1.2" + resolved "https://registry.npmjs.org/constructs/-/constructs-1.1.2.tgz#5d9f62d43e28836ec2dac216fdfcd260d370a3c3" + integrity sha512-JaNYYTHbgC6kzLYz2dgIvqYZSX++/cYQREHREfqltSRNBYVs4QKWm3N48N78RrAhnonRWuhCkOTYy+PbqcqTyw== + contains-path@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/contains-path/-/contains-path-0.1.0.tgz#fe8cf184ff6670b6baef01a9d4861a5cbec4120a" @@ -8023,10 +8028,10 @@ nise@^4.0.1: just-extend "^4.0.2" path-to-regexp "^1.7.0" -nock@^12.0.2: - version "12.0.2" - resolved "https://registry.yarnpkg.com/nock/-/nock-12.0.2.tgz#47617b34738e026b29d2294b4579e35b27e6a4d3" - integrity sha512-pTckyfP8QHvwXP/oX+zQuSIL3S/mWTd84ba4pOGZlS/FgRZyljv4C3ZyOjgMilvkydSaERML/aJEF13EBUuDTQ== +nock@^12.0.3: + version "12.0.3" + resolved "https://registry.yarnpkg.com/nock/-/nock-12.0.3.tgz#83f25076dbc4c9aa82b5cdf54c9604c7a778d1c9" + integrity sha512-QNb/j8kbFnKCiyqi9C5DD0jH/FubFGj5rt9NQFONXwQm3IPB0CULECg/eS3AU1KgZb/6SwUa4/DTRKhVxkGABw== dependencies: debug "^4.1.0" json-stringify-safe "^5.0.1"