UNPKG

2.4 kBTypeScriptView Raw
1/**
2 * The API surface of this module has been heavily inspired by the "type-graphql" library (https://github.com/MichalLytek/type-graphql), originally designed & released by Michal Lytek.
3 * In the v6 major release of NestJS, we introduced the code-first approach as a compatibility layer between this package and the `@nestjs/graphql` module.
4 * Eventually, our team decided to reimplement all the features from scratch due to a lack of flexibility.
5 * To avoid numerous breaking changes, the public API is backward-compatible and may resemble "type-graphql".
6 */
7import { Complexity, FieldMiddleware } from '../interfaces';
8import { BaseTypeOptions } from '../interfaces/base-type-options.interface';
9import { ReturnTypeFunc } from '../interfaces/return-type-func.interface';
10/**
11 * Interface defining options that can be passed to `@Field()` decorator.
12 */
13export interface FieldOptions extends BaseTypeOptions {
14 /**
15 * Name of the field.
16 */
17 name?: string;
18 /**
19 * Description of the field.
20 */
21 description?: string;
22 /**
23 * Field deprecation reason (if deprecated).
24 */
25 deprecationReason?: string;
26 /**
27 * Field complexity options.
28 */
29 complexity?: Complexity;
30 /**
31 * Array of middleware to apply.
32 */
33 middleware?: FieldMiddleware[];
34}
35/**
36 * @Field() decorator is used to mark a specific class property as a GraphQL field.
37 * Only properties decorated with this decorator will be defined in the schema.
38 */
39export declare function Field(): PropertyDecorator & MethodDecorator;
40/**
41 * @Field() decorator is used to mark a specific class property as a GraphQL field.
42 * Only properties decorated with this decorator will be defined in the schema.
43 */
44export declare function Field(options: FieldOptions): PropertyDecorator & MethodDecorator;
45/**
46 * @Field() decorator is used to mark a specific class property as a GraphQL field.
47 * Only properties decorated with this decorator will be defined in the schema.
48 */
49export declare function Field(returnTypeFunction?: ReturnTypeFunc, options?: FieldOptions): PropertyDecorator & MethodDecorator;
50export declare function addFieldMetadata(typeOrOptions: ReturnTypeFunc | FieldOptions, fieldOptions: FieldOptions, prototype: Object, propertyKey?: string, descriptor?: TypedPropertyDescriptor<any>, loadEagerly?: boolean): void;
51//# sourceMappingURL=field.decorator.d.ts.map
\No newline at end of file