Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@bytegem/nest-gql-mix

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bytegem/nest-gql-mix

NestJS + GraphQL(code first) + Prisma, Help you to implement the Prisma template interface as a GraphQL(code first) Type classes. 🎉Fast work!

  • 0.0.6
  • unpublished
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

NestJS GraphQL Mix

NestJS + GraphQL(code first) + Prisma, Help you to implement the Prisma template interface as a GraphQL(code first) Type classes. 🎉Fast work!

Installation

Via NPM:

npm i @bytegem/nest-gql-mix

Or via Yarn:

yarn add  @bytegem/nest-gql-mix

Using

Before using this package:

@InputType({ description: 'This is User where input' })
export class UserWhereInput implements Prisma.UserWhereInput {
  @Field((type) => [UserWhereInput], { nullable: true })
  AND?: UserWhereInput[];

  @Field((type) => [UserWhereInput], { nullable: true })
  OR?: UserWhereInput[];

  @Field((type) => [UserWhereInput], { nullable: true })
  NOT?: UserWhereInput[];

  @Field((type) => StringFilter, { nullable: true })
  id?: StringFilter;

  @Field((type) => StringFilter, { nullable: true })
  username?: StringFilter;

  @Field((type) => StringFilter, { nullable: true })
  email?: StringFilter;

  @Field((type) => StringFilter, { nullable: true })
  phone?: StringFilter;

  /// More fields...

Now:

@InputTypeBuilder(
  { description: 'User where input' },
  FieldsBuilderOptionHelper(
    ['id', 'username', 'email', 'phone', /* ...more fields */],
    () => StringFilter,
    { nullable: true },
  ),
)
export class UserWhereInput extends InterfaceTransformAbstract<Prisma.UserWhereInput>>() {}

extends InterfaceTransformAbstract<T>() is optional. After adding it, you can prompt the IDE code when you actively use this class. Not inheriting has no effect on the actual operation.

Decorators

  • ArgsTypeBuilder: The ArgsType class builder.
    • FindFirstArgsBuilder: Fast build Prisma ${Model}FindFirst args class.
    • FindManyArgsBuilder: Fast build Prisma ${Model}FindMany args class.
  • InputTypeBuilder: The InputType class builder.
    • WhereInputTypeBuilder: Fast build Prisma ${Model}WhereInput input class.
    • RelationFilterBuilder: Fast build Prisma ${Model}ListRelationFilter input class.
  • InterfaceTypeBuilder: The InterfaceType class builder.
  • ObjectTypeBuilder: The ObjectType class builder.

Helpers

  • FieldsBuilderOptionHelper: Passing [Args|Object|Input|Interface]TypeBuilder parameters does not simplify much code work. For multiple fields with the same FieldOptions, you can use this tool to quickly generate.

Transforms

  • InterfaceTransformAbstract: You can transform the interface class into an abstract class to help IDE with code hints.

License

The package is MIT License.

Keywords

FAQs

Package last updated on 25 May 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc