New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

prisma-nestjs-graphql

Package Overview
Dependencies
Maintainers
1
Versions
120
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prisma-nestjs-graphql

Generate object types, inputs, args, etc. from prisma schema file for usage with @nestjs/graphql module

  • 8.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
11K
increased by1.24%
Maintainers
1
Weekly downloads
 
Created
Source

prisma-nestjs-graphql

Generate object types, inputs, args, etc. from prisma schema file for usage with @nestjs/graphql module.

Features

  • Generates only necessary imports
  • Combines zoo of nested/nullable filters
  • Does not generate resolvers, since it's application specific

Install

npm install --save-dev prisma-nestjs-graphql

Usage

  1. Add new generator section to schema.prisma file
generator nestgraphql {
    provider = "node node_modules/prisma-nestjs-graphql"
    output = "../src"
}
  1. Run prisma generate
npx prisma generate

Generator options

  • output Output folder relative to this schema file

  • outputFilePattern File pattern (default: {feature}/{name}.{type}.ts)
    Possible tokens:

    • {feature} - model name in dashed case or 'prisma' if unknown
    • {name} - dashed-case name of model/input/arg without suffix
    • {type} - short type name (model, input, args, output)
    • {plural.type} - plural short type name (models, inputs, enums)
  • combineScalarFilters - Combine nested/nullable scalar filters to single (default: true)

  • atomicNumberOperations - Atomic number operations, false - disabled (default), true - enabled

  • reExportAll - create index.ts files for each directory with re-export, false - disabled (default), true - enabled

  • types_* - flatten map of types

    • types_{type}_fieldType - TypeScript type name
    • types_{type}_fieldModule - Module to import
    • types_{type}_graphqlType - GraphQL type name
    • types_{type}_graphqlModule - Module to import

    Where {type} is prisma type in schema

    Example (Decimal):

    types_Decimal_fieldType = "Decimal"
    types_Decimal_fieldModule = "decimal.js"
    types_Decimal_graphqlType = "GraphQLDecimal"
    types_Decimal_graphqlModule = "graphql-type-decimal"
    

    Generates field:

    import { GraphQLDecimal } from 'graphql-type-decimal';
    import { Decimal } from 'decimal.js';
    ...
    @Field(() => GraphQLDecimal)
    field: Decimal;
    

    Example (DateTime):

    types_DateTime_fieldType = "Date"
    types_DateTime_graphqlType = "GraphQLISODateTime"
    types_DateTime_graphqlModule = "@nestjs/graphql"
    

    Generated fields:

    @Field(() => GraphQLISODateTime)
    field: Date;
    

Similar Projects

Resources

Keywords

FAQs

Package last updated on 27 Jan 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