Skip to content
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

Add method to "suspend" wrappers and reimplement APQs #2321

Merged
merged 4 commits into from
Jul 2, 2024

Conversation

kyri-petrou
Copy link
Collaborator

Should have made this PR prior to the 2.8.0 release, but I guess it'll have to wait till 2.9.0 🥲

Main changes in this PR:

  • Added Wrapper.suspend which allows "suspending" side effects used in the construction of a Wrapper. This works the same way as EffectfulWrapper but without having to use ZIO for it
  • Rewrote a few wrappers to use suspended wrappers instead. Unfortunately, since we used EffectfulWrapper as the type returned from the different methods, we can't change them without breaking binary compatibility.
  • Rewrote APQs to return a Wrapper[Any] instead of Wrapper[ApolloPersistence]. There are a few reasons for this, but mainly this is because it makes it quite annoying to integrate this wrapper in non-ZIO applications, especially if the users are not familiar with ZLayers and how to eliminate dependencies from the environment. Users now have 2 ways to use this wrapper:
    • ApolloPersistedQueries.wrapper, which will create a new instance of ApolloPersistence.Live and reuse it for all queries
    • ApolloPersistedQueries.wrapper(???) which allows users to provide a custom ApolloPersistence implementation

@kyri-petrou kyri-petrou added the breaking change The PR contains binary incompatible changes label Jun 29, 2024
@kyri-petrou
Copy link
Collaborator Author

I reverted the changes to the methods with Clock implicits, and also reverted the deletion of ApolloCache. This way the PR is fully binary compatible (I removed the label as well)

@kyri-petrou kyri-petrou removed the breaking change The PR contains binary incompatible changes label Jul 1, 2024
@@ -272,51 +268,6 @@ object WrappersSpec extends ZIOSpecDefault {
}
)
},
test("Apollo Caching") {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I won't revert this one, just to make it easier to delete the file in the next major release

@kyri-petrou kyri-petrou merged commit ce6e49a into series/2.x Jul 2, 2024
11 checks passed
@kyri-petrou kyri-petrou deleted the suspended-wrappers branch July 2, 2024 00:11
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.

2 participants