Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

prisma-nestjs-graphql

unlight49kMIT21.1.1TypeScript support: included

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

nestjs, graphql, prisma, prisma-generator, nestjs-graphql

readme

prisma-nestjs-graphql

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

Features

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

Install

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

Usage

  1. Add new generator section to schema.prisma file
generator nestgraphql {
    provider = "node node_modules/prisma-nestjs-graphql"
    // for yarn monorepos
    // provider = "prisma-nestjs-graphql"
    output = "../src/@generated"
}
  1. Run prisma generate
npx prisma generate
  1. If your models have Decimal and Json types, you need install:
npm install graphql-type-json prisma-graphql-type-decimal

Or write you own graphql scalar types, read more on docs.nestjs.com.

Generator options

output

Output folder relative to this schema file
Type: string

outputFilePattern

File path and name pattern
Type: string
Default: {model}/{name}.{type}.ts
Possible tokens:

  • {model} Model name in dashed case or 'prisma' if unknown
  • {name} Dashed-case name of model/input/arg without suffix
  • {type} Short type name (model, input, args, output)
  • {plural.type} Plural short type name (models, inputs, enums)

tsConfigFilePath

Path to tsconfig.json (absolute path or relative to current working directory)
Type: string | undefined
Default: tsconfig.json if exists, undefined otherwise

prismaClientImport

The path to use to import the Prisma Client package Type: string | undefined Default: @prisma/client

combineScalarFilters

Combine nested/nullable scalar filters to single
Type: boolean
Default: false

noAtomicOperations

Remove input types for atomic operations
Type: boolean
Default: false

reExport

Create index.ts file with re-export
Type: enum
Values:
None Default, create nothing
Directories Create index file in all root directories
Single Create single index file in output directory
All Create index file in all root directories and in output directory

Example configuration:

generator nestgraphql {
    provider = "node node_modules/prisma-nestjs-graphql"
    output = "../src/@generated"
    reExport = Directories
}

emitSingle

Generate single file with merged classes and enums.
Type: boolean
Default: false

emitCompiled

Emit compiled JavaScript and definitions instead of TypeScript sources, files will be compiled with emitDecoratorMetadata:false, because there is a problem with temporal dead zone when generating merged file.
Type: boolean
Default: false

emitBlocks

Emit only selected blocks. Be aware, that some blocks do depend on others, e.g. one can't emit models without emitting enums.
Type: ("args" | "inputs" | "outputs" | "models" | "enums")[]
Default: ["args", "inputs", "outputs", "models", "enums"]

omitModelsCount

Omit _count field from models.
Type: boolean
Default: false

purgeOutput

Delete all files in output folder.
Type: boolean
Default: false

noTypeId

Disable usage of graphql ID type and use Int/Float for fields marked as @id in schema.
Type: boolean
Default: false

requireSingleFieldsInWhereUniqueInput

When a model *WhereUniqueInput class has only a single field, mark that field as required (TypeScript) and not nullable (GraphQL).
See #58 for more details.
Type: boolean
Default: false
Note: It will break compatiblity between Prisma types and generated classes.

unsafeCompatibleWhereUniqueInput

Set TypeScript property type as non optional for all fields in *WhereUniqueInput classes. See #177 for more details.
Type: boolean
Default: false

useInputType

Since GraphQL does not support input union type, this setting map allow to choose which input type is preferable.

generator nestgraphql {
    useInputType_{typeName}_{property} = "{pattern}"
}

Where:

  • typeName Full name or partial name of the class where need to choose input type.
    Example: UserCreateInput full name, WhereInput partial name, matches UserWhereInput, PostWhereInput, etc.
  • property Property of the class for which need to choose type. Special case name ALL means any / all properties.
  • pattern Part of name (or full) of type which should be chosen, you can use wild card or negate symbols, in this case pattern should starts with match:, e.g. match:*UncheckedCreateInput see outmatch for details.

Example:

export type PostWhereInput = {
  author?: XOR<UserRelationFilter, UserWhereInput>;
};
export type UserRelationFilter = {
  is?: UserWhereInput;
  isNot?: UserWhereInput;
};

