AIDK API Reference / aidk-nestjs / EngineContextInterceptor
Class: EngineContextInterceptor ​
Defined in: packages/nestjs/src/interceptors/engine-context.interceptor.ts:29
Interceptor that sets up execution context for engine operations. Extracts user/tenant/thread IDs from request and sets them in async-local storage.
The context is available during:
- Controller method execution (synchronous)
- Engine.stream()/execute() calls (they capture and propagate context internally)
Context is also attached to the request object via attachContext() from aidk-server, making it accessible in guards, decorators, and other middleware via getContext(request).
Note: If you need context in custom RxJS operators or async callbacks outside the Engine, use Context.run() explicitly.
Implements ​
NestInterceptor
Constructors ​
Constructor ​
new EngineContextInterceptor(engine: Engine): EngineContextInterceptor;Defined in: packages/nestjs/src/interceptors/engine-context.interceptor.ts:30
Parameters ​
| Parameter | Type |
|---|---|
engine | Engine |
Returns ​
EngineContextInterceptor
Methods ​
intercept() ​
intercept(context: ExecutionContext, next: CallHandler): Observable<any>;Defined in: packages/nestjs/src/interceptors/engine-context.interceptor.ts:32
Method to implement a custom interceptor.
Parameters ​
| Parameter | Type | Description |
|---|---|---|
context | ExecutionContext | an ExecutionContext object providing methods to access the route handler and class about to be invoked. |
next | CallHandler | a reference to the CallHandler, which provides access to an Observable representing the response stream from the route handler. |
Returns ​
Observable<any>
Implementation of ​
NestInterceptor.intercept