Sync API Refactor
PR Checklist
- [ ] Addresses an existing open issue: fixes #000
- [ ] That issue was marked as
status: accepting prs - [ ] Steps in CONTRIBUTING.md were taken
Overview
Refactor sync api to be easier to follow and map nicely with the new async api (wip)
- use maps/sets for more declarative code
- rename things Change the api for guards to be separate from that of serialize/deserialize type handlers
- give guards their own configuration, but still run them for any unhandled values
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| tupleson-async | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Jan 4, 2024 6:35am |
Codecov Report
Attention: 300 lines in your changes are missing coverage. Please review.
Comparison is base (
9bf904f) 94.08% compared to head (9aa3dc1) 85.64%. Report is 1 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #87 +/- ##
==========================================
- Coverage 94.08% 85.64% -8.44%
==========================================
Files 31 40 +9
Lines 1876 2864 +988
Branches 194 258 +64
==========================================
+ Hits 1765 2453 +688
- Misses 109 407 +298
- Partials 2 4 +2
| Flag | Coverage Δ | |
|---|---|---|
| unit | 85.64% <73.30%> (-8.44%) |
:arrow_down: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
I've got the async serializer (mostly) spitting out the expected result. The main feature here is using an iterative algorithm for serialization, rather than a recursive one. There's more to do, but this is illustrative enough to be a PoC.
The benefits I'm hoping to achieve:
- Better error handling
- Deep-serialization of of arbitrarily complex values (e.g.
Promise<AsyncIterable<Promise<string>>>) - Separation from, but interoperability with, the transport layer
- Separation of concerns between streaming and serializing
- An API that is easy to customize for your use-case (websocket, http JSON streams, http2/3 SSE streams, etc)
- AsyncGenerators are a first class-citizen
Todos:
- Clean up & normalize error handling
- Change string flags to numbers
- Improve serialization output of built-ins (e.g. Arrrays, POJOs)
- Deserialization
- Lots of cleanup