MCPcopy Create free account
hub / github.com/StarpTech/FastGraph / extractTypes

Function extractTypes

src/graphql-utils.ts:41–66  ·  view source on GitHub ↗
(
  schema: GraphQLSchema,
  ast: DocumentNode,
)

Source from the content-addressed store, hash-verified

39}
40
41export 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
68export async function fetchSchema(
69 introspectionUrl: string,

Callers 2

hasIntersectedTypesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected