6.3.3 • Published 1 month ago

@genql/cli v6.3.3

Weekly downloads
415
License
MIT
Repository
github
Last release
1 month ago

!IMPORTANT Genql is building a cloud platform to automate SDK generation in multiple languages, docs website with examples, changelog website and more. Fill this form if you are interested!

Read the quick start guide to generate your client and start writing queries.

You can stay up to date with the latest changes subscribing to the Genql changelog.

Features

Example

First generate your client with the genql cli.

You can find other cli options here

npm i -D @genql/cli # cli to generate the client code
genql --schema ./schema.graphql --output ./generated

Then you can use your client as follow

import { createClient, everything } from './generated'
const client = createClient()

client
    .query({
        countries: {
            // pass arguments to the query
            __args: {
                filter: {
                    currency: {
                        eq: 'EUR',
                    },
                },
            },
            name: true,
            code: true,
            nestedField: {
                // fetch all scalar fields
                __scalar: true,
            },
        },
    })
    .then(console.log)

The code above will fetch the graphql query below

query {
    countries(filter: { currency: { eq: "EUR" } }) {
        name
        code
        nestedField {
            scalarField1
            scalarField2
        }
    }
}

Why

Genql has a lot of benefits over writing graphql queries by hand:

  • Writing queries is faster thanks to TypeScript auto completion
  • You can safely update your schema and be sure your queries are still valid
  • You can fetch all scalar fields in a type with __scalar: true
  • No graphql package dependency, no runtime parsing of queries
  • You have to generate the client only after your schema changes, not after every query change

Sponsors

Notaku

Notaku

Vercel


Licensed under MIT.

6.3.3

1 month ago

6.3.2

3 months ago

6.3.1

4 months ago

6.3.0

4 months ago

6.1.0

10 months ago

6.2.1

9 months ago

6.2.0

9 months ago

5.0.1

1 year ago

5.0.0

1 year ago

6.0.0

11 months ago

4.0.4

1 year ago

4.0.1

1 year ago

4.0.0

1 year ago

4.0.3

1 year ago

4.0.2

1 year ago

3.0.5

1 year ago

3.0.4

1 year ago

3.0.3

1 year ago

3.0.2

1 year ago

3.0.1

1 year ago

3.0.0

1 year ago

2.10.0

2 years ago

2.9.0

2 years ago

2.7.0

3 years ago

2.8.0

3 years ago

2.6.0

3 years ago

2.5.0

3 years ago

2.4.0

3 years ago

2.3.3

4 years ago

2.3.0

4 years ago

2.2.1

4 years ago

2.2.0

4 years ago

2.3.2

4 years ago

2.2.3

4 years ago

2.3.1

4 years ago

2.2.2

4 years ago

2.2.5

4 years ago

2.2.4

4 years ago

2.1.0

4 years ago

2.0.5

4 years ago

2.0.4

4 years ago

2.0.3

4 years ago

1.0.0

4 years ago