UNPKG

@nestjs/graphql

Version:

Nest - modern, fast, powerful node.js web framework (@graphql)

26 lines (25 loc) 799 B
import { ExecutionContextHost } from '@nestjs/core/helpers/execution-context-host.js'; import { normalizeResolverArgs } from '../utils/normalize-resolver-args.js'; export class GqlExecutionContext extends ExecutionContextHost { static create(context) { const type = context.getType(); const gqlContext = new GqlExecutionContext(normalizeResolverArgs(context.getArgs()), context.getClass(), context.getHandler()); gqlContext.setType(type); return gqlContext; } getType() { return super.getType(); } getRoot() { return this.getArgByIndex(0); } getArgs() { return this.getArgByIndex(1); } getContext() { return this.getArgByIndex(2); } getInfo() { return this.getArgByIndex(3); } }