MCPcopy
hub / github.com/ardatan/graphql-tools / getFieldSpecifiers

Function getFieldSpecifiers

packages/utils/src/mapSchema.ts:486–506  ·  view source on GitHub ↗
(schema: GraphQLSchema, typeName: string)

Source from the content-addressed store, hash-verified

484}
485
486function getFieldSpecifiers(schema: GraphQLSchema, typeName: string): SchemaFieldMapperTypes {
487 const type = schema.getType(typeName);
488 const specifiers: SchemaFieldMapperTypes = [MapperKind.FIELD];
489
490 if (isObjectType(type)) {
491 specifiers.push(MapperKind.COMPOSITE_FIELD, MapperKind.OBJECT_FIELD);
492 if (typeName === schema.getQueryType()?.name) {
493 specifiers.push(MapperKind.ROOT_FIELD, MapperKind.QUERY_ROOT_FIELD);
494 } else if (typeName === schema.getMutationType()?.name) {
495 specifiers.push(MapperKind.ROOT_FIELD, MapperKind.MUTATION_ROOT_FIELD);
496 } else if (typeName === schema.getSubscriptionType()?.name) {
497 specifiers.push(MapperKind.ROOT_FIELD, MapperKind.SUBSCRIPTION_ROOT_FIELD);
498 }
499 } else if (isInterfaceType(type)) {
500 specifiers.push(MapperKind.COMPOSITE_FIELD, MapperKind.INTERFACE_FIELD);
501 } else if (isInputObjectType(type)) {
502 specifiers.push(MapperKind.INPUT_OBJECT_FIELD);
503 }
504
505 return specifiers;
506}
507
508function getFieldMapper<F extends GraphQLFieldConfig<any, any> | GraphQLInputFieldConfig>(
509 schema: GraphQLSchema,

Callers 1

getFieldMapperFunction · 0.85

Calls 1

getTypeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…