sikanhe / gqtx

Code-first Typescript GraphQL Server without codegen or metaprogramming
458 stars 13 forks source link

Add Relay helpers #22

Closed sikanhe closed 3 years ago

sikanhe commented 4 years ago

Would love to have type safe relay helpers.

@n1ru4l It seems like you use relay in your project - any input on this?

zth commented 4 years ago

I'm keeping an eye on this and will gladly provide more input if needed (me and @sikanhe spoke on Discord about this). 👀

n1ru4l commented 4 years ago

I created some relay types for my project. It might be possible to make them more abstract to fit more use-cases as a lot of might be dependent on the underlying data layer.

See:

Module for encoding and decoding IDs: https://github.com/dungeon-revealer/dungeon-revealer/blob/master/server/graphql/modules/relay-spec/index.ts Node Interface related types: https://github.com/dungeon-revealer/dungeon-revealer/blob/master/server/graphql/modules/relay-spec/graphql-page-info-type.ts Query.node field: https://github.com/dungeon-revealer/dungeon-revealer/blob/cc753f397fd7da66829bdc6d28c22e8eb54f1700/server/graphql/index.ts#L27-L51

I am also heavily using io-ts.

sikanhe commented 4 years ago

@n1ru4l will take a look !