Reference

runWithRequestState

Runs work in a fresh request state scope using installed AsyncLocalStorage. Disposes initializer resources when the callback returns or its promise settles. Await all work, including stream consumption, inside the callback.

Signature

function runWithRequestState<T>(callback: (): T): T