-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add t.prismaEffect #19
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! I wish the Prisma plugin types were a little less complex and easier to integrate with...
src/field-builder.ts
Outdated
import { ConnectionShape } from '@pothos/plugin-relay'; | ||
import { Cause, Context, Effect, Exit, Function, Layer, Option, pipe } from 'effect'; | ||
import { GraphQLResolveInfo } from 'graphql'; | ||
|
||
import type * as EffectPluginTypes from './types'; | ||
import { queryFromInfo } from '@pothos/plugin-prisma'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will require all users of this plugin to have Prisma installed. I'd probably put everything related to Prisma in a sub export so you import something like prisma-effects-plugin/prisma
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have knowledge enought and I have a question about it. is sub export not requires install prisma plugin to users?
I think as a result, resolve sub export like pothos-plugin-effect/prisma
should be try import @pothos/plugin-prisma
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw, by 3d7b25f commit, now I don't need to import queryFromInfo from prisma plugin package. 😅
src/field-builder.ts
Outdated
// @ts-expect-error | ||
resolve: (_query, parent, args, context, info) => { | ||
const query = queryFromInfo({ | ||
context, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you are using t.prismaField you already have the query object, is there something you are working around here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No I didn't. It came from my misunderstood about t.prismaField's query argument. (and not set about t.prismaObject's select options)
Resolve #17