Conversation
added 24 commits
July 5, 2020 13:44
Introduce `construct.node` as an alternative to `Node.of(construct)` in order to be compatible with the AWS CDK. This means that we no longer need a way to customize the construct node factory, so the relevant types were also removed. BREAKING CHANGE: `Node.of(construct)` was replaced with `construct.node`.
Since this is a pre-release, only publish to the @next npm dist-tag and disable releases to other languages.
Aspects are abusable since their application is order-sensitive and can mutate the construct tree. BREAKING CHANGE: aspects are no longer supported as part of the constructs library, so `node.applyAspect()` is no longer available. The AWS CDK implements aspects through `Aspects.of(construct).apply()`.
We realized that synthesis (and prepare) is a domain-specific activity and therefore both in AWS CDK and cdk8s it is implemented centrally at the app level. Introduce `lock()` and `unlock()` as public APIs to enable domains to lock the tree during their synthesis operations. BREAKING CHANGE: constructs no longer have an `onPrepare()` and `onSynthesis()` hooks. See domain-specific (such as AWS CDK and cdk8s) for alternatives.
Instead of a protected method called `onValidate()` which pollutes the namespace for all constructs, introduce an interface `IValidation` which contains a `validate(): string[]` method. The `construct.node.validate()` method can be used to validate any construct. If it implements `IValidation`, it's `validate()` method will be called. Otherwise, an empty list will be returned. BREAKING CHANGE: to add validation logic for constructs, implement the `IValidation` interface. * The `construct.node.validate()` method no longer validates the entire tree, but only the specific construct on which it is called.
Re-introduce IDependable which represents an abstract set of construct dependencies. Any object can implement `IDependable` by calling `Dependable.implement(obj, ...)`. The `DependencyGroup` class represents a group of dependencies. All `Construct`s are `IDependable`s. BREAKING CHANGE: `construct.node.dependencies` is not transitive anymore. It returns the set of dependencies added directly to the node. The `Dependency` type has also been removed as a result since it's not needed any longer.
Stack traces are only attached if `addMetadata()` is called with the option `stackTrace: true`.
`addInfo()`, `addWarning()`, and `addError()` also attach stack traces.
BREAKING CHANGE: Stack traces are not attached to metadata entries by default. To include stack trace in a metadata entry, pass `{ stackTrace: true }` as the 3rd parameter, which is now of type `MetadataOptions` and not a `fromFunction` pointer.
- lock() and unlock() - tryRemoveChild() - toString() - validate()
Allow specifying a JavaScript function to start from when capturing stack traces.
Introduce `ConstructScopeSettings` as a way to configure `Construct`-related behaviors at the scope level.
ConstructScopeSettings.of(scope).disableStackTraces();
`ConsructMetadata` has been removed.
To reduce the friction of transitioning to v4.x, revert `Dependency.dependencies` to `Dependency.dependencyRoots` and add a alias for `Dependency.of()` called `Dependency.get()`.
added 5 commits
July 12, 2020 11:31
a static method that returns true if an object is a construct regardless of which instance of "constructs" it was created from.
added 9 commits
July 12, 2020 17:40
Replace the interface-based approach with an explicit validation list.
`node.relocate(root)` allows changing the root of a construct scope in order to influence how `node.path` and `node.uniqueId` are calculated. This can be used in refactoring scenarios in order to preserve the original names of resources within that scope.
This reverts commit d5e4420.
Contributor
Author
|
Closing in favor of #263 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license