Skip to content
This repository was archived by the owner on Aug 24, 2025. It is now read-only.

Make garph work with SvelteKit#1

Open
mishushakov wants to merge 1 commit intoryoppippi:mainfrom
mishushakov:main
Open

Make garph work with SvelteKit#1
mishushakov wants to merge 1 commit intoryoppippi:mainfrom
mishushakov:main

Conversation

@mishushakov
Copy link
Copy Markdown

No description provided.

@ryoppippi
Copy link
Copy Markdown
Owner

ryoppippi commented Jun 17, 2023

Thank you very much. I saw your PR.
It is indeed working the way you implemented it.
But the schema.ts contains the server-side implementation of the actual schema. This is not a good thing.
Sveltekit does not consider it good if the actual server-side implementation leaks to the client side, so I changed the schema.ts to schema.server.ts.
Then, the compile process is not possible due to the specification that "server variables cannot be passed to the client side.
In other words, the conclusion is that this example "works", but is not good from a security standpoint.

Error: Cannot import src/routes/api/graphql/schema.server.ts into client-side code:
- src/routes/+page.ts imports
,  - $lib/graph.client.ts imports
  - src/routes/api/graphql/schema.server.ts

Perhaps if there were some way to pass only the schema variables to the client side, this problem would be solved.

Otherwise, if it is possible to generate a GQty schema from type information only, this problem is solved (type information can be sent to each other regardless of server/client relationship).

@ryoppippi
Copy link
Copy Markdown
Owner

Now I could see some solution.
In order to achive my solution, I created a PR stepci/garph-gqty#10

@mishushakov
Copy link
Copy Markdown
Author

Agree. GQty is considering a schema-less approach. We will also have a rollup plugin that works with SvelteKit, which can statically embed the artifacts

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants