Started work on it, but it’s still WIP (and it works both client and server side):
You can see an example of it in use in the test code: