Winter ❄️ Status Update #675
jasonkuhrt
announced in
Announcements
Replies: 1 comment
-
It is now possible to use an alpha version of the TS Client. For now here is a little snippet to get you started: pnpm add graphql-request@next
gr --schema ./schema.graphql --output ./generated/ import type * as Schema from './generated/Schema.js'
import { create } from 'graphql-request/alpha/client'
const client = create<Schema.$.Index>({
url: `http://localhost:4000/graphql`, // change to yours
})
// change the following to whatever your schema is. All type safe!
const { userUpdate } = await client.mutation({
userUpdate: {
__typename: true,
onUser: {
handle: true,
handle_as_handle2: true,
},
},
})
if (userUpdate.__typename === `User`) {
userUpdate.handle
userUpdate.handle2
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey,
I just wanted to drop some of my current thinking and what's going on.
First, thank you to @jonkoops whom stepped in over the past months helping close issues, respond to users, push some fixes and more.
As a person I am spread relatively thin across family life (I have two kids :)) and full time work at Prisma! I pursue a few open source projects and have always more ideas than time. Part of what enables me to spend time on OSS is the personal utility I get from the project. It recently became that case that I need a GraphQL Client library in some of our projects at Prisma and none available are satisfying me. That helps me motivate work here, to build what I wish existed.
First I must mention getting
graphql-request
to a baseline of health is needed. To that end the following has happened recently:Once those bugs are fixed and a few more low hanging fruits are resolved I'd like to cut a next major release.
The larger vision I have is to begin work on a type-safe builder API. In some respects it will be what I wish https://genql.dev was (I have numerous open issues on that repo if you're curious what I'm lacking there). I will be working on this as a parallel API, never removing the current one fully. My vision is that there will be a TS-first API in addition to the "raw" GraphQL syntax variant. Think of how an ORM like Prisma has a TS aspect but still supports sending raw SQL too.
My goal is to have a TS-first type-safe client experience that is fully inferred. I would like it to support as many of the native GraphQL query capabilities as possible, such as defer and aliases.
Eventually the builder API will be versioned but initially releases will be exploratory, not subject to semver.
I'll be working in the open, which you can already see some progress of here: #672.
Beta Was this translation helpful? Give feedback.
All reactions