UNPKG

679 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.getImplementingTypes = void 0;
4function getImplementingTypes(interfaceName, schema) {
5 const allTypesMap = schema.getTypeMap();
6 const result = [];
7 for (const graphqlTypeName in allTypesMap) {
8 const graphqlType = allTypesMap[graphqlTypeName];
9 if ('getInterfaces' in graphqlType) {
10 const allInterfaces = graphqlType.getInterfaces();
11 if (allInterfaces.find(int => int.name === interfaceName)) {
12 result.push(graphqlType.name);
13 }
14 }
15 }
16 return result;
17}
18exports.getImplementingTypes = getImplementingTypes;