@nestjs/graphql
Version:
GraphQL for NestJS: code-first and schema-first APIs, resolvers as providers, subscriptions, federation and generated SDL, on Apollo or Mercurius.
36 lines • 1.74 kB
TypeScript
import { Type } from '@nestjs/common';
import 'reflect-metadata';
import { ArgsType, InputType, InterfaceType, ObjectType } from '../../decorators/index.js';
import { ClassDecoratorFactory } from '../../interfaces/class-decorator-factory.interface.js';
/**
* Returns the compiled field metadata of a class decorated with `@ObjectType()`,
* `@InputType()`, `@InterfaceType()` or `@ArgsType()` (inherited fields
* included), together with the class decorator that matches its kind.
*
* This is the building block of the mapped type helpers (`PartialType()`,
* `PickType()`, etc.) and can be used to write custom ones. The returned
* metadata objects are shared with the schema builder, so treat them as
* read-only.
*
* @param objType the GraphQL type class
* @param options.overrideFields recompile the field metadata of the class
* instead of reusing the cached list (the built-in helpers pass it when the
* plugin metadata is refreshed). Usually omitted.
* @param options.decorator the class decorator of the type the fields are
* collected for. A class registered as that kind of type too (e.g., decorated
* with both `@ObjectType()` and `@InputType()`) is read as that kind.
*
* @throws {UnableToFindFieldsError} if the class is not a GraphQL type.
*
* @publicApi
*/
export declare function getFieldsAndDecoratorForType<T>(objType: Type<T>, options?: {
overrideFields?: boolean;
decorator?: ClassDecoratorFactory;
}): {
fields: import("../metadata/property.metadata.js").PropertyMetadata[];
decoratorFactory: ClassDecorator;
};
type ClassDecorator = typeof ArgsType | typeof InterfaceType | typeof ObjectType | typeof InputType;
export {};
//# sourceMappingURL=get-fields-and-decorator.util.d.ts.map