export type UserWhereInput = {
  AND?: Enumerable<UserWhereInput>;
  OR?: Enumerable<UserWhereInput>;
  NOT?: Enumerable<UserWhereInput>;
  id?: StringFilter | string;
  name?: StringFilter | string;
};

We have generated types above, by default property author will be decorated as UserRelationFilter, to set UserWhereInput need to configure generator the following way:

generator nestgraphql {
  provider = "node node_modules/prisma-nestjs-graphql"
  output = "../src/@generated"
  useInputType_WhereInput_ALL = "WhereInput"
}
@InputType()
export class PostWhereInput {
  @Field(() => UserWhereInput, { nullable: true })
  author?: UserWhereInput;
}

decorate

Allow to attach multiple decorators to any field of any type.

generator nestgraphql {
    decorate_{key}_type = "outmatch pattern"
    decorate_{key}_field = "outmatch pattern"
    decorate_{key}_from = "module specifier"
    decorate_{key}_name = "import name"
    decorate_{key}_arguments = "[argument1, argument2]"
    decorate_{key}_defaultImport = "default import name" | true
    decorate_{key}_namespaceImport = "namespace import name"
    decorate_{key}_namedImport = "import name" | true
}

Where {key} any identifier to group values (written in flatten style)

  • decorate_{key}_type - outmatch pattern to match class name
  • decorate_{key}_field - outmatch pattern to match field name
  • decorate_{key}_from - module specifier to import from (e.g class-validator)
  • decorate_{key}_name - import name or name with namespace
  • decorate_{key}_defaultImport - import as default
  • decorate_{key}_namespaceImport - use this name as import namespace
  • decorate_{key}_namedImport - named import (without namespace)
  • decorate_{key}_arguments - arguments for decorator (if decorator need to be called as function)
    Special tokens can be used:
    • {propertyType.0} - field's type (TypeScript type annotation)

Example of generated class:

@ArgsType()
export class CreateOneUserArgs {
  @Field(() => UserCreateInput, { nullable: false })
  data!: UserCreateInput;
}

To make it validateable (assuming UserCreateInput already contains validation decorators from class-validator), it is necessary to add @ValidateNested() and @Type() from class-transformer.

decorate_1_type = "CreateOneUserArgs"
decorate_1_field = data
decorate_1_name = ValidateNested
decorate_1_from = "class-validator"
decorate_1_arguments = "[]"
decorate_2_type = "CreateOneUserArgs"
decorate_2_field = data
decorate_2_from = "class-transformer"
decorate_2_arguments = "['() => {propertyType.0}']"
decorate_2_name = Type

Result:

import { ValidateNested } from 'class-validator';
import { Type } from 'class-transformer';

@ArgsType()
export class CreateOneUserArgs {
  @Field(() => UserCreateInput, { nullable: false })
  @ValidateNested()
  @Type(() => UserCreateInput)
  data!: UserCreateInput;
}

Another example:

decorate_2_namespaceImport = "Transform"
decorate_2_name = "Transform.Type"
import * as Transform from 'class-transformer';

@Transform.Type(() => UserCreateInput)
data!: UserCreateInput;

Add @HideField() decorator to nested types:

decorate_3_type = "*CreateNestedOneWithoutUserInput"
decorate_3_field = "!(create)"
decorate_3_name = "HideField"
decorate_3_from = "@nestjs/graphql"
decorate_3_arguments = "[]"

May generate following class:

@Field(() => ProfileCreateWithoutUserInput, { nullable: true })
create?: ProfileCreateWithoutUserInput;

@HideField()
connectOrCreate?: ProfileCreateOrConnectWithoutUserInput;

@HideField()
connect?: ProfileWhereUniqueInput;

graphqlScalars

Allow to set custom graphql type for Prisma scalar type. Format:

graphqlScalars_{type}_name = "string"
graphqlScalars_{type}_specifier = "string"

where {type} is a prisma scalar type name (e.g. BigInt)

Example:

graphqlScalars_BigInt_name = "GraphQLBigInt"
graphqlScalars_BigInt_specifier = "graphql-scalars"

May generate:

import { GraphQLBigInt } from 'graphql-scalars';

export class BigIntFilter {
  @Field(() => GraphQLBigInt, { nullable: true })
  equals?: bigint | number;
}

