Add method to "suspend" wrappers and reimplement APQs #2321
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.
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:
Wrapper.suspend
which allows "suspending" side effects used in the construction of a Wrapper. This works the same way asEffectfulWrapper
but without having to use ZIO for itEffectfulWrapper
as the type returned from the different methods, we can't change them without breaking binary compatibility.Wrapper[Any]
instead ofWrapper[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 ofApolloPersistence.Live
and reuse it for all queriesApolloPersistedQueries.wrapper(???)
which allows users to provide a customApolloPersistence
implementation