UNPKG

@nestjs/graphql

Version:

GraphQL for NestJS: code-first and schema-first APIs, resolvers as providers, subscriptions, federation and generated SDL, on Apollo or Mercurius.

41 lines • 2.66 kB
import { GraphQLFieldConfigMap, GraphQLInputFieldConfigMap, GraphQLInputObjectType, GraphQLInterfaceType, GraphQLObjectType } from 'graphql'; import { BuildSchemaOptions } from '../../interfaces/index.js'; import { PropertyMetadata } from '../metadata/index.js'; import { InterfaceMetadata } from '../metadata/interface.metadata.js'; import { ObjectTypeMetadata } from '../metadata/object-type.metadata.js'; export declare class TypeFieldsAccessor { /** * The property each resolver returned by `createFieldResolver()` reads, so * that a type can rebuild the resolver of a field it inherits. */ private readonly resolverProperties; extractFromInputType(gqlType: GraphQLInputObjectType): GraphQLInputFieldConfigMap; extractFromInterfaceOrObjectType<T = any, U = any>(type: GraphQLInterfaceType | GraphQLObjectType): GraphQLFieldConfigMap<T, U>; /** * Returns the fields that `host` inherits from its parent type. A member * that `host` decorates with `@UseFieldMiddleware()`, without declaring it * again with `@Field()`, gets a resolver built for `host`, so that the * middleware it adds runs as well. */ extractInheritedFields(parent: GraphQLInterfaceType | GraphQLObjectType, host: Function, options: BuildSchemaOptions): GraphQLFieldConfigMap<any, any>; /** * Returns the properties declared by the interfaces that a type implements. * Each interface is visited once, after the interfaces it implements, so * that the declaration closest to the type comes last and wins. Interfaces * that the parent type already implements are skipped: their fields are * inherited with the parent's, which may declare them again. */ getInterfaceProperties(metadata: ObjectTypeMetadata | InterfaceMetadata, parent?: GraphQLInterfaceType | GraphQLObjectType): PropertyMetadata[]; /** * Returns the resolver of a property field of the `host` type. It runs the * global middleware, the middleware passed through the `middleware` option * of `@Field()`, and the middleware applied with `@UseFieldMiddleware()`, * in this order. */ createFieldResolver<TSource extends object = any, TContext = {}, TArgs = { [argName: string]: any; }, TOutput = any>(field: PropertyMetadata, options: BuildSchemaOptions, host: Function): ((root: object) => any) | ((resolverArgs_0: TSource, resolverArgs_1: TArgs, resolverArgs_2: TContext, resolverArgs_3: import("graphql").GraphQLResolveInfo) => TOutput | Promise<TOutput>); private getUseFieldMiddleware; private getRecursiveInterfaces; } //# sourceMappingURL=type-fields.accessor.d.ts.map