It will affect all inputs and outputs types (including models).

customImport

Allow to declare custom import statements. (Only works with emitSingle = true)

generator nestgraphql {
    customImport_{key}_from = "module specifier"
    customImport_{key}_name = "import name"
    customImport_{key}_defaultImport = "default import name" | true
    customImport_{key}_namespaceImport = "namespace import name"
    customImport_{key}_namedImport = "import name" | true
}

Where {key} any identifier to group values (written in flatten style)

  • customImport_{key}_from - module specifier to import from (e.g nestjs-i18n)
  • customImport_{key}_name - import name or name with namespace
  • customImport_{key}_defaultImport - import as default
  • customImport_{key}_namespaceImport - use this name as import namespace
  • customImport_{key}_namedImport - named import (without namespace)

Documentation and field options

Comments with triple slash will projected to typescript code comments and some @Field() decorator options

For example:

model Product {
  /// Old description
  /// @deprecated Use new name instead
  /// @complexity 1
  oldName String
}

May produce:

@ObjectType()
export class Product {
  /**
   * Old description
   * @deprecated Use new name instead
   */
  @Field(() => String, {
    description: 'Old description',
    deprecationReason: 'Use new name instead',
    complexity: 1,
  })
  oldName: string;
}

Field Settings

Special directives in triple slash comments for more precise code generation.

@HideField()

Removes field from GraphQL schema.
Alias: `@TypeGraphQL.omit(output: true)`

By default (without arguments) field will be decorated for hide only in output types (type in schema).
To hide field in input types add input: true.
To hide field in specific type you can use glob pattern match: string | string[] see outmatch for details.

Examples:

  • @HideField() same as @HideField({ output: true })
  • @HideField({ input: true, output: true })
  • @HideField({ match: 'UserCreate*Input' })
model User {
    id String @id @default(cuid())
    /// @HideField()
    password String
    /// @HideField({ output: true, input: true })
    secret String
    /// @HideField({ match: '@(User|Comment)Create*Input' })
    createdAt DateTime @default(now())
}

May generate classes:

@ObjectType()
export class User {
  @HideField()
  password: string;
  @HideField()
  secret: string;
  @Field(() => Date, { nullable: false })
  createdAt: Date;
}
@InputType()
export class UserCreateInput {
  @Field()
  password: string;
  @HideField()
  secret: string;
  @HideField()
  createdAt: Date;
}

Custom Decorators

Applying custom decorators requires configuration of generator.

generator nestgraphql {
    fields_{namespace}_from = "module specifier"
    fields_{namespace}_input = true | false
    fields_{namespace}_output = true | false
    fields_{namespace}_model = true | false
    fields_{namespace}_defaultImport = "default import name" | true
    fields_{namespace}_namespaceImport = "namespace import name"
    fields_{namespace}_namedImport = true | false
}

Create configuration map in flatten style for {namespace}.
Where {namespace} is a namespace used in field triple slash comment.

fields_{namespace}_from

Required. Name of the module, which will be used in import (class-validator, graphql-scalars, etc.)
Type: string

fields_{namespace}_input

Means that it will be applied on input types (classes decorated by InputType)
Type: boolean
Default: false

fields_{namespace}_output

Means that it will be applied on output types (classes decorated by ObjectType), including models
Type: boolean
Default: false

fields_{namespace}_model

Means that it will be applied only on model types (classes decorated by ObjectType)
Type: boolean
Default: false

fields_{namespace}_defaultImport

Default import name, if module have no namespace.
Type: undefined | string | true
Default: undefined
If defined as true then import name will be same as {namespace}

fields_{namespace}_namespaceImport

Import all as this namespace from module
Type: undefined | string
Default: Equals to {namespace}

fields_{namespace}_namedImport

If imported module has internal namespace, this allow to generate named import,
imported name will be equal to {namespace}, see example of usage
Type: boolean
Default: false

Custom decorators example:

generator nestgraphql {
    fields_Validator_from = "class-validator"
    fields_Validator_input = true
}

model User {
    id Int @id
    /// @Validator.MinLength(3)
    name String
}

May generate following class:

import { InputType, Field } from '@nestjs/graphql';
import * as Validator from 'class-validator';

