Api Reference

@ObjectType

interface ObjectTypeOptions {
  name?: string; // infered from class name
  description?: string;
}

@ObjectType(options?: ObjectTypeOptions)

@Field

 interface FieldOptions {
  name?: string;
  description?: string;
  type?: any | () => any;
  isNullable?: boolean;
}

@Field(options?: FieldOptions)

@InputObjectType

interface InputObjectTypeOptions {
  name?: string;
  description?: string;
}

@InputObjectType(options?: InputObjectTypeOptions)

@InputField

 interface InputFieldOptions {
  description?: string;
  defaultValue?: any;
  type?: any | () => any;
  name?: string;
  isNullable?: boolean;
}

@InputField(options?: InputFieldOptions)

@Arg

 interface ArgOptions {
  description?: string;
  type?: any;
  isNullable?: boolean;
}
@Arg(options?: ArgOptions)

@Inject

type InjectorResolver = (
  source: any,
  args: any,
  context: any,
  info: GraphQLResolveInfo,
) => any;

@Inject(resolver: InjectorResolver): ParameterDecorator {

@Context

No decorator options avaliable

@Context: ParameterDecorator

@Source

No decorator options avaliable

@Source: ParameterDecorator

@Info

No decorator options avaliable

@Info: ParameterDecorator

@Before

interface HookExecutorResolverArgs {
  source: any;
  args: { [argName: string]: any };
  context: any;
  info: GraphQLResolveInfo;
}

type HookExecutor = (data: HookExecutorResolverArgs) => any | Promise<any>;

@Before(hook: HookExecutor);

@After

interface HookExecutorResolverArgs {
  source: any;
  args: { [argName: string]: any };
  context: any;
  info: GraphQLResolveInfo;
}

type HookExecutor = (data: HookExecutorResolverArgs) => any | Promise<any>;

@After(hook: HookExecutor);

@Schema

@Schema(): ClassDecorator;

@Query

Has same interface as @Field decorator. Can be used only inside @Schema class

@Mutation

Has same interface as @Field decorator. Can be used only inside @Schema class

@Union

interface UnionOptions {
  name?: string;
  resolveTypes?: (value: any, context: any, info: GraphQLResolveInfo): any; // must return type resolvable to one of defined in `types` option
  types: any[] | () => any[];
}

interface UnionTypeResolver {
  (value: any, context: any, info: GraphQLResolveInfo): any;
}

@Union(options: UnionOptions): ClassDecorator;

registerEnum

interface EnumOptions {
  name: string;
  description?: string;
}

registerEnum(enumDef: Object, options: EnumOptions | string): void;

compileSchema

compileSchema(schemaTarget: Function): GraphQLSchema

compileObjectType,

compileObjectType(schemaTarget: Function): GraphQLObjectType

compileInputObjectType,

compileInputObjectType(schemaTarget: Function): GraphQLInputObjectType

results matching ""

    No results matching ""