npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

nest-prisma-graphql-generator

v2.0.0

Published

Generate CRUD resolvers from GraphQL schema with NestJS and Prisma

Downloads

53

Readme

prisma.config.json

general

  • Es un objeto que contiene features funcionales a nivel de proyecto
    • scalars: Es un array de string que contiene los nombres de los scalars que se van a generar en el proyecto. Lista de scalars:

modules

  • Es un objeto que se compone de 2 propiedades.
    • La primera es ignore y la segunda es partial.
    • En ambos casos son un array de string.
    • En el caso de ignore se le pasa un array de nombres de los módulos que no se deben generar.
    • En el caso de partial se le pasa un objeto que contiene un array de nombres de sub carpetas de archivos que se van a generar consecutivamente por actualizaciones en los modelos de prisma.

source

  • Aquí se trabaja con los modelos y resolvers que se generar en los módulos basados en prisma. Es un array de objetos con propiedades dinámicas compuesto por los módulos que se generan.
    {
      "user": {
        "model": {
          "hide": []
        },
        "resolvers": {
          "public": []
        }
      }
    }
  ]
  • model tiene las siguientes propiedades:

    • hide: Es un array de strings que recibe los nombres de los campos que no se deben generar en una respuesta de la API. Esto termina generando un @HideField() en el modelo de NestJS.
        @HideField()
        password!: string;
    • field_m2m_name: Es una propiedad opcional en el que se envía un objeto, las propiedades hacen referencia a las relaciones que existen contra otro modelo. Esta propiedad se usa en la totalidad de veces en modelos m2m de prisma que se han declarado explícitamente.
        "field_m2m_name": {
            "app": "characters",
            "character": "apps"
        }
  • resolvers tiene las siguientes propiedades:

    • public: Es un array de strings que recibe los prefijos de los métodos que se van a generar en el resolver. Por defecto todos son privados.
      • Los prefijos son: findUnique, findMany, create, update, delete, upsert
      • Como resultado, los métodos se generar con un decorator llamado BypassAuth que permite que el método sea público.
        <!-- prisma.config.json -->
        "resolvers": {
          "public": [
            "findMany"
          ]
        }
    
    
        <!-- resolver.ts -->
        @BypassAuth()
        @Query(() => UserPaginated, { nullable: false })
        findManyUsers(@Args() args: FindManyUserArgs) {
            return this.userService.findMany(args)
        }