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

Function getFieldMapper

packages/utils/src/mapSchema.ts:508–524  ·  view source on GitHub ↗
(
  schema: GraphQLSchema,
  schemaMapper: SchemaMapper,
  typeName: string,
)

Source from the content-addressed store, hash-verified

506}
507
508function getFieldMapper<F extends GraphQLFieldConfig<any, any> | GraphQLInputFieldConfig>(
509 schema: GraphQLSchema,
510 schemaMapper: SchemaMapper,
511 typeName: string,
512): GenericFieldMapper<F> | null {
513 const specifiers = getFieldSpecifiers(schema, typeName);
514 let fieldMapper: GenericFieldMapper<F> | undefined;
515 const stack = [...specifiers];
516 while (!fieldMapper && stack.length > 0) {
517 // It is safe to use the ! operator here as we check the length.
518 const next = stack.pop()!;
519 // TODO: fix this as unknown cast
520 fieldMapper = schemaMapper[next] as unknown as GenericFieldMapper<F>;
521 }
522
523 return fieldMapper ?? null;
524}
525
526function getArgumentMapper(schemaMapper: SchemaMapper): ArgumentMapper | null {
527 const argumentMapper = schemaMapper[MapperKind.ARGUMENT];

Callers 1

mapFieldsFunction · 0.85

Calls 1

getFieldSpecifiersFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…