Skip to content

basalt / core/src / RequestContext

Interface: RequestContext ​

Defined in: core/src/context.ts:14

Per-request/job context, propagated through the whole call stack via AsyncLocalStorage. Packages extend it via module augmentation:

declare module '@basaltkit/core' { interface RequestContext { tenant?: { id: string } } }

Indexable ​

> [key: string]: unknown

Properties ​

amr? ​

> optional amr?: string[]

Defined in: auth/src/plugin.ts:23

Authentication methods of the current credential (pwd, fed, mfa), from the access token's amr claim or the session. Absent for API keys and for tokens / sessions issued without it.


apiKey? ​

> optional apiKey?: ApiKeyContext

Defined in: auth/src/apikeys-plugin.ts:10

Set when the request authenticated with an API key instead of a session.


client? ​

> optional client?: object

Defined in: audit/src/index.ts:28

Client information of the current HTTP request, set by auditPlugin({ requestContext: true }) through an http:enrichers entry (so every adapter — fastify, express, hono — provides it).

ip? ​

> optional ip?: string

userAgent? ​

> optional userAgent?: string


container? ​

> optional container?: Container

Defined in: http/src/pipeline.ts:21

Per-request DI scope — scoped instances live here.


correlationId? ​

> optional correlationId?: string

Defined in: core/src/context.ts:16


db? ​

> optional db?: unknown

Defined in: prisma/src/index.ts:126

Database client of the current request/tenant, set by prismaPlugin.


requestId? ​

> optional requestId?: string

Defined in: core/src/context.ts:15


tenant? ​

> optional tenant?: Tenant

Defined in: tenancy/src/index.ts:71

The tenant of the current request/job, set by tenancy.


user? ​

> optional user?: PublicUser

Defined in: auth/src/plugin.ts:17

The authenticated user of the current request, set by auth.

Released under the MIT License.