@InputType()
export class UserCreateInput {
  @Field(() => String, { nullable: false })
  @Validator.MinLength(3)
  name!: string;
}

Custom decorators can be applied on classes (models):

/// @NG.Directive('@extends')
/// @NG.Directive('@key(fields: "id")')
model User {
    /// @NG.Directive('@external')
    id String @id
}

generator nestgraphql {
    fields_NG_from = "@nestjs/graphql"
    fields_NG_output = false
    fields_NG_model = true
}

May generate:

import * as NG from '@nestjs/graphql';

@NG.Directive('@extends')
@NG.Directive('@key(fields: "id")')
export class User {
    @Field(() => ID, { nullable: false })
    @NG.Directive('@external')
    id!: string;

@FieldType()

Allow set custom GraphQL scalar type for field

To override scalar type in specific classes, you can use glob pattern match: string | string[] see outmatch for details.

model User {
    id Int @id
    /// @FieldType({ name: 'Scalars.GraphQLEmailAddress', from: 'graphql-scalars', input: true })
    email String
}

May generate following class:

import { InputType, Field } from '@nestjs/graphql';
import * as Scalars from 'graphql-scalars';

@InputType()
export class UserCreateInput {
  @Field(() => Scalars.GraphQLEmailAddress, { nullable: false })
  email!: string;
}

And following GraphQL schema:

scalar EmailAddress

input UserCreateInput {
    email: EmailAddress!
}

Same field type may be used in different models and it is not convenient to specify every time all options. There is a shortcut:

generator nestgraphql {
    fields_Scalars_from = "graphql-scalars"
    fields_Scalars_input = true
    fields_Scalars_output = true
}

model User {
    id Int @id
    /// @FieldType('Scalars.GraphQLEmailAddress')
    email String
}

The result will be the same. Scalars is the namespace here. Missing field options will merged from generator configuration.

@PropertyType()

Similar to @FieldType() but refer to TypeScript property (actually field too).

To override TypeScript type in specific classes, you can use glob pattern match: string | string[] see outmatch for details.

Example:

generator nestgraphql {
    fields_TF_from = "type-fest"
}

model User {
    id String @id
    /// @PropertyType('TF.JsonObject')
    data Json
}

May generate:

import * as TF from 'type-fest';

@ObjectType()
export class User {
  @Field(() => GraphQLJSON)
  data!: TF.JsonObject;
}

@Directive()

Allow attach @Directive decorator from @nestjs/graphql

GraphQL federation example:

/// @Directive({ arguments: ['@extends'] })
/// @Directive({ arguments: ['@key(fields: "id")'] })
model User {
    /// @Directive({ arguments: ['@external'] })
    id String @id
}

May generate:

@ObjectType()
@Directive('@extends')
@Directive('@key(fields: "id")')
export class User {
  @Field(() => ID, { nullable: false })
  @Directive('@external')
  id!: string;
}

@ObjectType()

Allow rename type in schema and mark as abstract.

Example 1:

// schema.prisma
/// @ObjectType({ isAbstract: true })
model User {
    id Int @id
}
@ObjectType({ isAbstract: true })
export class User {}

Example 2:

// schema.prisma
/// @ObjectType('Human', { isAbstract: true })
model User {
    id Int @id
}
@ObjectType('Human', { isAbstract: true })
export class User {}

Using library in other generators

import { generate } from 'prisma-nestjs-graphql/generate';

Similar Projects

Resources

TODO

  • keyof typeof SortOrder -> SortOrder
  • dummy-createfriends.input.ts -> create-friends
  • check 'TODO FIXME'
  • 22.12 node require esm (update all deps to latest)

License

MIT License (c) 2025

changelog

21.1.1 (2025-01-26)

Bug Fixes

  • Correct customImport description (0933486)

21.1.0 (2025-01-25)

Features

  • Add generator option for custom import for emitSingle (46fed69)

21.0.2 (2025-01-19)

Bug Fixes

  • Change generated enum type to ticked style (2a0fe84)

21.0.1 (2025-01-18)

Bug Fixes

  • New names when combineScalarFilters enabled (88862bd)

21.0.0 (2025-01-18)

⚠ BREAKING CHANGES

  • Prisma 6

Bug Fixes

  • Cannot find model by name (c69a10b), closes #228
  • Change Bytes generated type to Uint8Array (de3f17c)

Miscellaneous Chores

20.1.0 (2025-01-18)

Features

  • Support @Field() option 'complexity' through comment line (ef8c327)

20.0.3 (2024-05-19)

Bug Fixes

20.0.2 (2023-12-17)

Bug Fixes

  • AwaitEventEmitter is not a constructor (6f97126), closes #200

20.0.1 (2023-12-17)

Bug Fixes

20.0.0 (2023-12-15)

⚠ BREAKING CHANGES

  • Bump version

Miscellaneous Chores

19.3.1 (2023-12-15)

Bug Fixes

19.3.1 (2023-12-15)

Bug Fixes

19.3.0 (2023-11-25)

Features

  • add the prisma client import option (00c81d5)

19.2.0 (2023-09-23)

Features

  • compatibility: New configuration option unsafeCompatibleWhereUniqueInput (72a3dab), closes #177

19.1.0 (2023-09-19)

Features

  • Add options to generate only selected blocks (cabe9bd)

19.0.1 (2023-08-04)

Bug Fixes

  • Compound primary key generated type (64a9854), closes #182

19.0.0 (2023-07-24)

⚠ BREAKING CHANGES

  • Update packages

Miscellaneous Chores

18.1.2 (2023-07-24)

Bug Fixes

  • Combine scalars option with nullable relation filter (471c405)
  • Compatibility Issues with Prisma 5 (1e1bee3), closes #179
  • Emit single with Prisma type (94df9cf)
  • More precise get model name (96323c1)

18.1.1 (2023-07-21)

Bug Fixes

  • Fix in getModelName helper (190ab33)

18.1.0 (2023-07-04)

Features

  • Allow the use of the generate function without the onGenerate (a566cca), closes #168 #169

18.0.2 (2023-05-09)

Bug Fixes

18.0.1 (2023-05-09)

Bug Fixes

  • Select input type from multiple options (81aeb02)

18.0.0 (2023-04-02)

⚠ BREAKING CHANGES

  • Require @prisma/client v4.12+
  • Must be used with optional dependency prisma-graphql-type-decimal v3.0.0+

Bug Fixes

17.1.0 (2022-12-31)

Features

  • Allow hide property using decorate in config (b83beeb)

17.0.3 (2022-12-14)

Bug Fixes

  • Combine scalar filters with fieldReference (1f1ef9c), closes #148
  • combine scalars: Bytes filter (6b0a156)
  • Detect graphql type (89a59cc), closes #148

17.0.2 (2022-11-20)

Bug Fixes

  • Fix: Handle FindUniq/First..OrThrowArgs name (0419d0d)
  • Pin ts-morph to specific range (d076fe9), closes #146

17.0.1 (2022-08-29)

Bug Fixes

17.0.0 (2022-06-30)

⚠ BREAKING CHANGES

  • Update library to support to Prisma v4

Miscellaneous Chores

  • Update library to support to Prisma v4 (1456303), closes #123

16.0.1 (2022-05-23)

Bug Fixes

  • Decorate parent decimal inputs (9a7da40), closes #113

16.0.0 (2022-05-22)

⚠ BREAKING CHANGES

  • @Type decorator will be added to some input classes

Bug Fixes

  • Create decimal value object (f368231), closes #113
  • No atomic operations for scalar input list (e55767b)

15.3.3 (2022-05-22)

Bug Fixes

  • No atomic operations for scalar input list (e55767b)

15.3.2 (2022-05-22)

Bug Fixes

  • No atomic operations for scalar input list (d32b03c)

15.3.1 (2022-05-10)

Bug Fixes

  • generate: allow datamodels.type to be undefined (faefc8f), closes #106

15.3.0 (2022-05-06)

Features

15.2.6 (2022-05-03)

Bug Fixes

  • hide field: Fields in nested types (2760d9e), closes #80

15.2.5 (2022-05-02)

Bug Fixes

  • hide field: Self relation field (5cb4311), closes #103

15.2.4 (2022-05-02)

Bug Fixes

  • mongodb: Get matching input type from Json (e16cad0)

15.2.3 (2022-05-02)

Bug Fixes

  • mongodb: Support composite types (behaves like model) (d505ecb), closes #99

15.2.2 (2022-04-12)

Bug Fixes

  • other: Fail model with single id field in mongodb (4d19e9a), closes #96

15.2.1 (2022-04-03)

Bug Fixes

  • tsConfigFilePath is ignored (d98e146), closes #88

15.2.0 (2022-03-26)

Features

  • Support reexport with custom output pattern (2786894)

15.1.1 (2022-03-21)

Bug Fixes

15.1.0 (2022-03-16)

Features

  • Use Prisma.Decimal typescript type (0395e5f)

15.0.0 (2022-03-15)

⚠ BREAKING CHANGES

  • other: defaults input and output in PropertyType to false

Bug Fixes

  • other: Makes proptype resolution behave like fieldtype (850018a)

14.7.1 (2022-03-12)

Bug Fixes

  • Remove unused classes when both noAtomicOperations and emitSingle enabled (41ce3c1), closes #89

14.7.0 (2022-03-08)

Features

  • configuration: Allow to map prisma scalars to custom graphql scalars (59300e1), closes #87

14.6.2 (2022-02-20)

Bug Fixes

  • Make fields in count output undefinable (8e3d85c)

14.6.1 (2021-11-25)

Bug Fixes

  • hide field: Missing import of enum type (b067142), closes #73

14.6.0 (2021-10-16)

Features

  • custom decorators: Allow attach @Directive() (d6faef0)

14.5.0 (2021-10-12)

Features

  • custom decorators: Allow apply custom decorator on models (52f090a), closes #63

14.4.1 (2021-10-05)

Bug Fixes

  • Missing import in hidden type (29e5a8e), closes #62

14.4.0 (2021-09-30)

Features

  • match: Allows match expressions in FieldType and PropertyType (#60) (a9b0e46)

14.3.0 (2021-09-28)

Features

  • require single uniq filter: New requireSingleFieldsInWhereUniqueInput generator setting (7ee73eb), closes #58

14.2.2 (2021-09-27)

Bug Fixes

  • compatibility: Add typescript null type for optional fields in model (df0b9de), closes #57

14.2.1 (2021-09-24)

Bug Fixes

  • custom decorators: FieldType mapping for output types (c036a10), closes #55

14.2.0 (2021-09-23)

Features

  • custom decorators: Abstract and rename type (eb68ca6), closes #40
  • custom decorators: New decorate generator setting (c5e14b7), closes #48

Bug Fixes

  • Get model name for CompoundUniqueInput (f44aa85), closes #53

14.0.1 (2021-09-07)

Bug Fixes

  • Getting json nullable enum (d001714)

14.0.0 (2021-09-06)

⚠ BREAKING CHANGES

Code Refactoring

  • Replace matcher by outmatch (fa7c003)

13.0.0 (2021-08-28)

⚠ BREAKING CHANGES

  • Removed deprecated setting types_*
  • Model is regenerating ignoring existing data, any manual changes will be discarded
  • Enum is regerating now, any manual changes will be discarded

Features

  • configuration: Option to disable ID graphql type (8474da7), closes #44

Bug Fixes

  • Regenerate enum ignoring existing values (c581bc7), closes #45
  • Regenerate model ignoring existing data (62ffd83), closes #45

Miscellaneous Chores

  • Removed deprecated setting types_* (3491398)

12.2.1 (2021-07-23)

Bug Fixes

  • compatibility: Make model types compatible from both sides Prisma and GraphQL (c015f12), closes #41
  • Get model name from {Model}AggregateArgs type (0703f7e)

12.2.0 (2021-07-06)

Features

  • Duplicate comments in jsdoc (002a055), closes #39

12.1.0 (2021-07-02)

Features

  • hide field: Allow hide field in type matching by pattern (6c05123), closes #37

12.0.3 (2021-06-05)

Bug Fixes

  • custom decorators: FieldType respect input/output in generator settings (a075e00), closes #34

12.0.2 (2021-06-05)

Bug Fixes

  • other: Ignore @HideField() for output count fields (ce3eec2), closes #33

12.0.1 (2021-05-22)

Bug Fixes

12.0.0 (2021-05-20)

⚠ BREAKING CHANGES

  • compatibility: Possible breaking change aggregation keywords use underscore as prefix to prevent field clashes

Features

  • useInputType config option allow to choose input type (54eeb1c)

Bug Fixes

  • Make types same as in prisma (1f5bc4e)
  • compatibility: Rename aggregation keywords (83491c8)

11.4.5 (2021-05-13)

Bug Fixes

  • Combine scalar filters on nullable list (8f306e8)
  • Get graphql type for scalar list (97a1ae4), closes #30

11.4.4 (2021-05-11)

Bug Fixes

  • custom decorators: Prevent applying on aggregate inputs (9b21970)

11.4.3 (2021-05-11)

Bug Fixes

  • custom decorators: Reget decorator full name (9e279bf), closes #29

11.4.2 (2021-05-11)

Bug Fixes

  • custom decorators: Missed imports when enabled emitSingle (bf55996), closes #28

11.4.1 (2021-05-09)

Bug Fixes

  • Multiple namespace imports (e096af0), closes #27

11.4.0 (2021-04-28)

Features

  • configuration: Allow purge output folder (a360869), closes #7

11.3.1 (2021-04-25)

Bug Fixes

  • Existence check of tsconfig (4d523d2), closes #23

11.3.0 (2021-04-25)

Features

  • @PropertyType() to replace types_ configuration (4a7313d)

Bug Fixes

  • Model types mismatch (ffe70b6), closes #21
  • Prisma client generator is optional (4ce28f1), closes #25

11.2.0 (2021-04-16)

Features

  • Alternative default import configuration (4ae1b82)
  • Apply custom decorators on models (34196b3)

11.1.0 (2021-04-07)

Features

Bug Fixes

  • Custom type for output types (c9ae9e9)

11.0.3 (2021-04-01)

Bug Fixes

11.0.2 (2021-03-31)

Bug Fixes

  • Emit metadata and enabled emitSingle cause TDZ issue (0d89d81), closes #16

11.0.1 (2021-03-31)

Bug Fixes

  • Source file already exists error (121a486)

11.0.0 (2021-03-31)

⚠ BREAKING CHANGES

  • Adapted to Prisma 2.20

Bug Fixes

10.3.0 (2021-03-29)

Features

  • Allow generate compiled files or merged to single file (095f975), closes #15

10.2.0 (2021-03-19)

Features

10.1.3 (2021-03-19)

Bug Fixes

  • Hide field for model type (54571d2)

10.1.2 (2021-03-17)

Bug Fixes

  • Re-export iteration process fail (bad1034)

10.1.1 (2021-03-17)

Bug Fixes

  • Added more keywords for detection model name (51c836e)

10.1.0 (2021-03-13)

Features

  • Allow to configure path to tsconfig.json (ead4411)
  • Validate outputFilePattern (3240a73)

Bug Fixes

  • Save files without intermediate layer (4a07bea)

Performance Improvements

  • Generation of inputs/outputs (4604160)

10.0.2 (2021-03-13)

Bug Fixes

  • Added more keywords for detection model name (51c836e)

10.0.1 (2021-03-04)

Bug Fixes

  • BigInt property type in lower (19ace4e)
  • Conflict with models ending with Output (a08d4c4), closes #10

10.0.0 (2021-03-01)

Bug Fixes

  • Generate correct json graphql type (c6d8d46)
  • Json type changed to Record<string, any> (2877be7)
  • Renamed config option (d989cfe)
  • refactor!: Renamed token in outputFilePattern template (95d4629)
  • refactor!: Removed renameZooTypes config option (71bfb68)
  • chore!: Renamed config option atomicNumberOperation to noAtomicOperations (6078eb9)

Code Refactoring

Features

  • Ability to hide field in schema (a222955), closes #8

Performance Improvements

BREAKING CHANGES

  • Renamed token {feature} to {model} in outputFilePattern template pattern
  • Removed renameZooTypes config option
  • Config option combineScalarFilters is false by default
  • Made all options which mutates/renames types are false
  • Inverted config option atomicNumberOperations to noAtomicNumberOperations Replace atomicNumberOperations = false by noAtomicNumberOperations = true

9.0.0 (2021-02-06)

Features

  • New option rename zoo types (04cb5af)

BREAKING CHANGES

  • Adapt generator to Prisma 2.16

8.0.0 (2021-01-27)

Bug Fixes

  • Typescript property type now same as graphql type (151d380)

BREAKING CHANGES

  • Typescript property type now same as graphql type

7.2.0 (2021-01-22)

Features

  • Adapted generator to Prisma 2.15 (77b87a6)

7.1.0 (2021-01-07)

Features

  • Adapted generator to Prisma 2.14 (26a23c4)
  • Export all classes from one file (92ca651), closes #5

7.0.0 (2021-01-04)

Bug Fixes

  • Type mismatch between prisma types (b5587cd), closes #4

BREAKING CHANGES

  • Generated types tries to be compatible with Prisma types, nullability (optional/required) changed for input types

6.0.2 (2020-12-23)

Bug Fixes

  • Custom field types array (ead56a4)
  • Generate another commented class (cc08dee)

6.0.1 (2020-12-12)

Bug Fixes

  • Remove unused imports in generated files (96ef374)

6.0.0 (2020-12-12)

Bug Fixes

  • prisma: Adapt generator to Prisma v2.13 (d1ae8b1)

BREAKING CHANGES

  • prisma: Adapt generator to Prisma v2.13

5.1.1 (2020-12-07)

Bug Fixes

  • Remove duplicated input types (53d5721)

5.1.0 (2020-12-03)

Features

  • Generate commented class if re-export found (dc3e268)

5.0.1 (2020-12-01)

Bug Fixes

  • Scalar filters compatibility (02acba8)

5.0.0 (2020-12-01)

Bug Fixes

  • Switched to replace mode (d04c3ef)

BREAKING CHANGES

  • Switched to replace mode generation of files, all extra field which are not exists in model will be removed

4.0.1 (2020-11-27)

Bug Fixes

  • Do not generate undefined properties (c7127a4)

Performance Improvements

4.0.0 (2020-11-27)

Bug Fixes

  • Generator options: dasherizedName renamed to name (c537340)

Features

  • New token {plural.type} for outputFilePattern generator options (51cc938)

BREAKING CHANGES

  • Generator options: dasherizedName renamed to name

3.0.0 (2020-11-26)

Bug Fixes

BREAKING CHANGES

  • Adapted to prisma 2.12

2.1.0 (2020-11-20)

Bug Fixes

Features

  • Custom graphql field mapping (10fb039)
  • Custom property mapping (f8cc54d)

Performance Improvements

2.0.2 (2020-11-14)

Bug Fixes

  • Enum atomic operation are not processed (43a2506)

2.0.1 (2020-11-13)

Bug Fixes

  • Missing enum import type with enum filter object (a5356c3), closes #3

2.0.0 (2020-10-04)

Bug Fixes

  • Adapted generator to Prisma 2.8 (4ac4779)

BREAKING CHANGES

  • Adapted generator to Prisma 2.8

1.6.0 (2020-09-08)

Features

  • Generate other output types (55e5cd5)

1.5.0 (2020-09-07)

Features

1.4.0 (2020-09-04)

Features

  • Option to disable atomic number operations (3319ff9)

1.3.1 (2020-09-03)

Bug Fixes

1.3.0 (2020-08-30)

Features

  • Generate aggregate input types (66239bb)

1.2.0 (2020-08-29)

Bug Fixes

  • Detection property nullable type (2121885)

Features

  • Combine zoo of nested/nullable filters (20f965b)

1.1.4 (2020-08-22)

Bug Fixes

  • Generate enumerable filters (9f35c9a)

1.1.3 (2020-08-21)

Bug Fixes

  • Added new feature split keywords (e780043)

1.1.2 (2020-08-16)

Bug Fixes

  • Corrected scalar property type for where type (b9e5937)

1.1.1 (2020-08-16)

Bug Fixes

  • Generate distinct related enums with bound feature (d055e3b)
  • Removed unnecessary create enum from input type (e6774ab)

1.1.0 (2020-08-15)

Features

  • Generate JSON scalar type (82007d7)
  • Skip write stage for files with no changes (ecc2fb8)

1.0.0 (2020-08-10)

Features