Proper way to compose 'request' middleware to get context type inference without duplication?
request middleware in order to get context type inference middleware will be run more than once and am wondering if there's a proper strategy for composing them to get type inference but not duplication. I did see in the docs that for server function middleware that can be deduped by adding it to globals.Here's an example:
addSessionToContext - makes session from request available in later contextrequireSession - checks the context has a sessionrequireUserAdmin - checks context session user roleused in a server route middleware array:
[addSessionToContext, requireSession, requireUserAdmin]