RequestContext

RequestContext

RequestContext

The RequestContext holds information relevant to the current request, which may be required at various points of the stack.

Signature

class RequestContext {
  static deserialize(ctxObject: SerializedRequestContext) => RequestContext;
  serialize() => SerializedRequestContext;
  apiType: ApiType
  channel: Channel
  channelId: ID
  languageCode: LanguageCode
  session: CachedSession | undefined
  activeUserId: ID | undefined
  isAuthorized: boolean
  authorizedAsOwnerOnly: boolean
  translate(key: string, variables?: { [k: string]: any }) => string;
}

Members

deserialize

static method
type:
(ctxObject: SerializedRequestContext) => RequestContext
Creates a new RequestContext object from a plain object which is the result of a JSON serialization - deserialization operation.

serialize

method
type:
() => SerializedRequestContext

apiType

property
type:
ApiType

channel

property
type:
Channel

channelId

property
type:
ID

languageCode

property
type:
LanguageCode

session

property
type:
CachedSession | undefined

activeUserId

property
type:
ID | undefined

isAuthorized

property
type:
boolean
True if the current session is authorized to access the current resolver method.

authorizedAsOwnerOnly

property
type:
boolean
True if the current anonymous session is only authorized to operate on entities that are owned by the current session.

translate

method
type:
(key: string, variables?: { [k: string]: any }) => string
Translate the given i18n key