( schema: GraphQLSchema, ast: DocumentNode, )
| 39 | } |
| 40 | |
| 41 | export function extractTypes( |
| 42 | schema: GraphQLSchema, |
| 43 | ast: DocumentNode, |
| 44 | ): Set<string> { |
| 45 | const types = new Set<string>() |
| 46 | |
| 47 | const typeInfo = new TypeInfo(schema) |
| 48 | |
| 49 | visit( |
| 50 | ast, |
| 51 | visitWithTypeInfo(typeInfo, { |
| 52 | Field() { |
| 53 | const field = typeInfo.getFieldDef() |
| 54 | if (field) { |
| 55 | const namedType = getNamedType(field.type) |
| 56 | const scalar = isScalarType(namedType) |
| 57 | if (!scalar) { |
| 58 | types.add(namedType.name) |
| 59 | } |
| 60 | } |
| 61 | }, |
| 62 | }), |
| 63 | ) |
| 64 | |
| 65 | return types |
| 66 | } |
| 67 | |
| 68 | export async function fetchSchema( |
| 69 | introspectionUrl: string, |
no outgoing calls
no test coverage detected