1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, '__esModule', {
|
4 | value: true,
|
5 | });
|
6 | exports.typeFromAST = typeFromAST;
|
7 |
|
8 | var _kinds = require('../language/kinds.js');
|
9 |
|
10 | var _definition = require('../type/definition.js');
|
11 |
|
12 | function typeFromAST(schema, typeNode) {
|
13 | switch (typeNode.kind) {
|
14 | case _kinds.Kind.LIST_TYPE: {
|
15 | const innerType = typeFromAST(schema, typeNode.type);
|
16 | return innerType && new _definition.GraphQLList(innerType);
|
17 | }
|
18 |
|
19 | case _kinds.Kind.NON_NULL_TYPE: {
|
20 | const innerType = typeFromAST(schema, typeNode.type);
|
21 | return innerType && new _definition.GraphQLNonNull(innerType);
|
22 | }
|
23 |
|
24 | case _kinds.Kind.NAMED_TYPE:
|
25 | return schema.getType(typeNode.name.value);
|
26 | }
|
27 | }
|