UNPKG

1.02 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.GqlExecutionContext = void 0;
4const execution_context_host_1 = require("@nestjs/core/helpers/execution-context-host");
5const normalize_resolver_args_1 = require("../utils/normalize-resolver-args");
6class GqlExecutionContext extends execution_context_host_1.ExecutionContextHost {
7 static create(context) {
8 const type = context.getType();
9 const gqlContext = new GqlExecutionContext((0, normalize_resolver_args_1.normalizeResolverArgs)(context.getArgs()), context.getClass(), context.getHandler());
10 gqlContext.setType(type);
11 return gqlContext;
12 }
13 getType() {
14 return super.getType();
15 }
16 getRoot() {
17 return this.getArgByIndex(0);
18 }
19 getArgs() {
20 return this.getArgByIndex(1);
21 }
22 getContext() {
23 return this.getArgByIndex(2);
24 }
25 getInfo() {
26 return this.getArgByIndex(3);
27 }
28}
29exports.GqlExecutionContext = GqlExecutionContext;