Skip to main content

ExplicitGraphQLContext

API Docs


Type Alias: ExplicitGraphQLContext

ExplicitGraphQLContext = object

Defined in: src/graphql/context.ts:47

Type of the transport protocol agnostic explicit context object that is merged with the implcit mercurius context object and passed to the graphql resolvers each time they resolve a graphql operation at runtime.

Properties

cache

cache: CacheService | ReturnType<typeof metricsCacheProxy>

Defined in: src/graphql/context.ts:51

Redis-backed cache service for caching entities and query results.


optional cookie: object

Defined in: src/graphql/context.ts:88

Cookie helper for setting HTTP-Only authentication cookies. Only available for HTTP requests (not WebSocket subscriptions).

clearAuthCookies()

clearAuthCookies: () => void

Clears both authentication cookies (for logout).

Returns

void

getRefreshToken()

getRefreshToken: () => string | undefined

Gets the refresh token from cookies if present.

Returns

string | undefined

setAuthCookies()

setAuthCookies: (accessToken, refreshToken) => void

Sets both access token and refresh token as HTTP-Only cookies.

Parameters
accessToken

string

The JWT access token

refreshToken

string

The refresh token

Returns

void


currentClient

currentClient: CurrentClient

Defined in: src/graphql/context.ts:52


dataloaders

dataloaders: Dataloaders

Defined in: src/graphql/context.ts:56

Request-scoped DataLoaders for batching database queries.


drizzleClient

drizzleClient: FastifyInstance["drizzleClient"]

Defined in: src/graphql/context.ts:57


envConfig

envConfig: Pick<FastifyInstance["envConfig"], "API_ACCOUNT_LOCKOUT_DURATION_MS" | "API_ACCOUNT_LOCKOUT_THRESHOLD" | "API_BASE_URL" | "API_COMMUNITY_NAME" | "API_REFRESH_TOKEN_EXPIRES_IN" | "API_PASSWORD_RESET_USER_TOKEN_EXPIRES_SECONDS" | "API_PASSWORD_RESET_ADMIN_TOKEN_EXPIRES_SECONDS" | "API_EMAIL_VERIFICATION_TOKEN_EXPIRES_SECONDS" | "API_EMAIL_VERIFICATION_TOKEN_HMAC_SECRET" | "API_COOKIE_DOMAIN" | "API_IS_SECURE_COOKIES" | "API_JWT_EXPIRES_IN" | "API_AWS_ACCESS_KEY_ID" | "API_AWS_SECRET_ACCESS_KEY" | "API_AWS_SES_REGION" | "API_AWS_SES_FROM_EMAIL" | "API_AWS_SES_FROM_NAME" | "API_FRONTEND_URL" | "RECAPTCHA_SECRET_KEY" | "RECAPTCHA_SCORE_THRESHOLD">

Defined in: src/graphql/context.ts:58


jwt

jwt: object

Defined in: src/graphql/context.ts:81

sign()

sign: (payload) => string

Parameters
payload

ExplicitAuthenticationTokenPayload

Returns

string


log

log: AppLogger

Defined in: src/graphql/context.ts:104


minio

minio: FastifyInstance["minio"]

Defined in: src/graphql/context.ts:105


notification?

optional notification: object

Defined in: src/graphql/context.ts:114

Per-request notification helper. Implementations may enqueue notifications for delivery and support flush() to perform delivery after transaction commit.

emitEventCreatedImmediate()?

optional emitEventCreatedImmediate: (payload, ctx) => Promise<void>

Parameters
payload
creatorName

string

eventId

string

eventName

string

organizationId

string

organizationName

string

startDate

string

ctx

GraphQLContext

Returns

Promise<void>

enqueueEventCreated()

enqueueEventCreated: (payload) => void

Parameters
payload
creatorName

string

eventId

string

eventName

string

organizationId

string

organizationName

string

startDate

string

Returns

void

enqueueSendEventInvite()

enqueueSendEventInvite: (payload) => void

Parameters
payload
eventId?

string

eventName?

string

invitationToken

string

invitationUrl

string

inviteeEmail

string

inviteeName?

string

inviterId

string

organizationId

string

Returns

void

flush()

flush: (ctx) => Promise<void>

Parameters
ctx

GraphQLContext

Returns

Promise<void>


oauthProviderRegistry?

optional oauthProviderRegistry: OAuthProviderRegistry

Defined in: src/graphql/context.ts:109

OAuth provider registry for accessing configured OAuth providers.


perf?

optional perf: PerformanceTracker

Defined in: src/graphql/context.ts:151

Request-scoped performance tracker for monitoring operation durations, cache behavior (hits/misses), and GraphQL complexity scores. Available in all GraphQL contexts (HTTP and WebSocket).