Giter Club home page Giter Club logo

prisma-tools's Introduction

header

Quick Start

Pal.js I am your friend in your next NodeJS, Prisma, GraphQL, React project

Install tools

To install @paljs/cli on your machine you need to have the following tools installed:

Install PalJS CLI

This command installs PalJS CLI globally on your machine.

yarn global add @paljs/cli
//or
npm install -g @paljs/cli
// or use npx to create new project direct
npx @paljs/cli create

Create a new

> npx @paljs/cli create


.______      ___       __             __       _______.
|   _  \    /   \     |  |           |  |     /       |
|  |_)  |  /  ^  \    |  |           |  |    |   (----`
|   ___/  /  /_\  \   |  |     .--.  |  |     \   \
|  |     /  _____  \  |  `----.|  `--'  | .----)   |
| _|    /__/     \__\ |_______| \______/  |_______/

  ✔ Please select your start example · full-stack-nextjs
  ❯ full-stack-nextjs
  full-stack-gatsbyjs
  apollo-nexus-schema
  apollo-sdl-first
  graphql-modules
  ✔ Please select your start framework · Tailwind CSS + PrismaAdmin UI
  Material UI
  Material UI + PrismaAdmin UI
  Tailwind CSS
  ❯ Tailwind CSS + PrismaAdmin UI
  ✔ Use multi schema template …
  ❯ no
  yes
  ✔ please enter your project name · great-project
  ✔ please enter your project description · new NodeJs Prisma GraphQL TypeScript project
  ✔ please enter your project author · Ahmed Elywa
  ✔ please enter your project repository · https://github.com/paljs/prisma-tools
  ✔ Do you need to use Git …
  ❯ yes
  no
  ✔ please select your package manager · yarn
  ❯ yarn
  npm

  ✔ Skip package installation · no
  ❯ yes
  no

Will get 7 questions to help cli create what you want.

Look to our examples contains here

Get your project up

1 Go inside your project dir

cd hello

Open README.md file to see next steps.

To build your schema.prisma file look here

Have questions?

Didn't find something here? Look through the issues or simply drop us a line at [email protected].

prisma-tools's People

Contributors

ahmedelywa avatar alaarihan avatar cauen avatar dependabot[bot] avatar dimaip avatar f8k8 avatar fibs7000 avatar gtolarc avatar guog avatar k-kit avatar martineboh avatar nikolovlazar avatar pakatagoh avatar rachelhigley avatar renovate-bot avatar renovate[bot] avatar songkeys avatar sturdycat avatar wuichen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

prisma-tools's Issues

@paljs/cli v2.8.2 does not generate Prisma enums in resolversTypes.ts

In the latest release of @paljs/cli v2.8.2, there seems to be a bug whereby Prisma enums are no longer generating their equivalent Typescript types within the resolversTypes.ts output. This is causing compile issues as there are missing types.

schema.prisma

...

enum Pool {
  A
  B
}

enum Score {
  A
  B
  C
  D
}

I see in my git diff that within resolversTypes.ts, the follow lines have been removed from the output previously generated using @paljs/cli v2.6.3

export enum Pool {
  A = 'A',
  B = 'B',
}
export enum Score {
  A = 'A',
  B = 'B',
  C = 'C',
  D = 'D',
}

When compiling my app the following errors occur:

ERROR in C:/a/Work/oss/apps/api/src/app/graphql/resolversTypes.ts(1824,10):
TS2304: Cannot find name 'Pool'.
ERROR in C:/a/Work/oss/apps/api/src/app/graphql/resolversTypes.ts(1825,11):
TS2304: Cannot find name 'Score'.
Version: typescript 4.0.3

'adminSettings.json' problems

Setting management using the'adminSettings.json' file is not flexible. It is not possible to restrict actions (create/update/delete) according to each user's permission or support i18n of field titles.
Can you guys think about this and improve it?

GraphQLError: Syntax Error: Expected Name, found "}".

new PrismaSelect(info) gives me error "GraphQLError: Syntax Error: Expected Name, found "}"."

What can be a problem for schema:

const User = objectType({
  name: 'User',
  definition(t) {
    t.int('id')
    t.string('nickname')
  },
})

const Query = objectType({
  name: 'Query',
  definition(t) {
    t.field('findOneUser', {
      type: 'User',
      resolve: async (_parent, _args, ctx, info) => {
        const select = new PrismaSelect(info) // if i delete this line, problem gone

        return { id: 1, nickname: 'a' }
      },
    })
  },
})

And query:

export const FindOneUserQuery = gql`
  query FindOneUser {
    findOneUser {
      id
      nickname
    }
  }

Does prisma database schema can couse a probem, like here: #122

onDelete.deleteParent == true does not return the parent object

Hi Ahmed,

I've just discovered your select and delete packages - they are really great and making my code so much more straightforward!! Thank you for your work in making these!

I am using the delete package to remove an object and its descendants. I want the parent object to return once this is completed, so that I can check that the operation was successful and then do some further processing on related objects. I am currently just getting back null.

From your paljs docs:

deleteParent A flag to determine whether the model should be deleted and returned when its defined as true

I may be missing something but the source code for PrismaDelete.onDelete doesn't appear to be returning a value? Am I doing something wrong?

async onDelete({ model, where, deleteParent }: onDeleteArgs) {

  // Cascade delete reliant descendants with https://paljs.com/plugins/delete/
  const deleted = await prisma.onDelete({
    model: 'User',
    where: { id: id },
    deleteParent: true,
  })

TypeError: Cannot convert undefined or null to object

image

Evaluates to

Object.keys(undefined)

Info object

{ "fieldName": "articles", "fieldNodes": [ { "kind": "Field", "alias": { "kind": "Name", "value": "articles", "loc": { "start": 19, "end": 27 } }, "name": { "kind": "Name", "value": "articles", "loc": { "start": 29, "end": 37 } }, "arguments": [ { "kind": "Argument", "name": { "kind": "Name", "value": "where", "loc": { "start": 38, "end": 43 } }, "value": { "kind": "ObjectValue", "fields": [], "loc": { "start": 45, "end": 47 } }, "loc": { "start": 38, "end": 47 } }, { "kind": "Argument", "name": { "kind": "Name", "value": "orderBy", "loc": { "start": 49, "end": 56 } }, "value": { "kind": "ObjectValue", "fields": [ { "kind": "ObjectField", "name": { "kind": "Name", "value": "id", "loc": { "start": 59, "end": 61 } }, "value": { "kind": "EnumValue", "value": "desc", "loc": { "start": 63, "end": 67 } }, "loc": { "start": 59, "end": 67 } } ], "loc": { "start": 58, "end": 68 } }, "loc": { "start": 49, "end": 68 } } ], "directives": [], "selectionSet": { "kind": "SelectionSet", "selections": [ { "kind": "FragmentSpread", "name": { "kind": "Name", "value": "articleFields", "loc": { "start": 79, "end": 92 } }, "directives": [], "loc": { "start": 76, "end": 92 } } ], "loc": { "start": 70, "end": 96 } }, "loc": { "start": 19, "end": 96 } } ], "returnType": "[Article!]!", "parentType": "Query", "path": { "key": "articles", "typename": "Query" }, "schema": { "__validationErrors": [], "extensionASTNodes": [], "_queryType": "Query", "_mutationType": "Mutation", "_directives": [ "@include", "@Skip", "@deprecated", "@SpecifiedBy" ], "_typeMap": { "User": "User", "ID": "ID", "String": "String", "Boolean": "Boolean", "Comment": "Comment", "Article": "Article", "Int": "Int", "Tag": "Tag", "Query": "Query", "ArticleWhereInput": "ArticleWhereInput", "StringFilter": "StringFilter", "TagListRelationFilter": "TagListRelationFilter", "TagWhereInput": "TagWhereInput", "ArticleListRelationFilter": "ArticleListRelationFilter", "DateTimeFilter": "DateTimeFilter", "IntFilter": "IntFilter", "UserWhereInput": "UserWhereInput", "UserListRelationFilter": "UserListRelationFilter", "CommentListRelationFilter": "CommentListRelationFilter", "CommentWhereInput": "CommentWhereInput", "ArticleOrderByInput": "ArticleOrderByInput", "SortOrder": "SortOrder", "ArticleWhereUniqueInput": "ArticleWhereUniqueInput", "ArticleDistinctFieldEnum": "ArticleDistinctFieldEnum", "UserWhereUniqueInput": "UserWhereUniqueInput", "Mutation": "Mutation", "ArticleCreateInput": "ArticleCreateInput", "ArticleUpdateInput": "ArticleUpdateInput", "CreateCommentInput": "CreateCommentInput", "CommentWhereUniqueInput": "CommentWhereUniqueInput", "UserCreateInput": "UserCreateInput", "UserUpdateInput": "UserUpdateInput", "UserLoginInput": "UserLoginInput", "__Schema": "__Schema", "__Type": "__Type", "__TypeKind": "__TypeKind", "__Field": "__Field", "__InputValue": "__InputValue", "__EnumValue": "__EnumValue", "__Directive": "__Directive", "__DirectiveLocation": "__DirectiveLocation" }, "_subTypeMap": {}, "_implementationsMap": {}, "_extensionsEnabled": true }, "fragments": { "articleFields": { "kind": "FragmentDefinition", "name": { "kind": "Name", "value": "articleFields", "loc": { "start": 151, "end": 164 } }, "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "Article", "loc": { "start": 168, "end": 175 } }, "loc": { "start": 168, "end": 175 } }, "directives": [], "selectionSet": { "kind": "SelectionSet", "selections": [ { "kind": "Field", "name": { "kind": "Name", "value": "slug", "loc": { "start": 180, "end": 184 } }, "arguments": [], "directives": [], "loc": { "start": 180, "end": 184 } }, { "kind": "Field", "name": { "kind": "Name", "value": "title", "loc": { "start": 187, "end": 192 } }, "arguments": [], "directives": [], "loc": { "start": 187, "end": 192 } }, { "kind": "Field", "name": { "kind": "Name", "value": "description", "loc": { "start": 195, "end": 206 } }, "arguments": [], "directives": [], "loc": { "start": 195, "end": 206 } }, { "kind": "Field", "name": { "kind": "Name", "value": "body", "loc": { "start": 209, "end": 213 } }, "arguments": [], "directives": [], "loc": { "start": 209, "end": 213 } }, { "kind": "Field", "name": { "kind": "Name", "value": "tags", "loc": { "start": 216, "end": 220 } }, "arguments": [], "directives": [], "selectionSet": { "kind": "SelectionSet", "selections": [ { "kind": "Field", "name": { "kind": "Name", "value": "name", "loc": { "start": 227, "end": 231 } }, "arguments": [], "directives": [], "loc": { "start": 227, "end": 231 } } ], "loc": { "start": 221, "end": 235 } }, "loc": { "start": 216, "end": 235 } }, { "kind": "Field", "name": { "kind": "Name", "value": "createdAt", "loc": { "start": 238, "end": 247 } }, "arguments": [], "directives": [], "loc": { "start": 238, "end": 247 } }, { "kind": "Field", "name": { "kind": "Name", "value": "updatedAt", "loc": { "start": 250, "end": 259 } }, "arguments": [], "directives": [], "loc": { "start": 250, "end": 259 } }, { "kind": "Field", "name": { "kind": "Name", "value": "favorited", "loc": { "start": 262, "end": 271 } }, "arguments": [], "directives": [], "loc": { "start": 262, "end": 271 } }, { "kind": "Field", "name": { "kind": "Name", "value": "favoritesCount", "loc": { "start": 274, "end": 288 } }, "arguments": [], "directives": [], "loc": { "start": 274, "end": 288 } }, { "kind": "Field", "name": { "kind": "Name", "value": "author", "loc": { "start": 291, "end": 297 } }, "arguments": [], "directives": [], "selectionSet": { "kind": "SelectionSet", "selections": [ { "kind": "FragmentSpread", "name": { "kind": "Name", "value": "userFields", "loc": { "start": 307, "end": 317 } }, "directives": [], "loc": { "start": 304, "end": 317 } }, { "kind": "Field", "name": { "kind": "Name", "value": "following", "loc": { "start": 322, "end": 331 } }, "arguments": [], "directives": [], "loc": { "start": 322, "end": 331 } } ], "loc": { "start": 298, "end": 335 } }, "loc": { "start": 291, "end": 335 } } ], "loc": { "start": 176, "end": 337 } }, "loc": { "start": 142, "end": 337 } }, "userFields": { "kind": "FragmentDefinition", "name": { "kind": "Name", "value": "userFields", "loc": { "start": 348, "end": 358 } }, "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "User", "loc": { "start": 362, "end": 366 } }, "loc": { "start": 362, "end": 366 } }, "directives": [], "selectionSet": { "kind": "SelectionSet", "selections": [ { "kind": "Field", "alias": { "kind": "Name", "value": "username", "loc": { "start": 371, "end": 379 } }, "name": { "kind": "Name", "value": "name", "loc": { "start": 381, "end": 385 } }, "arguments": [], "directives": [], "loc": { "start": 371, "end": 385 } }, { "kind": "Field", "name": { "kind": "Name", "value": "email", "loc": { "start": 388, "end": 393 } }, "arguments": [], "directives": [], "loc": { "start": 388, "end": 393 } }, { "kind": "Field", "name": { "kind": "Name", "value": "bio", "loc": { "start": 396, "end": 399 } }, "arguments": [], "directives": [], "loc": { "start": 396, "end": 399 } }, { "kind": "Field", "name": { "kind": "Name", "value": "image", "loc": { "start": 402, "end": 407 } }, "arguments": [], "directives": [], "loc": { "start": 402, "end": 407 } } ], "loc": { "start": 367, "end": 409 } }, "loc": { "start": 339, "end": 409 } } }, "operation": { "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "articles", "loc": { "start": 6, "end": 14 } }, "variableDefinitions": [], "directives": [], "selectionSet": { "kind": "SelectionSet", "selections": [ { "kind": "Field", "alias": { "kind": "Name", "value": "articles", "loc": { "start": 19, "end": 27 } }, "name": { "kind": "Name", "value": "articles", "loc": { "start": 29, "end": 37 } }, "arguments": [ { "kind": "Argument", "name": { "kind": "Name", "value": "where", "loc": { "start": 38, "end": 43 } }, "value": { "kind": "ObjectValue", "fields": [], "loc": { "start": 45, "end": 47 } }, "loc": { "start": 38, "end": 47 } }, { "kind": "Argument", "name": { "kind": "Name", "value": "orderBy", "loc": { "start": 49, "end": 56 } }, "value": { "kind": "ObjectValue", "fields": [ { "kind": "ObjectField", "name": { "kind": "Name", "value": "id", "loc": { "start": 59, "end": 61 } }, "value": { "kind": "EnumValue", "value": "desc", "loc": { "start": 63, "end": 67 } }, "loc": { "start": 59, "end": 67 } } ], "loc": { "start": 58, "end": 68 } }, "loc": { "start": 49, "end": 68 } } ], "directives": [], "selectionSet": { "kind": "SelectionSet", "selections": [ { "kind": "FragmentSpread", "name": { "kind": "Name", "value": "articleFields", "loc": { "start": 79, "end": 92 } }, "directives": [], "loc": { "start": 76, "end": 92 } } ], "loc": { "start": 70, "end": 96 } }, "loc": { "start": 19, "end": 96 } }, { "kind": "Field", "alias": { "kind": "Name", "value": "articlesCount", "loc": { "start": 99, "end": 112 } }, "name": { "kind": "Name", "value": "countArticles", "loc": { "start": 114, "end": 127 } }, "arguments": [ { "kind": "Argument", "name": { "kind": "Name", "value": "where", "loc": { "start": 128, "end": 133 } }, "value": { "kind": "ObjectValue", "fields": [], "loc": { "start": 135, "end": 137 } }, "loc": { "start": 128, "end": 137 } } ], "directives": [], "loc": { "start": 99, "end": 138 } } ], "loc": { "start": 15, "end": 140 } }, "loc": { "start": 0, "end": 140 } }, "variableValues": {}, "cacheControl": { "cacheHint": { "maxAge": 0 } } }

Converting info object from prisma 1 connections to prisma 2

Hi there

Im trying to upgrade to prisma 2 and ive been using PrismaSelect so that i can take my info object and pass it to Prisma2.

I ran into the issue where Prisma2 no longer supports connections but i found this: https://github.com/devoxa/prisma-relay-cursor-connection

That seems like it would work, but my info object from the client still has the "connections" stuff in it.. like edges: { node: {..

can i somehow modify the info object on the server side either before or after using PrismaSelect? so that the selection will match findMany instead of Prisma 1 connections?

New features ,I need to customize the 'prisma/client' directory

@paljs/generator - New features

Can add a new configuration?To set the "prisma/Client" directory.

// Generators.ts

  protected async dmmf() {
    const { dmmf } = await import(
      join(projectRoot, 'node_modules', '@prisma/client') // --->>>   customize path
    );
    return dmmf;
  }

Possible to display/edit explicit many-to-many relations in Admin?

I have a few explicit many-to-many relationships in my application, so that I can eventually store details about the relationship. Currently this doesn't seem supported in "Admin" is that correct?

  • 0 results are shown when viewing /admin/models/JobsOnSections
# simplified schema.prisma

model Dashboard {
    id        Int                    @id @default(autoincrement())
    name      String                 @unique
    sections  SectionsOnDashboards[]
}

model SectionsOnDashboards {
    dashboard   Dashboard @relation(fields: [dashboardId], references: [id])
    dashboardId Int
    section     Section   @relation(fields: [sectionId], references: [id])
    sectionId   Int
    order       Int?
    alias       String?
    @@id([sectionId, dashboardId])
}

model Section {
    id        Int      @id @default(autoincrement())
    name      String   @unique
    published Boolean  @default(false)
    dashboards SectionsOnDashboards[]
    jobs       JobsOnSections[]
}

Image 1) Dashboard => Sections => Section exists

prisma-admin-playground

Image 2) 0 rows displayed in Admin
prisma-admin-1

Could it be that the singular/plural form of Section/s can't be used on the same model?

Thanks.

Unchecked Scalar Input

It looks like the GraphQL SDL inputs plugin selects the unchecked scalars version of the input arguments automatically, would it be possible to have an option to select the "normal" version? For example:

mutation {
  updateItem(
    foreignKeyId: STRING
  )
}

vs.

mutation {
  updateItem(
    foreignKey: {
      connect: {
        id: STRING
      }
    }
  )
}

Alternatively maybe the inputs could be generated into individual files like the resolvers are. Thanks!

Self relation graphql module generation problem

Hi,

While I'm creating a self relations in a module, pal g made a wrong import from the module to its self, this confusion happened because the module has relations to its self:

model Category {
  id        Int        @id @default(autoincrement())
  name      String
  parentId  Int?
  parent    Category?  @relation("CategoryTree", fields: [parentId], references: [id])
  children  Category[] @relation("CategoryTree")
  createdAt DateTime   @default(now())
  updatedAt DateTime   @updatedAt
}

The generated code was like this:

import { GraphQLModule } from '@graphql-modules/core'
import typeDefs from './typeDefs'
import resolvers from './resolvers'
import { addSelect } from '../common/addSelect'
import { CommonModule } from '../common/common.module'
import { CategoryModule } from '../Category/Category.module'

export const CategoryModule = new GraphQLModule({
  name: 'Category',
  typeDefs,
  resolvers,
  imports: [CommonModule, CategoryModule],
  resolversComposition: {
    Query: [addSelect],
    Mutation: [addSelect],
  },
})

as you see the module name is CategoryModule and it contain an import to CategoryModule in the same time

Error: Cannot set property 'select' of undefined

Hi I created with the pal c the full-stack-nextjs project. I have to say this is really nice, didn't expect that, thx for this.

But I get the error:

ApolloError: Cannot set property 'select' of undefined
at new ApolloError (.../node_modules/@apollo/client/errors/errors.cjs.js:31:28)
                                 .../node_modules/@apollo/client/core/core.cjs.js:1438:47)

This is happening when I use getStaticProps like:

export async function getStaticProps() {
  const apolloClient = initializeApollo();

  await apolloClient.query({
    query: PAGE,
  });

  return {
    props: {
      initialApolloState: apolloClient.cache.extract(),
    },
    revalidate: 1,
  };
}

to solve this problem I made this change in src/Api/client:

function createIsomorphLink() {
  const { HttpLink } = require('@apollo/client/link/http')
  return new HttpLink({
    uri: 'http://localhost:3000/api/graphql',
    credentials: 'same-origin',
  })
}

But now I don't use anymore the SchemaLink from "@apollo/client/link/schema"

I guess I'm doing something wrong in the getStaticProps()

Bug: SDL and resolver generation not consistent for findFirst queries

The image below shows the query generated by pal g. The generated query for an Organisation model has findFirstOrganisations return type is an array.
image

It's not consistent with the return type of the findFirstOrganisation resolver.

Should the return type be Organisation instead of [Organisation!] ?

See the return type for findFirst here: https://www.prisma.io/docs/concepts/components/prisma-client/crud#return-type-1

Currently using @paljs/cli and @paljs/plugins v2.11.0, prisma/client and @prisma/cli v2.14.0

generate:nexus failing for apollo-nexus-schema starter project

I attempted to create a new pal apollo-nexus-schema app with mysql. All other steps from the README completed successfully. Only src/nexusSchema is failing with this error:

> pal --version
@paljs/cli/1.1.8 win32-x64 node-v12.18.2
> yarn generate:nexus
yarn run v1.22.4
$ ts-node --transpile-only src/nexusSchema

C:\Users\Me\apollo-nexus\node_modules\graphql\error\syntaxError.js:15
  return new _GraphQLError.GraphQLError("Syntax Error: ".concat(description), undefined, source, [position]);
         ^
GraphQLError: Syntax Error: Expected Name, found "}".
    at syntaxError (C:\Users\Me\apollo-nexus\node_modules\graphql\error\syntaxError.js:15:10)
    at Parser.expectToken (C:\Users\Me\apollo-nexus\node_modules\graphql\language\parser.js:1423:40)
    at Parser.parseName (C:\Users\Me\apollo-nexus\node_modules\graphql\language\parser.js:92:22)
    at Parser.parseInputValueDef (C:\Users\Me\apollo-nexus\node_modules\graphql\language\parser.js:901:21)
    at Parser.optionalMany (C:\Users\Me\apollo-nexus\node_modules\graphql\language\parser.js:1516:28)
    at Parser.parseInputFieldsDefinition (C:\Users\Me\apollo-nexus\node_modules\graphql\language\parser.js:1066:17)
    at Parser.parseInputObjectTypeDefinition (C:\Users\Me\apollo-nexus\node_modules\graphql\language\parser.js:1050:23)
    at Parser.parseTypeSystemDefinition (C:\Users\Me\apollo-nexus\node_modules\graphql\language\parser.js:714:23)
    at Parser.parseDefinition (C:\Users\Me\apollo-nexus\node_modules\graphql\language\parser.js:144:23)
    at Parser.many (C:\Users\Me\apollo-nexus\node_modules\graphql\language\parser.js:1537:26)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
> yarn dev
yarn dev
yarn run v1.22.4
$ ts-node-dev --no-notify --respawn --transpile-only src/server
Using ts-node version 8.10.2, typescript version 3.9.7
[ERROR] 12:35:58 GraphQLError: Syntax Error: Expected Name, found "}".
> prisma --version
Environment variables loaded from prisma\.env
@prisma/cli          : 2.3.0
Current platform     : windows
Query Engine         : query-engine e11114fa1ea826f9e7b4fa1ced34e78892fe8e0e (at ..\..\..\..\..\AppData\Local\Yarn\Data\global\node_modules\@prisma\cli\query-engine-windows.exe)
Migration Engine     : migration-engine-cli e11114fa1ea826f9e7b4fa1ced34e78892fe8e0e (at ..\..\..\..\..\AppData\Local\Yarn\Data\global\node_modules\@prisma\cli\migration-engine-windows.exe)
Introspection Engine : introspection-core e11114fa1ea826f9e7b4fa1ced34e78892fe8e0e (at ..\..\..\..\..\AppData\Local\Yarn\Data\global\node_modules\@prisma\cli\introspection-engine-windows.exe)
Format Binary        : prisma-fmt e11114fa1ea826f9e7b4fa1ced34e78892fe8e0e (at ..\..\..\..\..\AppData\Local\Yarn\Data\global\node_modules\@prisma\cli\prisma-fmt-windows.exe)

package.json

 "dependencies": {
    "@nexus/schema": "0.14.0",
    "@prisma/client": "2.3.0",
    "@paljs/nexus": "1.1.7",
    "apollo-server": "2.16.0",
    "graphql": "15.3.0"
  },
  "devDependencies": {
    "@prisma/cli": "2.3.0",
    "@types/node": "12.12.51",
    "prettier": "2.0.5",
    "ts-node": "8.10.2",
    "ts-node-dev": "1.0.0-pre.52",
    "typescript": "3.9.7"
},

The prisma client seems OK, I can use the client and launch studio just fine.

Subscriptions

Would it be possible to add subscriptions ? Would be linked to the mutations (createOne, updateOne)

import { subscriptionField } from '@nexus/schema'

export const PostLatestSubscription = subscriptionField('latestPost', {
  type: 'Post',
  subscribe(_root, _args, ctx) {
    return ctx.pubsub.asyncIterator('latestPost')
  },
  resolve(payload) {
    return payload
  },
})
import { mutationField, arg } from '@nexus/schema'

export const PostCreateOneMutation = mutationField('createOnePost', {
  type: 'Post',
  nullable: false,
  args: {
    data: arg({
      type: 'PostCreateInput',
      nullable: false,
    }),
  },
  resolve: async (_parent, { data }, { prisma, select, pubsub }) => {
    const newPost = await prisma.post.create({
      data,
      ...select,
    })

    pubsub.publish('latestPost', newPost)
    return newPost
  },
})

2.2.1 TypeError: Cannot read property 'run' of undefined

I'm trying upgrade from 1.6.1 to 2.2.1 but I'm getting this error when run pal generate: TypeError: Cannot read property 'run' of undefined

and when i downgrade back to 1.6.1 it started to throw this error: TypeError: Cannot read property '0' of undefined, in this case looks like is not reading the schema file

Which more info I can provide to help? I can not find a debug mode

pal generate creates a lot more files

Hey guys.
I'm using version 1.0.3 and today the command pal g starts creating lots of files like follow
...MaxAggregateOutputType
...MinAggregateOutputType
...SumAggregateOutputType
...AvgAggregateOutputType

How can I stop that?

My pal.js config is

module.exports = {
  backend: {
    generator: 'sdl',
    output: 'graphql/generated',
  },
}

StringFieldUpdateOperationsInput should work without also "set"

Update requires "set:" for each input

input UserUpdateInput {
  countPosts: IntFieldUpdateOperationsInput
  email: StringFieldUpdateOperationsInput
  id: StringFieldUpdateOperationsInput
  name: NullableStringFieldUpdateOperationsInput
  posts: PostUpdateManyWithoutAuthorInput
}

Create works without using "set:"

input UserCreateInput {
  countPosts: Int
  email: String!
  id: String
  name: String
  posts: PostCreateManyWithoutAuthorInput
}

Primsa generates below, which makes it optional.

export type UserUpdateInput = {
  id?: string | StringFieldUpdateOperationsInput
  email?: string | StringFieldUpdateOperationsInput
  name?: string | NullableStringFieldUpdateOperationsInput | null
  countPosts?: number | IntFieldUpdateOperationsInput
  posts?: PostUpdateManyWithoutAuthorInput
}

Can we generate it in a similar way?

Thanks,

Error: Could not find query-engine binary.

Hi ,
I am trying to run the examples as described in the read.me When issuing
pal g
I get following error:
Error: Could not find query-engine binary. Searched in
/usr/lib/node_modules/@paljs/cli/node_modules/@prisma/sdk/query-engine-debian-openssl-1.1.x and
/usr/lib/node_modules/@paljs/cli/node_modules/@prisma/query-engine-debian-openssl-1.1.x

Best Regards
Artur

Composite Unique breaking Name Assertion

This model is the result of prisma introspection

model JobRun {
  createdAt DateTime  @default(now())
  endTime   DateTime?
  exitCode  Int?
  id        Int       @default(autoincrement()) @id
  jobId     Int
  jobRunId  Int?
  moreInfo  String?
  startTime DateTime
  status    JobStatus @default(ACTIVATED)
  updatedAt DateTime
  Job       Job       @relation(fields: [jobId], references: [id])

  @@unique([jobId, startTime], name: "JobRun.jobId_startTime")
}

yarn generate fails with this error:

$ ts-node --transpile-only -P nexus.tsconfig.json src/Api/nexusSchema

/home/will/code/pal/paljs-fullstack-demo/node_modules/graphql/utilities/assertValidName.js:42
    return new _GraphQLError.GraphQLError("Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but \"".concat(name, "\" does not."), node);
           ^
GraphQLError: Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but "JobRun.jobId_startTimeCompoundUniqueInput" does not.
    at isValidNameError (/home/will/code/pal/paljs-fullstack-demo/node_modules/graphql/utilities/assertValidName.js:42:12)
    at Object.assertValidName (/home/will/code/pal/paljs-fullstack-demo/node_modules/graphql/utilities/assertValidName.js:21:15)
    at new NexusInputObjectTypeDef (/home/will/code/pal/paljs-fullstack-demo/node_modules/@nexus/schema/src/definitions/inputObjectType.ts:30:5)
    at Object.inputObjectType (/home/will/code/pal/paljs-fullstack-demo/node_modules/@nexus/schema/src/definitions/inputObjectType.ts:47:10)
    at forEach (/home/will/code/pal/paljs-fullstack-demo/node_modules/@paljs/nexus/src/index.ts:67:13)
    at Array.forEach (<anonymous>)
    at Object.onInstall (/home/will/code/pal/paljs-fullstack-demo/node_modules/@paljs/nexus/src/index.ts:64:23)
    at /home/will/code/pal/paljs-fullstack-demo/node_modules/@nexus/schema/src/builder.ts:657:44
    at Array.forEach (<anonymous>)
    at SchemaBuilder.beforeWalkTypes (/home/will/code/pal/paljs-fullstack-demo/node_modules/@nexus/schema/src/builder.ts:651:18)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Any ideas how to get around this issue?

Environment details:

@prisma/cli          : 2.9.0
@prisma/client       : 2.9.0
Current platform     : debian-openssl-1.1.x
Query Engine         : query-engine 369b3694b7edb869fad14827a33ad3f3f49bbc20 (at node_modules/@prisma/cli/query-engine-debian-openssl-1.1.x)
Migration Engine     : migration-engine-cli 369b3694b7edb869fad14827a33ad3f3f49bbc20 (at node_modules/@prisma/cli/migration-engine-debian-openssl-1.1.x)
Introspection Engine : introspection-core 369b3694b7edb869fad14827a33ad3f3f49bbc20 (at node_modules/@prisma/cli/introspection-engine-debian-openssl-1.1.x)
Format Binary        : prisma-fmt 369b3694b7edb869fad14827a33ad3f3f49bbc20 (at node_modules/@prisma/cli/prisma-fmt-debian-openssl-1.1.x)
Studio               : 0.296.0
``

@paljs/cli/2.5.2 linux-x64 node-v14.12.0


Thank you.

DistinctFieldEnum still being generated instead of ScalarFieldEnum

Hello @AhmedElywa ,

@paljs/cli v2.9.1 seems to still be generating the old style of type names for enums before the change in @prisma/client v2.13.0. In some places they seem to be correctly generating with the new ScalarFieldEnum postfix, though in other places they are still generating with the old DistinctFieldEnum postfix.

Contact/typeDefs.ts

type Query {
    type Contact {
    id: Int!
    firstName: String!
    lastName: String
    csvUnits(
      where: CsvUnitWhereInput
      orderBy: CsvUnitOrderByInput
      cursor: CsvUnitWhereUniqueInput
      take: Int
      skip: Int
      distinct: CsvUnitScalarFieldEnum # Correct ^_^
    ): [CsvUnit!]!
  }

  type Query {
    findUniqueContact(where: ContactWhereUniqueInput!): Contact
    findFirstContact(
      where: ContactWhereInput
      orderBy: [ContactOrderByInput!]
      cursor: ContactWhereUniqueInput
      distinct: ContactDistinctFieldEnum # Incorrect
      skip: Int
      take: Int
    ): [Contact!]
    findManyContact(
      where: ContactWhereInput
      orderBy: [ContactOrderByInput!]
      cursor: ContactWhereUniqueInput
      distinct: ContactDistinctFieldEnum # Incorrect
      skip: Int
      take: Int
    ): [Contact!]
    findManyContactCount(
      where: ContactWhereInput
      orderBy: [ContactOrderByInput!]
      cursor: ContactWhereUniqueInput
      distinct: ContactDistinctFieldEnum # Incorrect
      skip: Int
      take: Int
    ): Int!
    aggregateContact(
      where: ContactWhereInput
      orderBy: [ContactOrderByInput!]
      cursor: ContactWhereUniqueInput
      distinct: ContactDistinctFieldEnum # Incorrect
      skip: Int
      take: Int
    ): AggregateContact
  }
   ...
}

schema.prisma

...
model Contact {
  id          Int       @id @default(autoincrement())
  firstName   String
  lastName    String?

  csvUnits    CsvUnit[]
}

model CsvUnit {
  id            Int     @id @default(autoincrement())
  unit          String?
  address       String?
  owners        String?
  ownersParsed  CsvContact[]
  ownerAddress  String?
  contactInfos  String?
  tenants       String?
  vehicles      String?
  parking       String?

  contacts      Contact[]
}
...

Question about generated update input types from SDLInputs()

Hi!

My team and I are currently upgrading from prisma1 to prisma2. We are making use of pal g to help generate graphql type definitions to replace the ones generated previously by prisma1.

We are having issues with the generated UpdateInput graphql input types

A example model in our schema.prisma file below:

model Project {
  id                 String            @id @default(cuid())
  projectName        String
  projectDescription String
  shortDescription   String

paljs generated below

type Mutation {
  # example update mutation
  updateOneProject(where: ProjectWhereUniqueInput!, data: ProjectUpdateInput!): Project!
}

input ProjectUpdateInput {
  id: StringFieldUpdateOperationsInput
  projectName: StringFieldUpdateOperationsInput
  projectDescription: StringFieldUpdateOperationsInput
  shortDescription: StringFieldUpdateOperationsInput
}

input StringFieldUpdateOperationsInput {
  set: String
}

# other definitions...

prisma1 generated below:

input ProjectUpdateInput {
  projectName: String
  projectDescription: String
  shortDescription: String
}

using the graphql types by paljs, we are now required to always use a set even for scalar or enum types.

But the prisma2 typescript definitions do allow for writing either just the string to update or with the help of a nested set property

prisma2 typescript definition from .prisma/client/index.d.ts below:

export type ProjectUpdateInput = {
  id?: string | StringFieldUpdateOperationsInput
  projectName?: string | StringFieldUpdateOperationsInput
  projectDescription?: string | StringFieldUpdateOperationsInput
  shortDescription?: string | StringFieldUpdateOperationsInput
}

export type StringFieldUpdateOperationsInput = {
  set?: string
}

so this requires us to change lots of update mutations that weren't using set on the frontend.

Just wondering if there is a way to add a config to not use xxxxFieldUpdateOperationsInput by default?

Maybe you could also shed some light as to why xxxxFieldUpdateOperationsInput was chosen when generating sdlInputs. That'll be awesome.

Our current workaround is making a change to the source sdlInputs.ts file to detect if the type includes FieldUpdateOperationsInput

export const getInputType = (field: DMMF.SchemaArg) => {
  let index: number = 0;

  // new code below
  if (field.inputTypes.length > 1 && field.inputTypes[1].type.includes('FieldUpdateOperationsInput') ) {
    index = 0;
    return field.inputTypes[index]
  }
  // new code above

  if (field.inputTypes.length > 1 && field.inputTypes[1].kind === 'object') {
    index = 1;
  }
  return field.inputTypes[index];
};

Thank you!

our pal.js config below if you're wondering about it

module.exports = {
  backend: {
    generator: 'sdl',
    output: 'gql/src/typedefs',
};

Question: N + 1 Query issues

Hello,

This is a great package and thanks for creating this awesome package, now my question is that, does this package handle N + 1 Query issues?

Thanks a lot in advance.
Ali

PismaDelete.onDelete.returnFields throws Prisma error.

Hi, thanks for the last quick update. Returnfields is a great idea but there seems to be an issue in that prisma.deleteMany() return a BatchPayload object rather than the original model, which only has one field on it - count.

const deletedUser: User = await prisma.onDelete({
    model: 'User',
    where: { id },
    deleteParent: true,
    returnFields: {
      id: true,
      imageUrl: true,
      videoUrl: true,
      videoThumbUrl: true,
    },
  })
[1] {
[1]   where: {
[1]     id: '7cbf009e-1241-4cde-85bf-aa62508c96da'
[1]   },
[1]   select: {
[1]     id: true,
[1]     ~~
[1]     imageUrl: true,
[1]     ~~~~~~~~
[1]     demoVideoUrl: true,
[1]     ~~~~~~~~~~~~
[1]     demoVideoThumbUrl: true,
[1]     ~~~~~~~~~~~~~~~~~
[1] ?   count?: true
[1]   }
[1] }
[1] Unknown field `id` for select statement on model BatchPayload. Available options are listed in green.
[1] Unknown field `imageUrl` for select statement on model BatchPayload. Available options are listed in green. Did you mean `count`?
[1] Unknown field `demoVideoUrl` for select statement on model BatchPayload. Available options are listed in green. Did you mean `count`?
[1] Unknown field `demoVideoThumbUrl` for select statement on model BatchPayload. Available options are listed in green.

Wondering if my syntax is wrong or if there is some other fix / update that would allow the functionality to work?

Perhaps switch the final return statement (when deleting the initial parent) to a standard prisma.delete()?

return await this.prisma[results[i].name].deleteMany({

Mapping of types between graphql and prisma

I have something like:

schema.prisma
`

model someEntity {
    id                        string
    name                  string
    additionaField    string
  }

`

types.graphql
`

type someEntityCustom {
    id                        string
    name                  string
  }

`

I have investigated codebase of select method and see that it try to find model with name someEntityCustom. But that model does not exists in the DB. How i can map graphql type and prisma model?

Looks like valueOf can do something similar but i can not understand how to use it in right way

Schema Error - The directive `@map` can not be used on relation fields

Need help.

I am using the pal c command to create the apollo-nexus-schema and then I generated my prisma.schema using the yarn prisma introspect command and then I have used command pal schema camel-case from here and then run the command

yarn generate

It show me output like this with an error for every foreign key field I have.

yarn run v1.22.4
$ npm -s run generate:prisma && npm -s run generate:nexus
Environment variables loaded from prisma\.env
Error: Schema parsing
error: Error parsing attribute "@map": The directive @Map can not be used on relation fields.
--> schema.prisma:33

schema.prisma Line no 33 looks like this.
medicineType MedicineType @relation(fields: [medicineTypeId], references: [id]) @map("medicine_type")

I am not sure if this is an error from Prisma itself or Paljs.

Thank you

Error: Cannot find module 'graphql/language/parser'

I'm trying to use this for handling cascading deletes in Prisma.
I'm not using graphql in my project, but an error appears which suggests it is required, although this isn't mentioned on this doc page.

My code is:

import {PrismaClient, dmmf} from '../../prisma/client';
import {PrismaDelete} from '@paljs/plugins';

class Prisma extends PrismaClient {
  constructor(options) {
    super(options);
  }

  async onDelete(args) {
    const prismaDelete = new PrismaDelete(this, {dmmf});
    await prismaDelete.onDelete(args);
  }
}

I get the following (I have replaced sensitive bits with [redacted])

Error: Cannot find module 'graphql/language/parser'
Require stack:
- /[redacted]/node_modules/graphql-tag/lib/graphql-tag.umd.js
- /[redacted]/node_modules/@paljs/plugins/dist/plugins.cjs.development.js
- /[redacted]/node_modules/@paljs/plugins/dist/index.js
- /[redacted]/.next/server/pages/api/[redacted]/.js
- /[redacted]/node_modules/next/dist/next-server/server/next-server.js
- /[redacted]/node_modules/next/dist/server/next.js
- /[redacted]/server.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
    at Function.Module._load (internal/modules/cjs/loader.js:667:27)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at /[redacted]/node_modules/graphql-tag/lib/graphql-tag.umd.js:7:14
    at /[redacted]/node_modules/graphql-tag/lib/graphql-tag.umd.js:2:65
    at Object.<anonymous> (/[redacted]/node_modules/graphql-tag/lib/graphql-tag.umd.js:5:2)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/[redacted]/node_modules/@paljs/plugins/dist/plugins.cjs.development.js:10:27)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/[redacted]/node_modules/graphql-tag/lib/graphql-tag.umd.js',
    '/[redacted]/node_modules/@paljs/plugins/dist/plugins.cjs.development.js',
    '/[redacted]/node_modules/@paljs/plugins/dist/index.js',
    '/[redacted]/.next/server/pages/api/[redacted].js',
    '/[redacted]/node_modules/next/dist/next-server/server/next-server.js',
    '/[redacted]/node_modules/next/dist/server/next.js',
    '/[redacted]/server.js'
  ]
}

Is there any way around this? Thanks.

Requesting upgrade of deprecated `merge-graphql-schemas` dependency to `@graphql-tools/merge`

  • Feature request

Thank you for the wonderful set of Prisma tools @AhmedElywa. I am working on a project that is using your suite of tools for a Nest+Angular - GraphQL code gen starter project @ZenSoftware/Zen. The Nest GraphQL api will serve for schema delegation to the Pal.js SDL first approach. You can see your tools in action here and here. I would not have been able to solve the N+1 problem for free for all my resolver endpoints without the Pal.js Prisma select plugin. Thanks again!!! 🥳

As for the GitHub issue at hand, I noticed that the merge-graphql-schemas library is now deprecated. Here is the relevant info for the upgrade path: Migration from Merge GraphQL Schemas. I would like to request that the Pal.js code generation tools upgrade to the new @graphql-tools/merge library. Cheers my friend 🍭

Feature request: Generate single graphql schema file for prisma

I want to generate a single graphql file from prisma instead of a lot of separate files/folders just like prisma 1. So there are two ways of doing this,

First way: import own types and use inside makeSchema.

import { makeSchema } from '@nexus/schema';
import * as types from './graphql';
import { paljs } from '@paljs/nexus';

export const schema = makeSchema({
  types,
  plugins: [paljs()],
  outputs: {
    schema: __dirname + '/generated/schema.graphql',
    typegen: __dirname + '/generated/nexus.ts',
  },
  typegenAutoConfig: {
    sources: [
      {
        source: '@prisma/client',
        alias: 'prisma',
      },
      {
        source: require.resolve('./context'),
        alias: 'Context',
      },
    ],
    contextType: 'Context.Context',
  },
});

Second way: generate the separate schema files and merge it back later.

import { Generator } from '@paljs/generator';
import rimraf from 'rimraf';

const { makeSchema } = require('@nexus/schema');
const { nexusSchemaPrisma } = require('nexus-plugin-prisma/schema');

async function main() {
  const tmpDir = './.temp';

  // generate all sdl
  await new Generator(
    { name: 'nexus-plugin-prisma', schemaPath: './prisma/schema.prisma' },
    { output: tmpDir, javaScript: true }
  ).run();

  // make schema from tmp dir
  await makeSchema({
    outputs: {
      schema: __dirname + '/test/output.graphql',
    },
    types: await import(tmpDir),
    plugins: [
      nexusSchemaPrisma({
        experimentalCRUD: true,
        shouldGenerateArtifacts: true,
      }),
    ],
  });

  await rimraf.sync(tmpDir);
}

main();

Would it be possible to generate the schema without directly without saving them to the disk and reading again?

For example, the Generator.run() could actually expose the string/code/object directly which we can use later.

paljs v2.0.0 - Unknown type "Null"

Description

Thank you for keeping pace with the newest releases of Prisma! We really appreciate how active the Pal.js project is ⛲️. We have just tried to upgrade to Pal.js v2.0.0. Unfortunately we are getting an error of Unknown type "Null" during our makeExecutableSchema. We have a very simple schema.prisma file for our project. I have pushed a git branch of our project with the Pal.js v2.0.0 upgrade, and you can find the Pal.js code generated files here. I am not entirely sure what the problem is and thought I'd provide some early feedback for you. Cheers 🥂

Dependencies

Our package.json dependencies:

Error log

C:\a\Work\zen\node_modules\graphql\validation\validate.js:107
    throw new Error(errors.map(function (error) {
          ^
Error: Unknown type "Null".

Unknown type "Null".

Unknown type "Null".

Unknown type "Null".

Unknown type "Null".

Unknown type "Null".

Unknown type "Null".

Unknown type "Null".

Unknown type "Null".

Unknown type "Null".
    at assertValidSDL (C:\a\Work\zen\node_modules\graphql\validation\validate.js:107:11)
    at Object.buildASTSchema (C:\a\Work\zen\node_modules\graphql\utilities\buildASTSchema.js:45:34)
    at buildSchemaFromTypeDefinitions (C:\a\Work\zen\node_modules\graphql-tools\dist\schema\src\buildSchemaFromTypeDefinitions.js:9:18)
    at makeExecutableSchema (C:\a\Work\zen\node_modules\graphql-tools\dist\schema\src\makeExecutableSchema.js:64:18)
    at Module../apps/api/src/app/graphql/resolvers/index.ts (C:\a\Work\zen\dist\apps\api\webpack:\apps\api\src\app\graphql\resolvers\index.ts:20:51)

node_modules/.prisma/client/index.js

Object.defineProperty(exports, "__esModule", { value: true });

const {
  PrismaClientKnownRequestError,
  PrismaClientUnknownRequestError,
  PrismaClientRustPanicError,
  PrismaClientInitializationError,
  PrismaClientValidationError,
  getPrismaClient,
  debugLib,
  sqltag,
  sql,
  empty,
  join,
  raw
} = require('@prisma/client/runtime')

const path = require('path')
const debug = debugLib('prisma-client')

/**
 * Prisma Client JS version: 2.8.0
 * Query Engine version: e6c9b4b2b7fa162d0d459d1863321f547498fcfe
 */
exports.prismaVersion = {
  client: "2.8.0",
  engine: "e6c9b4b2b7fa162d0d459d1863321f547498fcfe"
}

exports.PrismaClientKnownRequestError = PrismaClientKnownRequestError;
exports.PrismaClientUnknownRequestError = PrismaClientUnknownRequestError;
exports.PrismaClientRustPanicError = PrismaClientRustPanicError;
exports.PrismaClientInitializationError = PrismaClientInitializationError;
exports.PrismaClientValidationError = PrismaClientValidationError;

/**
 * Re-export of sql-template-tag
 */

exports.sql = sqltag
exports.empty = empty
exports.join = join
exports.raw = raw


/**
 * Build tool annotations
 * In order to make `ncc` and `node-file-trace` happy.
**/

path.join(__dirname, 'query-engine-windows');
path.join(__dirname, 'query-engine-linux-musl');

/**
 * Annotation for `node-file-trace`
**/
path.join(__dirname, 'schema.prisma');

/**
 * Enums
 */
// Based on
// https://github.com/microsoft/TypeScript/issues/3192#issuecomment-261720275
function makeEnum(x) { return x; }

exports.UserDistinctFieldEnum = makeEnum({
  id: 'id',
  createdAt: 'createdAt',
  email: 'email',
  firstName: 'firstName',
  lastName: 'lastName',
  password: 'password',
  roles: 'roles'
});

exports.SortOrder = makeEnum({
  asc: 'asc',
  desc: 'desc'
});

exports.Role = makeEnum({
  Registered: 'Registered',
  Admin: 'Admin'
});

exports.QueryMode = makeEnum({
  default: 'default',
  insensitive: 'insensitive'
});


/**
 * DMMF
 */
const dmmfString = "{\"datamodel\":{\"enums\":[{\"name\":\"Role\",\"values\":[{\"name\":\"Registered\",\"dbName\":null},{\"name\":\"Admin\",\"dbName\":null}],\"dbName\":null}],\"models\":[{\"name\":\"User\",\"isEmbedded\":false,\"dbName\":null,\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":true,\"isReadOnly\":false,\"type\":\"String\",\"hasDefaultValue\":true,\"default\":{\"name\":\"cuid\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"type\":\"DateTime\",\"hasDefaultValue\":true,\"default\":{\"name\":\"now\",\"args\":[]},\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"email\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":true,\"isId\":false,\"isReadOnly\":false,\"type\":\"String\",\"hasDefaultValue\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"firstName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"type\":\"String\",\"hasDefaultValue\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"lastName\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"type\":\"String\",\"hasDefaultValue\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"password\",\"kind\":\"scalar\",\"isList\":false,\"isRequired\":true,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"type\":\"String\",\"hasDefaultValue\":false,\"isGenerated\":false,\"isUpdatedAt\":false},{\"name\":\"roles\",\"kind\":\"enum\",\"isList\":true,\"isRequired\":false,\"isUnique\":false,\"isId\":false,\"isReadOnly\":false,\"type\":\"Role\",\"hasDefaultValue\":false,\"isGenerated\":false,\"isUpdatedAt\":false}],\"isGenerated\":false,\"idFields\":[],\"uniqueFields\":[],\"uniqueIndexes\":[]}]},\"schema\":{\"rootQueryType\":\"Query\",\"rootMutationType\":\"Mutation\",\"inputTypes\":[{\"name\":\"UserWhereInput\",\"constraints\":{\"maxNumFields\":null,\"minNumFields\":null},\"fields\":[{\"name\":\"AND\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"UserWhereInput\",\"kind\":\"object\",\"isList\":false},{\"type\":\"UserWhereInput\",\"kind\":\"object\",\"isList\":true}]},{\"name\":\"OR\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"UserWhereInput\",\"kind\":\"object\",\"isList\":false},{\"type\":\"UserWhereInput\",\"kind\":\"object\",\"isList\":true}]},{\"name\":\"NOT\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"UserWhereInput\",\"kind\":\"object\",\"isList\":false},{\"type\":\"UserWhereInput\",\"kind\":\"object\",\"isList\":true}]},{\"name\":\"id\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"StringFilter\",\"kind\":\"object\",\"isList\":false},{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"createdAt\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"DateTimeFilter\",\"kind\":\"object\",\"isList\":false},{\"type\":\"DateTime\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"email\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"StringFilter\",\"kind\":\"object\",\"isList\":false},{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"firstName\",\"isRequired\":false,\"isNullable\":true,\"inputTypes\":[{\"type\":\"StringNullableFilter\",\"kind\":\"object\",\"isList\":false},{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false},{\"type\":\"Null\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"lastName\",\"isRequired\":false,\"isNullable\":true,\"inputTypes\":[{\"type\":\"StringNullableFilter\",\"kind\":\"object\",\"isList\":false},{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false},{\"type\":\"Null\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"password\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"StringFilter\",\"kind\":\"object\",\"isList\":false},{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"roles\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"EnumRoleNullableListFilter\",\"kind\":\"object\",\"isList\":false}]}]},{\"name\":\"UserOrderByInput\",\"constraints\":{\"maxNumFields\":1,\"minNumFields\":0},\"fields\":[{\"name\":\"id\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"SortOrder\",\"kind\":\"enum\",\"isList\":false}]},{\"name\":\"createdAt\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"SortOrder\",\"kind\":\"enum\",\"isList\":false}]},{\"name\":\"email\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"SortOrder\",\"kind\":\"enum\",\"isList\":false}]},{\"name\":\"firstName\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"SortOrder\",\"kind\":\"enum\",\"isList\":false}]},{\"name\":\"lastName\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"SortOrder\",\"kind\":\"enum\",\"isList\":false}]},{\"name\":\"password\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"SortOrder\",\"kind\":\"enum\",\"isList\":false}]},{\"name\":\"roles\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"SortOrder\",\"kind\":\"enum\",\"isList\":false}]}]},{\"name\":\"UserWhereUniqueInput\",\"constraints\":{\"maxNumFields\":1,\"minNumFields\":1},\"fields\":[{\"name\":\"id\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"email\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}]}]},{\"name\":\"UserCreateInput\",\"constraints\":{\"maxNumFields\":null,\"minNumFields\":null},\"fields\":[{\"name\":\"id\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"createdAt\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"DateTime\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"email\",\"isRequired\":true,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"firstName\",\"isRequired\":false,\"isNullable\":true,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false},{\"type\":\"Null\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"lastName\",\"isRequired\":false,\"isNullable\":true,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false},{\"type\":\"Null\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"password\",\"isRequired\":true,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"roles\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"UserCreaterolesInput\",\"kind\":\"object\",\"isList\":false},{\"type\":\"Role\",\"kind\":\"enum\",\"isList\":true}]}]},{\"name\":\"UserUpdateInput\",\"constraints\":{\"maxNumFields\":null,\"minNumFields\":null},\"fields\":[{\"name\":\"id\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false},{\"type\":\"StringFieldUpdateOperationsInput\",\"kind\":\"object\",\"isList\":false}]},{\"name\":\"createdAt\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"DateTime\",\"kind\":\"scalar\",\"isList\":false},{\"type\":\"DateTimeFieldUpdateOperationsInput\",\"kind\":\"object\",\"isList\":false}]},{\"name\":\"email\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false},{\"type\":\"StringFieldUpdateOperationsInput\",\"kind\":\"object\",\"isList\":false}]},{\"name\":\"firstName\",\"isRequired\":false,\"isNullable\":true,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false},{\"type\":\"NullableStringFieldUpdateOperationsInput\",\"kind\":\"object\",\"isList\":false},{\"type\":\"Null\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"lastName\",\"isRequired\":false,\"isNullable\":true,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false},{\"type\":\"NullableStringFieldUpdateOperationsInput\",\"kind\":\"object\",\"isList\":false},{\"type\":\"Null\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"password\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false},{\"type\":\"StringFieldUpdateOperationsInput\",\"kind\":\"object\",\"isList\":false}]},{\"name\":\"roles\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"UserUpdaterolesInput\",\"kind\":\"object\",\"isList\":false},{\"type\":\"Role\",\"kind\":\"enum\",\"isList\":true}]}]},{\"name\":\"UserUpdateManyMutationInput\",\"constraints\":{\"maxNumFields\":null,\"minNumFields\":null},\"fields\":[{\"name\":\"id\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false},{\"type\":\"StringFieldUpdateOperationsInput\",\"kind\":\"object\",\"isList\":false}]},{\"name\":\"createdAt\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"DateTime\",\"kind\":\"scalar\",\"isList\":false},{\"type\":\"DateTimeFieldUpdateOperationsInput\",\"kind\":\"object\",\"isList\":false}]},{\"name\":\"email\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false},{\"type\":\"StringFieldUpdateOperationsInput\",\"kind\":\"object\",\"isList\":false}]},{\"name\":\"firstName\",\"isRequired\":false,\"isNullable\":true,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false},{\"type\":\"NullableStringFieldUpdateOperationsInput\",\"kind\":\"object\",\"isList\":false},{\"type\":\"Null\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"lastName\",\"isRequired\":false,\"isNullable\":true,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false},{\"type\":\"NullableStringFieldUpdateOperationsInput\",\"kind\":\"object\",\"isList\":false},{\"type\":\"Null\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"password\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false},{\"type\":\"StringFieldUpdateOperationsInput\",\"kind\":\"object\",\"isList\":false}]},{\"name\":\"roles\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"UserUpdaterolesInput\",\"kind\":\"object\",\"isList\":false},{\"type\":\"Role\",\"kind\":\"enum\",\"isList\":true}]}]},{\"name\":\"StringFilter\",\"constraints\":{\"maxNumFields\":null,\"minNumFields\":null},\"fields\":[{\"name\":\"equals\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"in\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":true}]},{\"name\":\"notIn\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":true}]},{\"name\":\"lt\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"lte\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"gt\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"gte\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"contains\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"startsWith\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"endsWith\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"mode\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"QueryMode\",\"kind\":\"enum\",\"isList\":false}]},{\"name\":\"not\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false},{\"type\":\"NestedStringFilter\",\"kind\":\"object\",\"isList\":false}]}]},{\"name\":\"DateTimeFilter\",\"constraints\":{\"maxNumFields\":null,\"minNumFields\":null},\"fields\":[{\"name\":\"equals\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"DateTime\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"in\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"DateTime\",\"kind\":\"scalar\",\"isList\":true}]},{\"name\":\"notIn\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"DateTime\",\"kind\":\"scalar\",\"isList\":true}]},{\"name\":\"lt\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"DateTime\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"lte\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"DateTime\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"gt\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"DateTime\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"gte\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"DateTime\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"not\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"DateTime\",\"kind\":\"scalar\",\"isList\":false},{\"type\":\"NestedDateTimeFilter\",\"kind\":\"object\",\"isList\":false}]}]},{\"name\":\"StringNullableFilter\",\"constraints\":{\"maxNumFields\":null,\"minNumFields\":null},\"fields\":[{\"name\":\"equals\",\"isRequired\":false,\"isNullable\":true,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false},{\"type\":\"Null\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"in\",\"isRequired\":false,\"isNullable\":true,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":true},{\"type\":\"Null\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"notIn\",\"isRequired\":false,\"isNullable\":true,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":true},{\"type\":\"Null\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"lt\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"lte\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"gt\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"gte\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"contains\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"startsWith\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"endsWith\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"mode\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"QueryMode\",\"kind\":\"enum\",\"isList\":false}]},{\"name\":\"not\",\"isRequired\":false,\"isNullable\":true,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false},{\"type\":\"NestedStringNullableFilter\",\"kind\":\"object\",\"isList\":false},{\"type\":\"Null\",\"kind\":\"scalar\",\"isList\":false}]}]},{\"name\":\"EnumRoleNullableListFilter\",\"constraints\":{\"maxNumFields\":null,\"minNumFields\":null},\"fields\":[{\"name\":\"equals\",\"isRequired\":false,\"isNullable\":true,\"inputTypes\":[{\"type\":\"Role\",\"kind\":\"enum\",\"isList\":true},{\"type\":\"Null\",\"kind\":\"scalar\",\"isList\":false}]}]},{\"name\":\"UserCreaterolesInput\",\"constraints\":{\"maxNumFields\":null,\"minNumFields\":null},\"fields\":[{\"name\":\"set\",\"isRequired\":true,\"isNullable\":false,\"inputTypes\":[{\"type\":\"Role\",\"kind\":\"enum\",\"isList\":true}]}]},{\"name\":\"StringFieldUpdateOperationsInput\",\"constraints\":{\"maxNumFields\":1,\"minNumFields\":1},\"fields\":[{\"name\":\"set\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}]}]},{\"name\":\"DateTimeFieldUpdateOperationsInput\",\"constraints\":{\"maxNumFields\":1,\"minNumFields\":1},\"fields\":[{\"name\":\"set\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"DateTime\",\"kind\":\"scalar\",\"isList\":false}]}]},{\"name\":\"NullableStringFieldUpdateOperationsInput\",\"constraints\":{\"maxNumFields\":1,\"minNumFields\":1},\"fields\":[{\"name\":\"set\",\"isRequired\":false,\"isNullable\":true,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false},{\"type\":\"Null\",\"kind\":\"scalar\",\"isList\":false}]}]},{\"name\":\"UserUpdaterolesInput\",\"constraints\":{\"maxNumFields\":null,\"minNumFields\":null},\"fields\":[{\"name\":\"set\",\"isRequired\":true,\"isNullable\":false,\"inputTypes\":[{\"type\":\"Role\",\"kind\":\"enum\",\"isList\":true}]}]},{\"name\":\"NestedStringFilter\",\"constraints\":{\"maxNumFields\":null,\"minNumFields\":null},\"fields\":[{\"name\":\"equals\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"in\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":true}]},{\"name\":\"notIn\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":true}]},{\"name\":\"lt\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"lte\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"gt\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"gte\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"contains\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"startsWith\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"endsWith\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"not\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false},{\"type\":\"NestedStringFilter\",\"kind\":\"object\",\"isList\":false}]}]},{\"name\":\"NestedDateTimeFilter\",\"constraints\":{\"maxNumFields\":null,\"minNumFields\":null},\"fields\":[{\"name\":\"equals\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"DateTime\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"in\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"DateTime\",\"kind\":\"scalar\",\"isList\":true}]},{\"name\":\"notIn\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"DateTime\",\"kind\":\"scalar\",\"isList\":true}]},{\"name\":\"lt\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"DateTime\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"lte\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"DateTime\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"gt\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"DateTime\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"gte\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"DateTime\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"not\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"DateTime\",\"kind\":\"scalar\",\"isList\":false},{\"type\":\"NestedDateTimeFilter\",\"kind\":\"object\",\"isList\":false}]}]},{\"name\":\"NestedStringNullableFilter\",\"constraints\":{\"maxNumFields\":null,\"minNumFields\":null},\"fields\":[{\"name\":\"equals\",\"isRequired\":false,\"isNullable\":true,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false},{\"type\":\"Null\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"in\",\"isRequired\":false,\"isNullable\":true,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":true},{\"type\":\"Null\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"notIn\",\"isRequired\":false,\"isNullable\":true,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":true},{\"type\":\"Null\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"lt\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"lte\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"gt\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"gte\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"contains\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"startsWith\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"endsWith\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"not\",\"isRequired\":false,\"isNullable\":true,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false},{\"type\":\"NestedStringNullableFilter\",\"kind\":\"object\",\"isList\":false},{\"type\":\"Null\",\"kind\":\"scalar\",\"isList\":false}]}]}],\"outputTypes\":[{\"name\":\"Query\",\"fields\":[{\"name\":\"findFirstUser\",\"args\":[{\"name\":\"where\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"UserWhereInput\",\"kind\":\"object\",\"isList\":false}]},{\"name\":\"orderBy\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"UserOrderByInput\",\"kind\":\"object\",\"isList\":true},{\"type\":\"UserOrderByInput\",\"kind\":\"object\",\"isList\":false}]},{\"name\":\"cursor\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"UserWhereUniqueInput\",\"kind\":\"object\",\"isList\":false}]},{\"name\":\"take\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"Int\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"skip\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"Int\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"distinct\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"UserDistinctFieldEnum\",\"kind\":\"enum\",\"isList\":true}]}],\"isRequired\":false,\"isNullable\":true,\"outputType\":{\"type\":\"User\",\"kind\":\"object\",\"isList\":false}},{\"name\":\"findManyUser\",\"args\":[{\"name\":\"where\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"UserWhereInput\",\"kind\":\"object\",\"isList\":false}]},{\"name\":\"orderBy\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"UserOrderByInput\",\"kind\":\"object\",\"isList\":true},{\"type\":\"UserOrderByInput\",\"kind\":\"object\",\"isList\":false}]},{\"name\":\"cursor\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"UserWhereUniqueInput\",\"kind\":\"object\",\"isList\":false}]},{\"name\":\"take\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"Int\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"skip\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"Int\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"distinct\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"UserDistinctFieldEnum\",\"kind\":\"enum\",\"isList\":true}]}],\"isRequired\":true,\"isNullable\":false,\"outputType\":{\"type\":\"User\",\"kind\":\"object\",\"isList\":true}},{\"name\":\"aggregateUser\",\"args\":[{\"name\":\"where\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"UserWhereInput\",\"kind\":\"object\",\"isList\":false}]},{\"name\":\"orderBy\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"UserOrderByInput\",\"kind\":\"object\",\"isList\":true},{\"type\":\"UserOrderByInput\",\"kind\":\"object\",\"isList\":false}]},{\"name\":\"cursor\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"UserWhereUniqueInput\",\"kind\":\"object\",\"isList\":false}]},{\"name\":\"take\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"Int\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"skip\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"Int\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"distinct\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"UserDistinctFieldEnum\",\"kind\":\"enum\",\"isList\":true}]}],\"isRequired\":true,\"isNullable\":false,\"outputType\":{\"type\":\"AggregateUser\",\"kind\":\"object\",\"isList\":false}},{\"name\":\"findOneUser\",\"args\":[{\"name\":\"where\",\"isRequired\":true,\"isNullable\":false,\"inputTypes\":[{\"type\":\"UserWhereUniqueInput\",\"kind\":\"object\",\"isList\":false}]}],\"isRequired\":false,\"isNullable\":true,\"outputType\":{\"type\":\"User\",\"kind\":\"object\",\"isList\":false}}]},{\"name\":\"Mutation\",\"fields\":[{\"name\":\"createOneUser\",\"args\":[{\"name\":\"data\",\"isRequired\":true,\"isNullable\":false,\"inputTypes\":[{\"type\":\"UserCreateInput\",\"kind\":\"object\",\"isList\":false}]}],\"isRequired\":true,\"isNullable\":false,\"outputType\":{\"type\":\"User\",\"kind\":\"object\",\"isList\":false}},{\"name\":\"deleteOneUser\",\"args\":[{\"name\":\"where\",\"isRequired\":true,\"isNullable\":false,\"inputTypes\":[{\"type\":\"UserWhereUniqueInput\",\"kind\":\"object\",\"isList\":false}]}],\"isRequired\":false,\"isNullable\":true,\"outputType\":{\"type\":\"User\",\"kind\":\"object\",\"isList\":false}},{\"name\":\"updateOneUser\",\"args\":[{\"name\":\"data\",\"isRequired\":true,\"isNullable\":false,\"inputTypes\":[{\"type\":\"UserUpdateInput\",\"kind\":\"object\",\"isList\":false}]},{\"name\":\"where\",\"isRequired\":true,\"isNullable\":false,\"inputTypes\":[{\"type\":\"UserWhereUniqueInput\",\"kind\":\"object\",\"isList\":false}]}],\"isRequired\":false,\"isNullable\":true,\"outputType\":{\"type\":\"User\",\"kind\":\"object\",\"isList\":false}},{\"name\":\"upsertOneUser\",\"args\":[{\"name\":\"where\",\"isRequired\":true,\"isNullable\":false,\"inputTypes\":[{\"type\":\"UserWhereUniqueInput\",\"kind\":\"object\",\"isList\":false}]},{\"name\":\"create\",\"isRequired\":true,\"isNullable\":false,\"inputTypes\":[{\"type\":\"UserCreateInput\",\"kind\":\"object\",\"isList\":false}]},{\"name\":\"update\",\"isRequired\":true,\"isNullable\":false,\"inputTypes\":[{\"type\":\"UserUpdateInput\",\"kind\":\"object\",\"isList\":false}]}],\"isRequired\":true,\"isNullable\":false,\"outputType\":{\"type\":\"User\",\"kind\":\"object\",\"isList\":false}},{\"name\":\"updateManyUser\",\"args\":[{\"name\":\"data\",\"isRequired\":true,\"isNullable\":false,\"inputTypes\":[{\"type\":\"UserUpdateManyMutationInput\",\"kind\":\"object\",\"isList\":false}]},{\"name\":\"where\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"UserWhereInput\",\"kind\":\"object\",\"isList\":false}]}],\"isRequired\":true,\"isNullable\":false,\"outputType\":{\"type\":\"BatchPayload\",\"kind\":\"object\",\"isList\":false}},{\"name\":\"deleteManyUser\",\"args\":[{\"name\":\"where\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"UserWhereInput\",\"kind\":\"object\",\"isList\":false}]}],\"isRequired\":true,\"isNullable\":false,\"outputType\":{\"type\":\"BatchPayload\",\"kind\":\"object\",\"isList\":false}},{\"name\":\"executeRaw\",\"args\":[{\"name\":\"query\",\"isRequired\":true,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"parameters\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"Json\",\"kind\":\"scalar\",\"isList\":false}]}],\"isRequired\":true,\"isNullable\":false,\"outputType\":{\"type\":\"Json\",\"kind\":\"scalar\",\"isList\":false}},{\"name\":\"queryRaw\",\"args\":[{\"name\":\"query\",\"isRequired\":true,\"isNullable\":false,\"inputTypes\":[{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}]},{\"name\":\"parameters\",\"isRequired\":false,\"isNullable\":false,\"inputTypes\":[{\"type\":\"Json\",\"kind\":\"scalar\",\"isList\":false}]}],\"isRequired\":true,\"isNullable\":false,\"outputType\":{\"type\":\"Json\",\"kind\":\"scalar\",\"isList\":false}}]},{\"name\":\"User\",\"fields\":[{\"name\":\"id\",\"args\":[],\"isRequired\":true,\"isNullable\":false,\"outputType\":{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}},{\"name\":\"createdAt\",\"args\":[],\"isRequired\":true,\"isNullable\":false,\"outputType\":{\"type\":\"DateTime\",\"kind\":\"scalar\",\"isList\":false}},{\"name\":\"email\",\"args\":[],\"isRequired\":true,\"isNullable\":false,\"outputType\":{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}},{\"name\":\"firstName\",\"args\":[],\"isRequired\":false,\"isNullable\":true,\"outputType\":{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}},{\"name\":\"lastName\",\"args\":[],\"isRequired\":false,\"isNullable\":true,\"outputType\":{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}},{\"name\":\"password\",\"args\":[],\"isRequired\":true,\"isNullable\":false,\"outputType\":{\"type\":\"String\",\"kind\":\"scalar\",\"isList\":false}},{\"name\":\"roles\",\"args\":[],\"isRequired\":false,\"isNullable\":true,\"outputType\":{\"type\":\"Role\",\"kind\":\"enum\",\"isList\":true}}]},{\"name\":\"AggregateUser\",\"fields\":[{\"name\":\"count\",\"args\":[],\"isRequired\":true,\"isNullable\":false,\"outputType\":{\"type\":\"Int\",\"kind\":\"scalar\",\"isList\":false}}]},{\"name\":\"BatchPayload\",\"fields\":[{\"name\":\"count\",\"args\":[],\"isRequired\":true,\"isNullable\":false,\"outputType\":{\"type\":\"Int\",\"kind\":\"scalar\",\"isList\":false}}]}],\"enums\":[{\"name\":\"UserDistinctFieldEnum\",\"values\":[\"id\",\"createdAt\",\"email\",\"firstName\",\"lastName\",\"password\",\"roles\"]},{\"name\":\"SortOrder\",\"values\":[\"asc\",\"desc\"]},{\"name\":\"Role\",\"values\":[\"Registered\",\"Admin\"]},{\"name\":\"QueryMode\",\"values\":[\"default\",\"insensitive\"]}]},\"mappings\":[{\"model\":\"User\",\"plural\":\"users\",\"findOne\":\"findOneUser\",\"findFirst\":\"findFirstUser\",\"findMany\":\"findManyUser\",\"create\":\"createOneUser\",\"delete\":\"deleteOneUser\",\"update\":\"updateOneUser\",\"deleteMany\":\"deleteManyUser\",\"updateMany\":\"updateManyUser\",\"upsert\":\"upsertOneUser\",\"aggregate\":\"aggregateUser\"}]}"

// We are parsing 2 times, as we want independent objects, because
// DMMFClass introduces circular references in the dmmf object
const dmmf = JSON.parse(dmmfString)
exports.dmmf = JSON.parse(dmmfString)

/**
 * Create the Client
 */

const config = {
  "generator": {
    "name": "client",
    "provider": "prisma-client-js",
    "output": "C:\\a\\Work\\zen\\node_modules\\@prisma\\client",
    "binaryTargets": [
      "native",
      "linux-musl"
    ],
    "previewFeatures": [
      "atomicNumberOperations"
    ],
    "config": {}
  },
  "sqliteDatasourceOverrides": [],
  "relativePath": "..\\..\\..\\prisma",
  "clientVersion": "2.8.0",
  "engineVersion": "e6c9b4b2b7fa162d0d459d1863321f547498fcfe"
}
config.document = dmmf
config.dirname = __dirname

const PrismaClient = getPrismaClient(config)
exports.PrismaClient = PrismaClient

Contribution

Hi I would like to contribute to the project! This is awesome. I have written a small function called createfields that follows your other codes convention to generate schema.json for admin based on prisma schema. Any guidelines of styles to send a pull request with new features?

Delete - Cannot read property 'find' of undefined.

When using the Delete package I get the following error.
Cannot read property 'find' of undefined.

My code looks like this:

    const prismaDelete = new PrismaDelete(
      context.prisma,
      path.join(process.cwd(), 'backend', 'prisma', 'schema.prisma')
    )
    await prismaDelete.onDelete({
      model: 'Invoice',
      where: { invoiceId: { in: id } },
    })

I think it' coming from this line:

    return this.schema.models.find((item) => item.name === modelName);

I think the problem is that PrismaDelete expects the schema to be of type SchemaObject from your prisma-tools/select package but I can't see anywhere that the schema is being parsed into that format? Am I missing something?

The docs also don't mention anything about needing to do that manually.

Is UUID supported with the nexus tools?

I get the following error when attempting to yarn dev


C:\Users\\code\prisma\prisma2-0707-relations\paljs-apollo-nexus-schema2\node_modules\@nexus\schema\src\utils.ts:360
    throw new Error("\n" + errors);
          ^
Error:
- Missing type UUID, did you forget to import a type to the root query?
    at Object.assertNoMissingTypes (C:\Users\\code\prisma\prisma2-0707-relations\paljs-apollo-nexus-schema2\node_modules\@nexus\schema\src\utils.ts:360:11)
    at Object.makeSchema (C:\Users\\code\prisma\prisma2-0707-relations\paljs-apollo-nexus-schema2\node_modules\@nexus\schema\src\builder.ts:1670:3)
    at Object.<anonymous> (C:\Users\\code\prisma\prisma2-0707-relations\paljs-apollo-nexus-schema2\src\nexusSchema.ts:5:23)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Module.m._compile (C:\Users\\code\prisma\prisma2-0707-relations\paljs-apollo-nexus-schema2\node_modules\ts-node\src\index.ts:858:23)
    at Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Object.require.extensions.<computed> [as .ts] (C:\Users\\code\prisma\prisma2-0707-relations\paljs-apollo-nexus-schema2\node_modules\ts-node\src\index.ts:861:12)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Suggestion of Generator options

Hi, can you add a option excludeFieldsAndQueriesAndMutationsByModel?

i just want to exclude some fields in some queries or mutations. E.g. exclude "id" field in mutations of update, remain "id" field in queries

PrismaTable edit row doesn't work when using uuid() instead of Int

When using UUIDs for the id of the model, everything works fine. However, when you click on "edit" it using router.query to get the id, but it strips the router.query variable and only uses the first 5 digits of the UUID.

For example: http://localhost:3000/admin/models/User?update=369062d2-119d-4be8-a471-b2bd81be74f9
Will error because it tries to do a look up on 369062d2 instead of the full string.

Default fields for nested entities

Whether it exists common approach how to add default fields to the entities? I have implemented something like:

`

schema.prisma

model User {
    id                                    string                 @id @default(cuid())
   organization                   Organization     @relation(fields: [organizationId], references: [id])
   organizationId                string
}
model Organization {
    id               string            @id @default(cuid())
    user           User
    type           Type             @relation(fields: [typeId], references: [id])
    typeId        String
}
model Type {
    id                          string                 @id @default(cuid())
    descriptionRaw   string
}

`

`
#resolvers.ts

Query: {
    types(parent: any, params: any, ctx: Context, info: any) {
        const modifiedSelect = { id:true, descriptionRaw: true }
        const select = new ctx.PrismaSelect(info, { select: modifiedSelect }).value;
        const prisma2Params = ctx.transforParamsToPrisma2(params);
        return ctx.prisma.types.findMany({ ...select, ...prisma2Params });
     },
    organization(parent: any, params: any, ctx: Context, info: any) {
        const modifiedSelect = {
            id: true,
            type: { select: { id: true, descriptionRaw: true } }
         }
        const select = new ctx.PrismaSelect(info, { select: modifiedSelect }).value;
        const prisma2Params = ctx.transforParamsToPrisma2(params);
        return ctx.prisma.types.findMany({ ...select, ...prisma2Params });
     },
     user(parent: any, params: any, ctx: Context, info: any) {
        const modifiedSelect = {
            id: true,
            organization: {
                id: true, 
                type: { select: { id: true, descriptionRaw: true } }
            }
         };
         ...
     }
 },
 Types: {
       description: async (parent: any, params: any, ctx: Context, info: any) => modifyDesc(parent.descriptionRaw);
  }

`
It works but looks very mass in case of complex schema. What to do if you need (for some reasons) id field for every entity? Do we need describe "type" select in every resolver? Will be cool have some approach which allow do reduce code and avoid repeats.

Support for passing a specific prisma client in plugins

Hi Ahmed,

I notice the plugins import the dmmf from '@prisma/client'. This causes an issue when using a custom path for the generated prisma client.

For example with this directive in the schema

generator client {
  provider = "prisma-client-js"
  output   = "../generated/database/client"
}

This is a likely scenario if building a GraphQL with multiple data sources, and therefore using more than one prisma client.

Would it be possible to support passing the client to the plugin?

Thanks!

How to do releases upgrade ?

Did we have any approach to upgrade the current project?

I create a project with "@paljs/generator": "^2.3.1".
so how can I update to ^2.3.2 automatically or provide some way to resolve the conflict?

Generate doesn't work using the example

Hello,

First, thanks a lot for your hard work on these tools, they are very helpful!

I just tried to generate a CRUD system using pal g for the nexus-plugin-prisma but it looks like it's not working (I've been using the example):

// schema.prisma

datasource postgresql {
  url      = env("DATABASE_URL")
  provider = "postgresql"
}

generator client {
  provider = "prisma-client-js"
}

model User {
  id        String   @id @default(cuid())
  email     String   @unique
  birthDate DateTime
  posts     Post[]
}

model Post {
  id     String @id @default(cuid())
  author User[]
}
// pal.js
module.exports = {
  backend: {
    generator: 'nexus-plugin-prisma',
  },
};
$ Prisma Schema loaded from prisma/schema.prisma
◢ Generating your files    SyntaxError: Unexpected token, expected "," (30:63)
      28 |                     },
      29 |                     async resolve(_root, args, ctx) {
    > 30 |                       return ctx.prisma.user.findFirst(argsas any)
         |                                                               ^
      31 |                     },
      32 |                   })
      33 | t.crud.users({ filtering: true, ordering: true })
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
$ pal --version
@paljs/cli/2.9.3 darwin-x64 node-v12.20.0

Am I missing anything?

Cheers

Providing usable examples for paljs

Thanks for your work!

I find it really hard to use prisma-tools because enough example code isn't provided, just bunch of interfaces. I have been trying to generate SDL from my schema.prisma file for days now with no success using pal g command, even after creating pal.json in my root directory with schema.prisma in the prisma directory relative to root.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.