Add DebugEvent system to urql client for devtools and debugging (#608)
* Add event support to urql client
* Allow for weaker types
* Add type safety (opt-in)
* Disable in prod
* Apply suggestions from code review
Co-Authored-By: Will Golledge <35961363+wgolledge@users.noreply.github.com>
* Add missing fixes
* Force exchange to be provided with event.
* Rename eventTarget to debugTarget
* Compile away dispatchEvent (#628)
* compile away dispatchEvent
* correct typo
* don't enforce callee name (client)
* Add optional to debugTarget type
* Rename to debugTarget in babel plugin
* rename files
* fix bug where objProperty is undefined
* fix linting
* add debugTarget to tests
* fix tests
* Add debug dispatches for fetch + fallback exchanges (#659)
* Add debug dispatching for fetchExchange
Co-authored-by: Will Golledge <wiggiumg@gmail.com>
* Add fallback exchange debugEvent dispatch
Co-authored-by: Will Golledge <wiggiumg@gmail.com>
* Amend Jovis comments
* Fix fetch tests
Co-authored-by: Will Golledge <wiggiumg@gmail.com>
* Add debugEvent dispatches for retryExchange and graphcacheExchange (#660)
* Add debugEvent dispatches for both the retryExchange and graphcacheExchange
Co-Authored-By: Jovi De Croock <jovi.decroock@formidable.com>
* Update changeset
* Append source to debug event on call
* Update dispatchEvent calls
* Isolate debug function construction to composeExchanges
* Fix cache exchange tests
* Fix graphcache exchange tests
* Fix fallback exchange tests
* Update client snapshot
* Update tests for subscription exchange
* Update tests for populate exchange
* Update tests for fetch exchange
* Update external exchanges
* Fix more tests
* Add test for dispatch function
* Add test for Target
* update withurqlclient tests
* Add babel transform changes
* update babel plugin (#671)
* update babel plugin
* add backwards compat check
* improve readability
* remove types import
* undo templating due to the addition of semicolons
Co-authored-by: Andy Richardson <andy.john.richardson@gmail.com>
* Update transform-debug-target.js
* Replace bad merge
* Delete debug.ts
* Add timestamp and uid to events
* Remove id
* Update test
* Update packages/core/src/types.ts
* Show error for successful network request with GraphQL errors
* Fix renamed variable
* Update exchanges/graphcache/src/cacheExchange.ts
* Apply suggestions from code review
* Update exchanges/retry/src/retryExchange.ts
* Use source for debug events (#710)
* Use source for debug events
* Update exposed API
* Fix type import
* Stop exposing debugTarget.dispatchDebug on Client
This makes the composition a little nicer, if we also
don't read it in composeExchanges.
* Restore backwards-compatibility by preserving fallbackExchangeIO
* Fix up unit tests
* Update changeset
The exchange packages depend on @urql/core and will bump their minimum
dependency range to include the new core version anyway.
* Update multipartFetchExchange and fix fetchSuccess condition
There's no clear "success" / "error" condition when we get a
result. A result can contain data and errors, hence we should
only log a result as a definitive error if we also don't have
data.
* Update changeset
* Fix compose.test.ts
* Update transform-debug-target transform
dispatchDebug cannot be undefined anymore (but will be a noop).
We can simply wrap the call expression in a ternary and let Terser/Closure
take care of eliminating the dead variables and assignments. This also
results in a lower chance of having a dead function stick around, which was
defined in the ObjectProperty transform.
* Update Client snapshot
* Add link to devtools to the changeset
Co-authored-by: Will Golledge <35961363+wgolledge@users.noreply.github.com>
Co-authored-by: Jovi De Croock <jovi.decroock@formidable.com>
Co-authored-by: Will Golledge <wiggiumg@gmail.com>
Co-authored-by: Phil Pluckthun <phil@kitten.sh>
authored by