Skip to content

Commit 66bd513

Browse files
authored
Merge branch 'master' into dynamodb-replica-timeout
2 parents 1a2ccb4 + 4e03667 commit 66bd513

File tree

331 files changed

+6942
-1904
lines changed

Some content is hidden

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

331 files changed

+6942
-1904
lines changed

.github/workflows/auto-approve.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Approve PRs with "pr/auto-approve". mergify takes care of the actual merge.
22

33
name: auto-approve
4-
on: pull_request
4+
on:
5+
pull_request:
6+
types: [ labeled, unlabeled, opened, synchronize, reopened, ready_for_review, review_requested ]
57

68
jobs:
79
auto-approve:

.github/workflows/pr-linter.yml

+9-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,15 @@
22
# https://github.com/actions/toolkit/blob/master/packages/github/src/context.ts
33

44
name: PR Linter
5-
on: pull_request
5+
on:
6+
pull_request:
7+
types:
8+
- labeled
9+
- unlabeled
10+
- edited
11+
- opened
12+
- synchronize
13+
- reopened
614

715
jobs:
816
validate-pr:

.github/workflows/yarn-upgrade.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
uses: actions/checkout@v2
1717

1818
- name: Set up Node
19-
uses: actions/[email protected].4
19+
uses: actions/[email protected].5
2020
with:
2121
node-version: 10
2222

CHANGELOG.md

+82
Large diffs are not rendered by default.

CONTRIBUTING.md

