Skip to content

Commit 3a56917

Browse files
authored
chore: forward merge 'master' into 'v2-main' (#19003)
Automated action from aws/cdk-ops
2 parents a405c3d + e79d0b0 commit 3a56917

File tree

323 files changed

+6871
-1268
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

323 files changed

+6871
-1268
lines changed

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,24 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
## [1.144.0](https://github.com/aws/aws-cdk/compare/v1.143.0...v1.144.0) (2022-02-08)
6+
7+
8+
### Features
9+
10+
* **assets:** support networking mode for DockerImageAsset ([#18114](https://github.com/aws/aws-cdk/issues/18114)) ([a7b39f5](https://github.com/aws/aws-cdk/commit/a7b39f527976e29a7f39c1ba1813efba2e0aa209)), closes [#15516](https://github.com/aws/aws-cdk/issues/15516)
11+
* **cfnspec:** cloudformation spec v55.0.0 ([#18827](https://github.com/aws/aws-cdk/issues/18827)) ([a1d94b3](https://github.com/aws/aws-cdk/commit/a1d94b3624eb1b6b543d8ce209ec85af8e85beda))
12+
* **cli:** `cdk diff` works for Nested Stacks ([#18207](https://github.com/aws/aws-cdk/issues/18207)) ([1337b24](https://github.com/aws/aws-cdk/commit/1337b247e82d9462074416623e665cf9526d2cc0)), closes [#5722](https://github.com/aws/aws-cdk/issues/5722)
13+
* **iotevents:** add grant method to Input class ([#18617](https://github.com/aws/aws-cdk/issues/18617)) ([e89688e](https://github.com/aws/aws-cdk/commit/e89688ec1dd7a3b072d23287cddcb73bccc16fd4))
14+
* **iotevents:** support transition events ([#18768](https://github.com/aws/aws-cdk/issues/18768)) ([ccc1988](https://github.com/aws/aws-cdk/commit/ccc198864f92620857da09c68013123e9cd3f01d)), closes [#17711](https://github.com/aws/aws-cdk/issues/17711)
15+
* **s3-deployment:** deploy data with deploy-time values ([#18659](https://github.com/aws/aws-cdk/issues/18659)) ([d40e332](https://github.com/aws/aws-cdk/commit/d40e332578f7590a0c949fdd01622a644cf9359b)), closes [#12903](https://github.com/aws/aws-cdk/issues/12903)
16+
17+
18+
### Bug Fixes
19+
20+
* **aws-appsync:** Strip unsupported characters from Lambda DataSource ([#18765](https://github.com/aws/aws-cdk/issues/18765)) ([bb8d6f6](https://github.com/aws/aws-cdk/commit/bb8d6f6bf5941b76ef0590c99fe8e26440e09c18))
21+
* **tooling:** update vscode devcontainer image ([#18455](https://github.com/aws/aws-cdk/issues/18455)) ([28647f7](https://github.com/aws/aws-cdk/commit/28647f7105da6bd02975aa7d90300d77fe85d0e6))
22+
523
## [1.143.0](https://github.com/aws/aws-cdk/compare/v1.142.0...v1.143.0) (2022-02-02)
624

725

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@
1717
},
1818
"devDependencies": {
1919
"@yarnpkg/lockfile": "^1.1.0",
20-
"cdk-generate-synthetic-examples": "^0.1.5",
20+
"cdk-generate-synthetic-examples": "^0.1.6",
2121
"conventional-changelog-cli": "^2.2.2",
2222
"fs-extra": "^9.1.0",
2323
"graceful-fs": "^4.2.9",
2424
"jest-junit": "^13.0.0",
25-
"jsii-diff": "^1.52.1",
26-
"jsii-pacmak": "^1.52.1",
27-
"jsii-reflect": "^1.52.1",
28-
"jsii-rosetta": "^1.52.1",
25+
"jsii-diff": "^1.54.0",
26+
"jsii-pacmak": "^1.54.0",
27+
"jsii-reflect": "^1.54.0",
28+
"jsii-rosetta": "^1.54.0",
2929
"lerna": "^4.0.0",
3030
"patch-package": "^6.4.7",
3131
"standard-version": "^9.3.2",

packages/@aws-cdk/app-delivery/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
"@aws-cdk/cdk-integ-tools": "0.0.0",
7575
"@aws-cdk/pkglint": "0.0.0",
7676
"@types/jest": "^27.4.0",
77-
"fast-check": "^2.21.0",
77+
"fast-check": "^2.22.0",
7878
"jest": "^27.5.1"
7979
},
8080
"repository": {

packages/@aws-cdk/assertions/lib/annotations.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@ function constructMessage(type: 'info' | 'warning' | 'error', message: any): {[k
102102
}
103103

104104
function convertArrayToMessagesType(messages: SynthesisMessage[]): Messages {
105-
return messages.reduce((obj, item) => {
105+
return messages.reduce((obj, item, index) => {
106106
return {
107107
...obj,
108-
[item.id]: item,
108+
[index]: item,
109109
};
110110
}, {}) as Messages;
111111
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { SynthesisMessage } from '@aws-cdk/cx-api';
22

33
export type Messages = {
4-
[logicalId: string]: SynthesisMessage;
4+
[key: string]: SynthesisMessage;
55
}
Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { MatchResult } from '../matcher';
1+
import { SynthesisMessage } from '@aws-cdk/cx-api';
22
import { Messages } from './message';
3-
import { filterLogicalId, formatFailure, matchSection } from './section';
3+
import { formatFailure, matchSection } from './section';
44

5-
export function findMessage(messages: Messages, logicalId: string, props: any = {}): { [key: string]: { [key: string]: any } } {
6-
const section: { [key: string]: {} } = messages;
7-
const result = matchSection(filterLogicalId(section, logicalId), props);
5+
export function findMessage(messages: Messages, constructPath: string, props: any = {}): { [key: string]: { [key: string]: any } } {
6+
const section: { [key: string]: SynthesisMessage } = messages;
7+
const result = matchSection(filterPath(section, constructPath), props);
88

99
if (!result.match) {
1010
return {};
@@ -13,9 +13,9 @@ export function findMessage(messages: Messages, logicalId: string, props: any =
1313
return result.matches;
1414
}
1515

16-
export function hasMessage(messages: Messages, logicalId: string, props: any): string | void {
17-
const section: { [key: string]: {} } = messages;
18-
const result = matchSection(filterLogicalId(section, logicalId), props);
16+
export function hasMessage(messages: Messages, constructPath: string, props: any): string | void {
17+
const section: { [key: string]: SynthesisMessage } = messages;
18+
const result = matchSection(filterPath(section, constructPath), props);
1919

2020
if (result.match) {
2121
return;
@@ -25,17 +25,26 @@ export function hasMessage(messages: Messages, logicalId: string, props: any): s
2525
return 'No messages found in the stack';
2626
}
2727

28+
handleTrace(result.closestResult.target);
2829
return [
2930
`Stack has ${result.analyzedCount} messages, but none match as expected.`,
30-
formatFailure(formatMessage(result.closestResult)),
31+
formatFailure(result.closestResult),
3132
].join('\n');
3233
}
3334

3435
// We redact the stack trace by default because it is unnecessarily long and unintelligible.
3536
// If there is a use case for rendering the trace, we can add it later.
36-
function formatMessage(match: MatchResult, renderTrace: boolean = false): MatchResult {
37-
if (!renderTrace) {
38-
match.target.entry.trace = 'redacted';
39-
}
40-
return match;
37+
function handleTrace(match: any, redact: boolean = true): void {
38+
if (redact && match.entry?.trace !== undefined) {
39+
match.entry.trace = 'redacted';
40+
};
41+
}
42+
43+
function filterPath(section: { [key: string]: SynthesisMessage }, path: string): { [key: string]: SynthesisMessage } {
44+
// default signal for all paths is '*'
45+
if (path === '*') return section;
46+
47+
return Object.entries(section ?? {})
48+
.filter(([_, v]) => v.id === path)
49+
.reduce((agg, [k, v]) => { return { ...agg, [k]: v }; }, {});
4150
}

packages/@aws-cdk/assertions/test/annotations.test.ts

Lines changed: 64 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ describe('Messages', () => {
5353
describe('findError', () => {
5454
test('match', () => {
5555
const result = annotations.findError('*', Match.anyValue());
56-
expect(Object.keys(result).length).toEqual(2);
56+
expect(result.length).toEqual(2);
5757
});
5858

5959
test('no match', () => {
6060
const result = annotations.findError('*', 'no message looks like this');
61-
expect(Object.keys(result).length).toEqual(0);
61+
expect(result.length).toEqual(0);
6262
});
6363
});
6464

@@ -75,12 +75,12 @@ describe('Messages', () => {
7575
describe('findWarning', () => {
7676
test('match', () => {
7777
const result = annotations.findWarning('*', Match.anyValue());
78-
expect(Object.keys(result).length).toEqual(1);
78+
expect(result.length).toEqual(1);
7979
});
8080

8181
test('no match', () => {
8282
const result = annotations.findWarning('*', 'no message looks like this');
83-
expect(Object.keys(result).length).toEqual(0);
83+
expect(result.length).toEqual(0);
8484
});
8585
});
8686

@@ -97,19 +97,19 @@ describe('Messages', () => {
9797
describe('findInfo', () => {
9898
test('match', () => {
9999
const result = annotations.findInfo('/Default/Qux', 'this is an info');
100-
expect(Object.keys(result).length).toEqual(1);
100+
expect(result.length).toEqual(1);
101101
});
102102

103103
test('no match', () => {
104104
const result = annotations.findInfo('*', 'no message looks like this');
105-
expect(Object.keys(result).length).toEqual(0);
105+
expect(result.length).toEqual(0);
106106
});
107107
});
108108

109109
describe('with matchers', () => {
110110
test('anyValue', () => {
111111
const result = annotations.findError('*', Match.anyValue());
112-
expect(Object.keys(result).length).toEqual(2);
112+
expect(result.length).toEqual(2);
113113
});
114114

115115
test('not', () => {
@@ -123,6 +123,45 @@ describe('Messages', () => {
123123
});
124124
});
125125

126+
describe('Multiple Messages on the Resource', () => {
127+
let stack: Stack;
128+
let annotations: _Annotations;
129+
beforeAll(() => {
130+
stack = new Stack();
131+
new CfnResource(stack, 'Foo', {
132+
type: 'Foo::Bar',
133+
properties: {
134+
Fred: 'Thud',
135+
},
136+
});
137+
138+
const bar = new CfnResource(stack, 'Bar', {
139+
type: 'Foo::Bar',
140+
properties: {
141+
Baz: 'Qux',
142+
},
143+
});
144+
bar.node.setContext('disable-stack-trace', false);
145+
146+
Aspects.of(stack).add(new MultipleAspectsPerNode());
147+
annotations = _Annotations.fromStack(stack);
148+
});
149+
150+
test('succeeds on hasXxx APIs', () => {
151+
annotations.hasError('/Default/Foo', 'error: this is an error');
152+
annotations.hasError('/Default/Foo', 'error: unsupported type Foo::Bar');
153+
annotations.hasWarning('/Default/Foo', 'warning: Foo::Bar is deprecated');
154+
});
155+
156+
test('succeeds on findXxx APIs', () => {
157+
const result1 = annotations.findError('*', Match.stringLikeRegexp('error:.*'));
158+
expect(result1.length).toEqual(4);
159+
const result2 = annotations.findError('/Default/Bar', Match.stringLikeRegexp('error:.*'));
160+
expect(result2.length).toEqual(2);
161+
const result3 = annotations.findWarning('/Default/Bar', 'warning: Foo::Bar is deprecated');
162+
expect(result3[0].entry.data).toEqual('warning: Foo::Bar is deprecated');
163+
});
164+
});
126165
class MyAspect implements IAspect {
127166
public visit(node: IConstruct): void {
128167
if (node instanceof CfnResource) {
@@ -147,4 +186,22 @@ class MyAspect implements IAspect {
147186
protected info(node: IConstruct, message: string): void {
148187
Annotations.of(node).addInfo(message);
149188
}
189+
}
190+
191+
class MultipleAspectsPerNode implements IAspect {
192+
public visit(node: IConstruct): void {
193+
if (node instanceof CfnResource) {
194+
this.error(node, 'error: this is an error');
195+
this.error(node, `error: unsupported type ${node.cfnResourceType}`);
196+
this.warn(node, `warning: ${node.cfnResourceType} is deprecated`);
197+
}
198+
}
199+
200+
protected warn(node: IConstruct, message: string): void {
201+
Annotations.of(node).addWarning(message);
202+
}
203+
204+
protected error(node: IConstruct, message: string): void {
205+
Annotations.of(node).addError(message);
206+
}
150207
}

packages/@aws-cdk/aws-applicationautoscaling/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
"@aws-cdk/cfn2ts": "0.0.0",
8686
"@aws-cdk/pkglint": "0.0.0",
8787
"@types/jest": "^27.4.0",
88-
"fast-check": "^2.21.0",
88+
"fast-check": "^2.22.0",
8989
"jest": "^27.5.1"
9090
},
9191
"dependencies": {

packages/@aws-cdk/aws-autoscaling-common/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
"@aws-cdk/cdk-integ-tools": "0.0.0",
7777
"@aws-cdk/pkglint": "0.0.0",
7878
"@types/jest": "^27.4.0",
79-
"fast-check": "^2.21.0",
79+
"fast-check": "^2.22.0",
8080
"jest": "^27.5.1"
8181
},
8282
"dependencies": {

0 commit comments

Comments
 (0)