1.0.0-rc.2
🌟 Help us spread the word about Prisma-AppSync by starring the repo.
Major improvements
Support for Prisma Fluent API syntax on Relation Filters
🚨 Breaking change affecting syntax for Relation Filters.
In this release, we are changing how to write relation filters. We are replacing the original Prisma Client syntax (using is
and isNot
filters) with the newest Fluent API syntax which feels more natural to write, but also allows using more complex Relation Filters such as contains
, endsWith
, equals
, gt
, gte
, lt
, lte
, in
, not
, notIn
and startsWith
.
Before
query {
listPosts(
where: {
author: { is: { username: "xxx" } }
}
) {
title
author { username }
}
}
After
query {
listPosts(
where: {
author: { username: { equals: "xxx" } }
}
) {
title
author { username }
}
}
Improved readability for underlying Prisma client errors
In this release, we have improved readability for all known errors thrown by the underlying Prisma Client. For example, using an incorrect connection URL (DATABASE_URL
) will now return the below message as part of the API response:
Error with Prisma client initialization. https://www.prisma.io/docs/reference/api-reference/error-reference#prismaclientinitializationerror
The full error trace will still appear inside the terminal and/or CloudWatch logs.
New documentation guide: "Adding Hooks"
In this release, we have added a new guide on "Adding Hooks". Particularly useful to trigger actions and/or manipulate data before
or after
queries.
https://prisma-appsync.vercel.app/advanced/hooks.html
Example snippet:
return await prismaAppSync.resolve<'likePost'>({
event,
hooks: {
// execute before any query
'before:**': async (params: BeforeHookParams) => params,
// execute after any query
'after:**': async (params: AfterHookParams) => params,
// execute after custom resolver query `likePost`
// (e.g. `query { likePost(postId: 3) }`)
'after:likePost': async (params: AfterHookParams) => {
await params.prismaClient.notification.create({
data: {
event: 'POST_LIKED',
targetId: params.args.postId,
userId: params.authIdentity.sub,
},
})
return params
},
},
})
Fixes
- Issue using the
@aws_auth
directive along with additional authorization modes. - Issue with
before
andafter
hook responses.
Credits
Sylvain 🧙♂️ 💻 🤔 📖 | Ciprian Caba 💻 🤔 |
Github sponsors
Enjoy using Prisma-AppSync? Please consider 💛 Github sponsors.