UNPKG

@cran/gql.core

Version:

Cran/GraphQL Core Utilities

15 lines (14 loc) 677 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const schema_1 = require("graphql/type/schema"); const parser_1 = require("graphql/language/parser"); const typeFromAST_1 = require("graphql/utilities/typeFromAST"); const original = schema_1.GraphQLSchema.prototype.getType; schema_1.GraphQLSchema.prototype.getType = function getType(name) { let type = original.call(this, name); // prevent internal checks failing (apollo federation looks for _Service) if (!type && "_" !== name[0]) { type = (0, typeFromAST_1.typeFromAST)(this, (0, parser_1.parse)(`type t{t:${name}}`).definitions[0].fields[0].type); } return type; };