Skip to main content

TypeGraphQL

  • 文件上传 #37
  • relay
  • 不能 @Public 只能 @Authorized
    • Inverted authorization mode #230
  • Data loader integration #51
    • 可以依赖底层的 ORM 去做
    • 例如 MikroORM 支持 dataloader
  • Directive
    • #77
    • @Directive('@deprecated(reason: "Use newField")')

Notes

  • @Args()
  • @ArgsType()
  • @Authorized()
  • @Ctx()
  • @EnumType()
  • @Field()
  • @FieldResolver()
  • @Info()
  • @InputType()
  • @InterfaceType()
  • @Mutation()
  • @ObjectType()
  • @PubSub()
  • @Query()
  • @Resolver()
  • @Root()
  • @Subscription()
  • @UseMiddleware()
  • @ValidateArgs()

Internal

  • getMetadataStorage
// 全局注册中心
import { getMetadataStorage } from 'type-graphql';

// @InputType() 等同于
getMetadataStorage().collectInputMetadata({
name: name || target.name,
target,
description: options.description,
});

// 等同于记录定义 - 等到调用 build 的时候才开始正式处理
MetadataStorage.inputTypes.push(definition)