-
Notifications
You must be signed in to change notification settings - Fork 738
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
Network Rearchitecture #1341
Merged
designatednerd
merged 109 commits into
betas/networking-stack
from
explore/interceptors
Sep 11, 2020
Merged
Network Rearchitecture #1341
Changes from all commits
Commits
Show all changes
109 commits
Select commit
Hold shift + click to select a range
505df39
add noodling from scratch project
designatednerd ccf49c8
change generics on the request chain
designatednerd 1d262ae
add interceptor provider protocol and a couple default implementations
designatednerd 58a2b8d
separate out legacy vs codable parsing
designatednerd c5cd160
bits o'cleanup
designatednerd 7f57d20
Working on legacy request chain...ish
designatednerd 73dc705
add readability extension
designatednerd eff721a
Move cache policy up to base request type
designatednerd 99b1c8f
start adding legacy cache interceptor
designatednerd ad892c6
add send for result to mock transport
designatednerd a63bc5d
use send for result to get an actual result
designatednerd f573bb8
Break off trying to read from the cache too early
designatednerd 1588e1b
Add some documentation to the request chain
designatednerd d671cf1
add additional error interceptor so people can examine errors more di…
designatednerd 3d2f0fb
add and test legacy cache write interceptor
designatednerd e4689a3
move cancellation handling to the chain rather than the individual in…
designatednerd d834070
rearrange a bunch of stuff and make a few things public
designatednerd 085adc5
add quasi-todos for codable interceptor chain
designatednerd 745d3e5
remove fetch source type since it duplicates data in GraphQLResult
designatednerd 97ce0cc
update a ton of documentation
designatednerd ba1823f
add ability to specify callback queue and have chain return value as …
designatednerd c618935
moar docs!
designatednerd ff4b578
initial stab at an upload request
designatednerd 69ce161
initial stab at an APQ interceptor
designatednerd e67e29b
Constrain on GraphQLResult<Operation.Data> rather than more generic `…
designatednerd 103cb9c
remove unused error
designatednerd ac73778
Add APQ interceptor to default interceptors
designatednerd 00beb84
Make sure upload requests are `POST` requests
designatednerd e970fd8
add `uploadForResult` handling to ApolloClient
designatednerd 27975cf
update upload tests to use new architecture
designatednerd aeb85cb
make star wars server tests able to use any network transport
designatednerd 77df5ad
add parsing for http network transport in parse for result
designatednerd 9d93367
make sure store can be passed in when creating networking stack
designatednerd 8576947
update websocket transports to use more generic uploading transport
designatednerd 5f64ff7
add and use max retry interceptor
designatednerd 35cfe85
Add tests for request chain with APQs
designatednerd 1af4e90
Update HTTP response to be optional until created.
designatednerd efd1fec
Actually, data from a GraphQL request should never be nil, so don't a…
designatednerd 9b0718f
Move errors to their specific interceptors so people can tell where t…
designatednerd 68cd516
update todos that need to be resolved before merge to warnings
designatednerd 41467ab
Remove duplicated read interceptor
designatednerd a4c4a4b
add test URLs to test helpers so we stop having to hard-code URLs all…
designatednerd a67423e
use mock instead of HTTP network transport for split network transpor…
designatednerd b1e5f9d
use request chain trainsport for caching roundtrip tests
designatednerd 5a237fa
user request chain transport instead of http transport for non-websoc…
designatednerd b14027b
make sure you can set client name and client version on request chains
designatednerd 444c465
get rid of separate `sendForResult` etc and centralize on a single `s…
designatednerd e3f27fc
update mock URL transport to be a subclass of RequestChain transport,…
designatednerd 7a944ed
Make sure we're checking a thread-safe value for the last received re…
designatednerd 3a73b66
Get rid of now-unnecessary fetch query operation and asynchronous ope…
designatednerd a7f66c3
make sure Apollo Test Support is added to Codegen tests
designatednerd ce42918
Fix build failures in codegen tests
designatednerd b946e18
add default cache policy on request chain network transport
designatednerd 1fd913c
switch APQ tests to using Request Chain Network Transport
designatednerd 6808f9f
make APQ tests async to account for request construction being async …
designatednerd 632285b
add check for persisted query retry failure to APQ interceptor
designatednerd 2e99554
move star wars server tests to using request chain transport by default
designatednerd ace861c
pick fight with future me
designatednerd 660eb0d
update skipped tests in schemes
designatednerd f92ba25
remove old skipped tests in schemes
designatednerd 594eea2
add inititalizer where data is decodable to graphQL result
designatednerd 5a23ee8
Get rid of old HTTPNetworkTransport
designatednerd 2939afe
return the data that didn't parse when it doesn't parse
designatednerd d2bf67f
Make sure public interceptors have public initializers
designatednerd b73084f
add a bunch of tests and test interceptors
designatednerd 3aeb966
Add test to validate empty array of interceptors error
designatednerd 632621f
update request chain to check if there's a result when we run out of …
designatednerd 8f032e8
get rid of now-unnecessary finalizing interceptor
designatednerd 288596f
Update cache write intercetptor to proceed rather than return value s…
designatednerd 2f1b54c
Make sure client gets invalidated on deinit, but only when appropriate.
designatednerd 9cf523d
Add a legacy response property to HTTPResponse to facilitate not havi…
designatednerd b4e0665
fix whitespace sadness
designatednerd 70a38eb
get rid of now-unused context from client
designatednerd 54bea9d
Make sure watcher is cancelled at the end of the test so it doesn't a…
designatednerd 9e20638
temporarily pass nil for extensinons
designatednerd e8b777c
update mock network transport to be able to update network body, also…
designatednerd 2665f7e
use marginally slower parsing for initial parse if we're going to the…
designatednerd a4cb8ba
remove now-unused method
designatednerd 554e659
add workaround for the fact that removing the context means actual fe…
designatednerd ebcb61a
bump timeout on initial fetch expectation for CI
designatednerd 00e79b5
delete removed tests from list of skipped tests in schemes
designatednerd 1e24f0b
get rid of now-unused queue properties
designatednerd 946ce0e
move queue handling down to the network transport level
designatednerd 1da7651
add docs to request chain and request chain network transport
designatednerd 89bdbc3
cancel watcher at the end of watch query tests
designatednerd d785898
Document more things!
designatednerd f80c9c9
Make client name and version non-optional to centralize naming handli…
designatednerd 4abe114
Use a UUID for the task rather than an unsafe mutable raw pointer to …
designatednerd e9879f2
boop fetch expectation time back down
designatednerd c295cd9
add now-required parameters to web socket
designatednerd c6a1f99
fix typo 🤦♀️
designatednerd e363582
use context identifier rather than task identifier to disambiguate id…
designatednerd fdaf7b4
Fix missing documentation
designatednerd 80927a2
rename identifier to context identifier in callback, add docs to apol…
designatednerd ba76ace
fix missed `contextIdentifer`
designatednerd 9516ab2
align cache miss on `.returnCacheDataAndFetch` with existing code
designatednerd e588a52
rm whitespace
designatednerd 624df57
add context identifier to equality comparison on HTTPRequest
designatednerd 4bd0d6a
Remove the retry count from the request and make it a property of the…
designatednerd caead65
documentation for Parseable
designatednerd 2a6df16
make sure errors are public and localized
designatednerd e220b02
don't use an apollo store in the codable transport (yet?)
designatednerd b09ffcb
Make sure Foundation is imported where needed
designatednerd 795af72
make sure foundation is imported on SplitNetworkTransport
designatednerd bc42ea5
move setup for additional headers into the initializer of HTTPRequest
designatednerd d18aab3
add debug description for http request
designatednerd f35ae0a
completely rewrite the `Initialization` document to handle setting up…
designatednerd 3f2a6e7
Make provided interceptor providers open so they can be subclassed.
designatednerd 38135ee
update tutorial for request chain network transport
designatednerd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import Foundation | ||
|
||
/// An error interceptor called to allow further examination of error data when an error occurs in the chain. | ||
public protocol ApolloErrorInterceptor { | ||
|
||
/// Asynchronously handles the receipt of an error at any point in the chain. | ||
/// | ||
/// - Parameters: | ||
/// - error: The received error | ||
/// - chain: The chain the error was received on | ||
/// - request: The request, as far as it was constructed | ||
/// - response: [optional] The response, if one was received | ||
/// - completion: The completion closure to fire when the operation has completed. Note that if you call `retry` on the chain, you will not want to call the completion block in this method. | ||
func handleErrorAsync<Operation: GraphQLOperation>( | ||
error: Error, | ||
chain: RequestChain, | ||
request: HTTPRequest<Operation>, | ||
response: HTTPResponse<Operation>?, | ||
completion: @escaping (Result<GraphQLResult<Operation.Data>, Error>) -> Void) | ||
} |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if it would work, but what do you think of instead using protocol for this interceptor, actually, use just a function. For instance,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would wayyyyyy rather have this as a protocol, particularly since it gives longer term flexibility to add more methods if needed.