+138
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ and let us know if it's not up-to-date (even better, submit a PR with your corr
1414
- [Step 4: Commit](#step-4-commit)
1515
- [Step 5: Pull Request](#step-5-pull-request)
1616
- [Step 6: Merge](#step-6-merge)
17+
- [Breaking Changes](#breaking-changes)
1718
- [Tools](#tools)
1819
- [Main build scripts](#main-build-scripts)
1920
- [Partial build tools](#partial-build-tools)
@@ -266,6 +267,143 @@ BREAKING CHANGE: Description of what broke and how to achieve this behavior now
266267
* Once approved and tested, a maintainer will squash-merge to master and will use your PR title/description as the
267268
commit message.
268269

270+
## Breaking Changes
271+
272+
Whenever you are making changes, there is a chance for those changes to be
273+
*breaking* existing users of the library. A change is breaking if there are
274+
programs that customers could have been writing against the current version
275+
of the CDK, that will no longer "work correctly" with the proposed new
276+
version of the CDK.
277+
278+
Breaking changes are not allowed in *stable* libraries¹. They are permissible
279+
but still *highly discouraged* in experimental libraries, and require explicit
280+
callouts in the bodies of Pull Requests that introduce them.
281+
282+
> ¹) Note that starting in version 2 of the CDK, the majority of library code will be
283+
> bundled into a single main CDK library which will be considered stable, and so
284+
> no code in there can undergo breaking changes.
285+
286+
Breaking changes come in two flavors:
287+
288+
* API surface changes
289+
* Behavior changes
290+
291+
### API surface changes
292+
293+
This encompasses any changes that affect the shape of the API. Changes that
294+
will make existing programs fail to compile are not allowed. Typical examples
295+
of that are:
296+
297+
* Renaming classes or methods
298+
* Adding required properties to a struct that is used as an input to a constructor
299+
or method. This also includes changing a type from nullable to non-nullable.
300+
* Removing properties from a struct that is returned from a method, or removing
301+
properties from a class. This also includes changing a type from non-nullable
302+
to nullable.
303+
304+
To see why the latter is a problem, consider the following class:
305+
306+
```ts
307+
class SomeClass {
308+
public readonly count: number;
309+
// ❓ let's say I want to change this to 'count?: number',
310+
// i.e. make it optional.
311+
}
312+
313+
// Someone could have written the following code:
314+
const obj = new SomeClass();
315+
console.log(obj.count + 1);
316+
317+
// After the proposed change, this code that used to compile fine will now throw:
318+
console.log(obj.count + 1);
319+
// ~~~~~~~~~ Error: Object is possibly 'undefined'.
320+
```
321+
322+
CDK comes with build tooling to check whether changes you made introduce breaking
323+
changes to the API surface. In a package directory, run:
324+
325+
```shell
326+
$ yarn build
327+
$ yarn compat
328+
```
329+
330+
To figure out if the changes you made were breaking. See the section [API Compatibility
331+
Checks](#api-compatibility-checks) for more information.
332+
333+
#### Dealing with breaking API surface changes
334+
335+
If you need to change the type of some API element, introduce a new API
336+
element and mark the old API element as `@deprecated`.
337+
338+
If you need to pretend to have a value for the purposes of implementing an API
339+
and you don't actually have a useful value to return, it is acceptable to make
340+
the property a `getter` and throw an exception (keeping in mind to write error
341+
messages that will be useful to a user of your construct):
342+
343+
```ts
344+
class SomeClass implements ICountable {
345+
constructor(private readonly _count?: number) {
346+
}
347+
348+
public get count(): number {
349+
if (this._count === undefined) {
350+
// ✅ DO: throw a descriptive error that tells the user what to do
351+
throw new Error('This operation requires that a \'count\' is specified when SomeClass is created.');
352+
// ❌ DO NOT: just throw an error like 'count is missing'
353+
}
354+
return this._count;
355+
}
356+
}
357+
```
358+
359+
### Behavior changes
360+
361+
These are changes that do not directly affect the compilation of programs
362+
written against the previous API, but may change their meaning. In practice,
363+
even though the user didn't change their code, the CloudFormation template
364+
that gets synthesized is now different.
365+
366+
**Not all template changes are breaking changes!** Consider a user that has
367+
created a Stack using the previous version of the library, has updated their
368+
version of the CDK library and is now deploying an update. A behavior change
369+
is breaking if:
370+
371+
* The update cannot be applied at all
372+
* The update can be applied but causes service interruption or data loss.
373+
374+
Data loss happens when the [Logical
375+
ID](https://docs.aws.amazon.com/cdk/latest/guide/identifiers.html#identifiers_logical_ids)
376+
of a stateful resource changes, or one of the [resource properties that requires
377+
replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html)
378+
is modified. In both of these cases, CloudFormation will delete the
379+
resource, and if it was a stateful resource like a database the data in it is now gone.
380+
381+
If a change applies cleanly and does not cause any service interruption, it
382+
is not breaking. Nevertheless, it might still be wise to avoid those kinds of
383+
changes as users are understandably wary of unexpected template changes, will
384+
scrutinize them heavily, and we don't want to cause unnecessary panic and churn
385+
in our use base.
386+
387+
Determining whether or not behavioral changes are breaking requires expertise
388+
and judgement on the part of the library owner, and testing.
389+
390+
#### Dealing with breaking behavior changes
391+
392+
Most of the time, behavioral changes will arise because we want to change the
393+
default value or default behavior of some property (i.e., we want to change the
394+
interpretation of what it means if the value is missing).
395+
396+
If the new behavior is going to be breaking, the user must opt in to it, either by:
397+
398+
* Adding a new API element (class, property, method, ...) to have users
399+
explicitly opt in to the new behavior at the source code level (potentially
400+
`@deprecate`ing the old API element); or
401+
* Use the [feature flag](#feature-flags) mechanism to have the user opt in to the new
402+
behavior without changing the source code.
403+
404+
Of these two, the first one is preferred if possible (as feature flags have
405+
non-local effects which can cause unintended effects).
406+
269407
## Tools
270408

271409
The CDK is a big project, and at the moment, all of the CDK modules are mastered in a single monolithic repository

DESIGN_GUIDELINES.md

+62-60
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,5 @@
11
# AWS Construct Library Design Guidelines
22

3-
- [AWS Construct Library Design Guidelines](#aws-construct-library-design-guidelines)
4-
- [What's Included](#what-s-included)
5-
- [API Design](#api-design)
6-
- [Modules](#modules)
7-
- [Construct Class](#construct-class)
8-
- [Construct Interface](#construct-interface)
9-
- [Owned vs. Unowned Constructs](#owned-vs-unowned-constructs)
10-
- [Abstract Base](#abstract-base)
11-
- [Props](#props)
12-
- [Types](#types)
13-
- [Defaults](#defaults)
14-
- [Flat](#flat)
15-
- [Concise](#concise)
16-
- [Naming](#naming)
17-
- [Property Documentation](#property-documentation)
18-
- [Enums](#enums)
19-
- [Unions](#unions)
20-
- [Attributes](#attributes)
21-
- [Configuration](#configuration)
22-
- [Prefer Additions](#prefer-additions)
23-
- [Dropped Mutations](#dropped-mutations)
24-
- [Factories](#factories)
25-
- [Imports](#imports)
26-
- [“from” Methods](#-from--methods)
27-
- [From-attributes](#from-attributes)
28-
- [Roles](#roles)
29-
- [Resource Policies](#resource-policies)
30-
- [VPC](#vpc)
31-
- [Grants](#grants)
32-
- [Metrics](#metrics)
33-
- [Events](#events)
34-
- [Connections](#connections)
35-
- [Integrations](#integrations)
36-
- [State](#state)
37-
- [Physical Names - TODO](#physical-names---todo)
38-
- [Tags](#tags)
39-
- [Secrets](#secrets)
40-
- [Project Structure](#project-structure)
41-
- [Code Organization](#code-organization)
42-
- [Implementation](#implementation)
43-
- [General Principles](#general-principles)
44-
- [Construct IDs](#construct-ids)
45-
- [Errors](#errors)
46-
- [Input Validation](#input-validation)
47-
- [Avoid Errors If Possible](#avoid-errors-if-possible)
48-
- [Never Catch Exceptions](#never-catch-exceptions)
49-
- [Post Validation](#post-validation)
50-
- [Attached Errors/Warnings](#attached-errors-warnings)
51-
- [Tokens](#tokens)
52-
- [Documentation](#documentation)
53-
- [Inline Documentation](#inline-documentation)
54-
- [Readme](#readme)
55-
- [Testing](#testing)
56-
- [Unit tests](#unit-tests)
57-
- [Integration tests](#integration-tests)
58-
- [Versioning](#versioning)
59-
- [Naming & Style](#naming---style)
60-
- [Naming Conventions](#naming-conventions)
61-
- [Coding Style](#coding-style)
62-
633
The AWS Construct Library is a rich class library of CDK constructs which
644
represent all resources offered by the AWS Cloud and higher-level constructs for
655
achieving common tasks.
@@ -68,6 +8,68 @@ The purpose of this document is to provide guidelines for designing the APIs in
688
the AWS Construct Library in order to ensure a consistent and integrated
699
experience across the entire AWS surface area.
7010

11+
* [Preface](#preface)
12+
* [What's Included](#what-s-included)
13+
* [API Design](#api-design)
14+
* [Modules](#modules)
15+
* [Construct Class](#construct-class)
16+
* [Construct Interface](#construct-interface)
17+
* [Owned vs. Unowned Constructs](#owned-vs-unowned-constructs)
18+
* [Abstract Base](#abstract-base)
19+
* [Props](#props)
20+
* [Types](#types)
21+
* [Defaults](#defaults)
22+
* [Flat](#flat)
23+
* [Concise](#concise)
24+
* [Naming](#naming)
25+
* [Property Documentation](#property-documentation)
26+
* [Enums](#enums)
27+
* [Unions](#unions)
28+
* [Attributes](#attributes)
29+
* [Configuration](#configuration)
30+
* [Prefer Additions](#prefer-additions)
31+
* [Dropped Mutations](#dropped-mutations)
32+
* [Factories](#factories)
33+
* [Imports](#imports)
34+
* [“from” Methods](#-from--methods)
35+
* [From-attributes](#from-attributes)
36+
* [Roles](#roles)
37+
* [Resource Policies](#resource-policies)
38+
* [VPC](#vpc)
39+
* [Grants](#grants)
40+
* [Metrics](#metrics)
41+
* [Events](#events)
42+
* [Connections](#connections)
43+
* [Integrations](#integrations)
44+
* [State](#state)
45+
* [Physical Names - TODO](#physical-names---todo)
46+
* [Tags](#tags)
47+
* [Secrets](#secrets)
48+
* [Project Structure](#project-structure)
49+
* [Code Organization](#code-organization)
50+
* [Implementation](#implementation)
51+
* [General Principles](#general-principles)
52+
* [Construct IDs](#construct-ids)
53+
* [Errors](#errors)
54+
* [Avoid Errors If Possible](#avoid-errors-if-possible)
55+
* [Error reporting mechanism](#error-reporting-mechanism)
56+
* [Throwing exceptions](#throwing-exceptions)
57+
* [Never Catch Exceptions](#never-catch-exceptions)
58+
* [Attaching (lazy) Validators](#attaching--lazy--validators)
59+
* [Attaching Errors/Warnings](#attaching-errors-warnings)
60+
* [Error messages](#error-messages)
61+
* [Tokens](#tokens)
62+
* [Documentation](#documentation)
63+
* [Inline Documentation](#inline-documentation)
64+
* [Readme](#readme)
65+
* [Testing](#testing)
66+
* [Unit tests](#unit-tests)
67+
* [Integration tests](#integration-tests)
68+
* [Versioning](#versioning)
69+
* [Naming & Style](#naming---style)
70+
* [Naming Conventions](#naming-conventions)
71+
* [Coding Style](#coding-style)
72+
7173
## Preface
7274

7375
As much as possible, the guidelines in this document are enforced using the

pack.sh

+10
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,16 @@ for dir in $(find packages -name dist | grep -v node_modules | grep -v run-wrapp
6363
rsync -a $dir/ ${distdir}/
6464
done
6565

66+
# Record the dependency order of NPM packages into a file
67+
# (This file will be opportunistically used during publishing)
68+
#
69+
# Manually sort 'aws-cdk' to the end, as the 'cdk init' command has implicit dependencies
70+
# on other packages (that should not appear in 'package.json' and so
71+
# there is no way to tell lerna about these).
72+
for dir in $(lerna ls --toposort -p | grep -v packages/aws-cdk) $PWD/packages/aws-cdk; do
73+
(cd $dir/dist/js && ls >> ${distdir}/js/npm-publish-order.txt) || true
74+
done
75+
6676
# Remove a JSII aggregate POM that may have snuk past
6777
rm -rf dist/java/software/amazon/jsii
6878

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
"fs-extra": "^9.1.0",
1919
"graceful-fs": "^4.2.6",
2020
"jest-junit": "^12.0.0",
21-
"jsii-diff": "^1.23.0",
22-
"jsii-pacmak": "^1.23.0",
23-
"jsii-rosetta": "^1.23.0",
21+
"jsii-diff": "^1.24.0",
22+
"jsii-pacmak": "^1.24.0",
23+
"jsii-rosetta": "^1.24.0",
2424
"lerna": "^3.22.1",
2525
"standard-version": "^9.1.1",
2626
"typescript": "~3.9.9"

packages/@aws-cdk/alexa-ask/package.json

-3
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@
2626
"Framework :: AWS CDK",
2727
"Framework :: AWS CDK :: 1"
2828
]
29-
},
30-
"go": {
31-
"moduleName": "github.com/aws/aws-cdk-go"
3229
}
3330
},
3431
"projectReferences": true

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

-3
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@
2626
"Framework :: AWS CDK",
2727
"Framework :: AWS CDK :: 1"
2828
]
29-
},
30-
"go": {
31-
"moduleName": "github.com/aws/aws-cdk-go"
3229
}
3330
},
3431
"outdir": "dist",

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"cdk-build-tools": "0.0.0",
2626
"jest": "^26.6.3",
2727
"pkglint": "0.0.0",
28-
"ts-jest": "^26.5.2"
28+
"ts-jest": "^26.5.3"
2929
},
3030
"dependencies": {
3131
"@aws-cdk/cloud-assembly-schema": "0.0.0",

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

-3
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@
2626
"Framework :: AWS CDK",
2727
"Framework :: AWS CDK :: 1"
2828
]
29-
},
30-
"go": {
31-
"moduleName": "github.com/aws/aws-cdk-go"
3229
}
3330
},
3431
"projectReferences": true

0 commit comments

Comments
 (0)