Skip to content
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

Merged
merged 3 commits into from
Sep 19, 2023
Merged

feat: add t.prismaEffect #19

merged 3 commits into from
Sep 19, 2023

Conversation

iamchanii
Copy link
Owner

@iamchanii iamchanii commented Sep 16, 2023

Resolve #17

Copy link

@hayes hayes left a 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...

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';
Copy link

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

Copy link
Owner Author

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.

Copy link
Owner Author

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. 😅

// @ts-expect-error
resolve: (_query, parent, args, context, info) => {
const query = queryFromInfo({
context,
Copy link

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?

Copy link
Owner Author

@iamchanii iamchanii Sep 17, 2023

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)

Base automatically changed from refactor to main September 17, 2023 07:09
@iamchanii iamchanii merged commit fc2f4bc into main Sep 19, 2023
@iamchanii iamchanii deleted the add-prismaEffect branch September 19, 2023 04:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Integration with the prisma plugin
2 participants