-
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
sveltekit support #229
sveltekit support #229
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/theguild/graphql-ez/8GCgzXxpdUKdcYfu42C72kBCrxke |
@benbender Here is the first working version https://github.com/PabloSzx/graphql-ez/blob/sveltekit/examples/sveltekit/src/routes/graphql.ts if you want please take a look and test it and give opinions or suggestions https://github.com/PabloSzx/graphql-ez/blob/sveltekit/packages/sveltekit/main/src/index.ts What I did to reduce the friction with the current node.js integrations is to create a fake IncomingMessage that only has access to "headers" and "method", which is what most of the integrations or envelop plugins use anyways |
Hey! Thanks for the effort! I would love to play with it and so I'll just added an additional route with the newly created Problem atm seems to be that the |
the compatibility list doesn't make sense to turn off for the specific plugins that requires it because the "onIntegrationRegister" lifecycle has to be hardcoded for the integration that it supports 😞 |
for the IDE plugins like graphiql and altair or voyager, the plugins will need to export an extra handler that adds support for sveltekit, it's not hard just reusing the existing handlers but adapted for the sveltekit format, but the altair requires a dynamic route for the plugins:
they are virtually impossible to add support for sveltekit 😞 |
What I had in mind was a simple option, probably undocumented, which just circumvents the checks entirely. Not meant to be used regularly, but just for development of new plugins/integrations. So for example one could have something like: ezApp = createEZAppFactory(
{
integrationName: "sveltekit",
disableCompatibilityChecks: true
},
appConfig
); And a check for it here: graphql-ez/packages/core/main/src/app.ts Line 60 in 9878698
|
the compatibility list is only there for the lifecycle "onIntegrationRegister", the plugins that don't use that lifecycle, don't specify it, there isn't any purpose behind disabling them, and if you are creating new plugins, you can simply don't specify the compatibilityList field / not use onIntegrationRegister / add the integration you are working on to the list the onIntegrationRegister uses integration specific context, that won't be available for the logic it uses, that is why the check is there |
Thanks for the invite! I'll have a look onto altair/graphiql later today or tomorrow as I have some things to check on my todo-list beforehand... There are also some slight issues with the typings of the new sveltekit-integration as, f.e., I'm using a global type for For everything related to upload/multipart/streams in sveltekit, there might be some hope for the future as the Whatwg Streams-API gets more support (deno, node16, ...) and there are some quite active discussions about it at sveltejs/kit#1563, sveltejs/kit#2212 etc and there might also be a chance for some sort of support for connect-handlers before 1.0. |
I've added the most primitive support for graphiql here. Before going further, I wanted to ask, if there is any specific reason why you've split the routes for the nextjs-handler between graphql and graphiql? The straight-forward way to implement compatibility for That approach seems repetitive to me and I would have opted for another approach to handle the split between the |
I don't think there is a specific reason for it, it was just more of an opinionated decision, I felt like going to graphiql should be a different path and 100% conscious decision, just like going to altair is, but I understand 100% that having it in the same path with logic like "if (shouldRenderGraphiQL(" is something a lot of people expect, I will work on it 👍 it might mean some changes for some integrations |
#236 🎉 I want to update the graphiql instance to have the changes of contra/graphql-helix#44 & contra/graphql-helix#37 before merging tho 👌 |
Now by default, the graphiql plugin points to the same path as the API, just like vanilla graphql-helix and apollo server does it👌 https://github.com/PabloSzx/graphql-ez/releases/tag/@graphql-ez/[email protected] |
@benbender what do you think is the solution for that, you are using those custom types in the "buildContext"? I came up with this solution, a custom type that allows you to specify a custom locals |
🦋 Changeset detectedLatest commit: 3670f22 The changes in this PR will be included in the next version bump. This PR includes changesets to release 31 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
closes #146
@benbender if you want to collaborate on this you are more than welcome 👍