-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(sdk): refactor connections API #3814
Merged
Merged
Conversation
This file contains 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
Signed-off-by: monada-bot[bot] <[email protected]>
polamoros
approved these changes
Aug 16, 2023
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
8 tasks
Congrats! 🚀 This was released in Wing 0.25.15. |
I love this direction. See my comment on the |
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.
Background: in order for Wing classes to support extending non-Wing classes (#3717), I'm trying to remove the
Resource
class in the SDK so that all classes generated by our compiler just need to extend the ol'construct.Construct
class -- the "base class" of the JSII ecosystem. This is a tricky effort sinceResource
is used in many places, and it collected a lot of responsibilities over the past year.This PR takes a first step towards that by removing the connection-related information from the
Resource
class:wing/libs/wingsdk/src/std/resource.ts
Lines 222 to 223 in 1c9954e
Instead, we now store the information inside the root of the construct tree. It can be accessed through
Connections.of(x)
wherex
is any class instance. Seeconnections.ts
for the full implementation (its short).With this refactoring, I took the opportunity to clean up how connections are modeled. Previously, we were storing each connection twice inside
tree.json
(once next to the connection's source, and a second time next to the connection's target). Now, we just store each connection once, in a flat array insideconnections.json
. (I wasn't sure if it makes more sense to put it in a separate file - I'm interested in feedback on this). I also removed theimplicit
field which wasn't used by the SDK or console anywhere.Checklist
pr/e2e-full
label if this feature requires end-to-end testingBy submitting this pull request, I confirm that my contribution is made under the terms of the Wing Cloud Contribution License.