1import { CallHandler, ExecutionContext, Injectable, NestInterceptor } from "@nestjs/common";
2import { Observable } from "rxjs";
3import { ActorContext } from "../actor-context.js";
4
5
14@Injectable()
15export class ActorContextInterceptor implements NestInterceptor {
16 intercept(context: ExecutionContext, next: CallHandler): Observable<unknown> {
17 const req = context.switchToHttp().getRequest<{ auth?: unknown }>();
18 return ActorContext.run(req.auth as never, () => next.handle());
19 }
20}
21