1 | export function getImplementingTypes(interfaceName, schema) {
|
2 | const allTypesMap = schema.getTypeMap();
|
3 | const result = [];
|
4 | for (const graphqlTypeName in allTypesMap) {
|
5 | const graphqlType = allTypesMap[graphqlTypeName];
|
6 | if ('getInterfaces' in graphqlType) {
|
7 | const allInterfaces = graphqlType.getInterfaces();
|
8 | if (allInterfaces.find(int => int.name === interfaceName)) {
|
9 | result.push(graphqlType.name);
|
10 | }
|
11 | }
|
12 | }
|
13 | return result;
|
14 | }
|