UNPKG

chimp

Version:

Your development companion for doing quality, faster.

19 lines (18 loc) 746 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const graphql_tag_1 = tslib_1.__importDefault(require("graphql-tag")); const validateUniqueName_1 = tslib_1.__importDefault(require("./validateUniqueName")); exports.default = (graphqlString) => { const graphqlAST = (0, graphql_tag_1.default) ` ${graphqlString} `; const interfacesTypeDefs = graphqlAST.definitions .filter((d) => ['InterfaceTypeDefinition'].includes(d.kind)) // @ts-ignore .map((f) => f.name.value); (0, validateUniqueName_1.default)(interfacesTypeDefs, (name) => { throw new Error(`Duplicate interface name found: ${name}`); }); return interfacesTypeDefs; };