Skip to content

10.x#133

Closed
eladb wants to merge 42 commits into
masterfrom
4.x
Closed

10.x#133
eladb wants to merge 42 commits into
masterfrom
4.x

Conversation

@eladb
Copy link
Copy Markdown
Contributor

@eladb eladb commented Jul 5, 2020

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

Elad Ben-Israel 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()`.
Elad Ben-Israel 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.
Elad Ben-Israel 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.
@eladb eladb changed the title 4.x 10.x Jul 20, 2020
@eladb
Copy link
Copy Markdown
Contributor Author

eladb commented Oct 4, 2020

Closing in favor of #263

@eladb eladb closed this Oct 4, 2020
@eladb eladb deleted the 4.x branch December 13, 2020 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant