Releases: MichalLytek/typegraphql-prisma
0.23.0
Changelog
-
This release enables support for the new
filteredRelationCount
preview feature 🚀It allows using conditions while getting relations count. Thanks to this, you can now use enhanced queries, e.g.:
query UsersWithAdvertKindPostsCount { users { id name _count { advertPosts: posts(where: { kind: { equals: ADVERT } }) } } }
{ "data": { "users": [ { "id": 1, "name": "Test", "_count": { "advertPosts": 5 } } ] } }
-
Introducing
filteredRelationCount
support required some changes aroundtransformFields
in generated resolvers, so be aware of the minor changes in the resolvers body. They should not affect the way normal queries are handled, even with the feature flag turned off.
0.22.2
Changelog
-
Supported Prisma version has been bumped to v4.6.0 🚀
Because of some changes in DMMF, this time it contains two new operations:findUniqueOrThrow
andfindFirstOrThrow
.
By default,findUniqueOrThrow
will be mapped togetXYZ
query:@TypeGraphQL.Resolver(_of => Category) export class FindUniqueCategoryOrThrowResolver { @TypeGraphQL.Query(_returns => Category, { nullable: true }) async getCategory(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindUniqueCategoryOrThrowArgs): Promise<Category | null> { const { _count } = transformFields( graphqlFields(info as any) ); return getPrismaFromContext(ctx).category.findUniqueOrThrow({ ...args, ...(_count && transformCountFieldIntoSelectRelationsCount(_count)), }); } }
-
filteredRelationCount
support is also work in progress. You can expect it to work in next release 👀
0.22.1
Changelog
-
Supported Prisma version has been bumped to v4.5.0 🚀
It also supportsextendedWhereUnique
preview feature. -
filteredRelationCount
support is also work in progress. Stay tuned! 📻
0.22.0
Changelog
-
Supported Prisma version has been bumped to v4.4.0 🚀
-
Recently introduced feature
useSimpleUpdateInputs
has been enhanced and improved. Now it's nameduseSimpleInputs
and affects alsocreate
inputs, which fixes inconvenience while working with MongoDB and nested documents 💪More info about this feature in the docs:
https://prisma.typegraphql.com/docs/advanced/simple-inputs
0.21.5
Changelog
This release contains two new features! 🚀
-
A long awaited generator option to emit flat input fields (without 'set' and other operations) described in #221 has been finally implemented! 🎉
By using
useSimpleUpdateInputs = true
generator option, instead of generating nested inputs withIntFieldUpdateOperationsInput
orStringFieldUpdateOperationsInput
as a field type, it will emit much simpler version of inputs for update operations with just scalar fields:@TypeGraphQL.InputType("CategoryUpdateInput", { isAbstract: true, }) export class CategoryUpdateInput { - @TypeGraphQL.Field(_type => StringFieldUpdateOperationsInput, { + @TypeGraphQL.Field(_type => String, { nullable: true, }) - name?: StringFieldUpdateOperationsInput | undefined; + name?: string | undefined; - @TypeGraphQL.Field(_type => StringFieldUpdateOperationsInput, { + @TypeGraphQL.Field(_type => String, { nullable: true, }) - slug?: StringFieldUpdateOperationsInput | undefined; + slug?: string | undefined; - @TypeGraphQL.Field(_type => IntFieldUpdateOperationsInput, { + @TypeGraphQL.Field(_type => TypeGraphQL.Int, { nullable: true, }) - number?: IntFieldUpdateOperationsInput | undefined; + number?: number | undefined; }
-
A new parameter called
plural
for the@@TypeGraphQL.type
docs attribute, e.g./// @@TypeGraphQL.type(plural: "equipments")
.It allows overriding the default plural detection mechanism, so that you can provide your custom word for models with names that do not have plural form, e.g.
Equipment
. With this option, the generator will emit proper names for queries that normally would have a form offindManyXYZ
orfindUniqueXYZ
:@TypeGraphQL.Resolver(_of => Equipment) export class FindManyEquipmentResolver { @TypeGraphQL.Query(_returns => [Equipment], { nullable: false }) - async findManyEquipment(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindManyEquipmentArgs): Promise<Equipment[]> { + async equipments(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindManyEquipmentArgs): Promise<Equipment[]> { const { _count } = transformFields( graphqlFields(info as any) ); return getPrismaFromContext(ctx).equipment.findMany({ ...args, ...(_count && transformCountFieldIntoSelectRelationsCount(_count)), }); } }
0.21.4
Changelog
-
Supported Prisma version has been bumped to
v4.3.0
🚀 -
Support for new Prisma Preview Features:
fieldReference
andfilteredRelationCount
, will be added in a near future. Stay tuned! 📻
0.21.3
Changelog
- The supported Prisma version has been upgraded v4.2.0 💪
There's no breaking changes expected, all should work flawlessly.
0.21.2
0.21.1
Changelog
-
The supported Prisma version has been upgraded v4.1.0 💪
There's no breaking changes expected, all should work flawlessly. -
If you use the new
orderByNulls
preview feature, you can expect changes inXYZWithAggregationInput
and a newSortOrderInput
type.
0.21.0
Changelog
-
The supported Prisma version has been upgraded to the latest major release - v4.0.0 💪
New Prisma release contains a lot of changes in DMMF, so expect a few breaking changes in your projects usingtypegraphql-prisma
. -
The name of the Prisma actions have been unified. Now all the singular actions (
createXYZ
,updateXYZ
,upsertXYZ
anddeleteXYZ
) have theOne
suffix (deleteOneUser
,createOnePost
), just like thefindMany
orupdateMany
. This mean that the exposed GraphQL queries and mutation will have the name changed too, not only the resolver or action classes names. -
CRUD resolvers now do have all the methods ordered by method name in ascending order. This will prevent some ghost changes when DMMF order changes.
-
The
FooUpdateManyWithoutBarInput
inputs has been renamed toFooUpdateManyWithoutBarNestedInput
.