Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

typescript-graphql-request

dotansimha18.6kMIT4.4.6TypeScript support: included

GraphQL Code Generator plugin for generating a ready-to-use SDK based on graphql-request and GraphQL operations

readme

npm version

https://the-guild.dev/graphql/codegen

GraphQL Code Generator is a tool that generates code out of your GraphQL schema. Whether you are developing a frontend or backend, you can utilize GraphQL Code Generator to generate output from your GraphQL Schema and GraphQL Documents (query/mutation/subscription/fragment).

By analyzing the schema and documents and parsing it, GraphQL Code Generator can output code at a wide variety of formats, based on pre-defined templates or based on custom user-defined ones. Regardless of the language that you're using, GraphQL Code Generator has you covered.

GraphQL Code Generator lets you choose the output that you need, based on plugins, which are very flexible and customizable. You can also write your plugins to generate custom outputs that match your needs.

You can try this tool live on your browser and see some useful examples. Check out GraphQL Code Generator Live Examples.

We currently support and maintain these plugins (TypeScript, Flow, React, Angular, MongoDB, Stencil, Reason, and some more), and there is an active community that writes and maintains custom plugins.

Quick Start

You can find the complete instructions in GraphQL Code Generator website.

Start by installing the basic deps of GraphQL Codegen:

yarn add graphql
yarn add -D @graphql-codegen/cli

GraphQL Code Generator lets you setup everything by simply running the following command:

yarn graphql-codegen init

Question by question, it will guide you through the whole process of setting up a schema, selecting plugins, picking a destination of a generated file, and a lot more.

If you wish to manually setup codegen, follow these instructions.

Besides our docs page, feel free to go through our published Medium articles to get a better grasp of what GraphQL Code Generator is all about:

Contributing

If this is your first time contributing to this project, please do read our Contributor Workflow Guide before you get started off.

Feel free to open issues and pull requests. We're always welcome support from the community.

For a contribution guide specific to this project, please refer to: http://the-guild.dev/graphql/codegen/docs/custom-codegen/contributing.

Code of Conduct

Help us keep GraphQL Code Generator open and inclusive. Please read and follow our Code of Conduct as adopted from Contributor Covenant

License

GitHub license

MIT

changelog

@graphql-codegen/typescript-graphql-request

4.4.5

Patch Changes

  • 7fae9fbf4: fix(plugins/gql-request): remove unused GraphQLError import

4.4.4

Patch Changes

  • 44cd9a85e: Fix rawRequest return type

    The errors property from the return type has been removed, because it is never returned by graphql-request. Instead, failed requests throw a ClientError. Also, data is no longer optional, because it always exists for successful responses.

4.4.3

Patch Changes

4.4.2

Patch Changes

4.4.1

Patch Changes

4.4.0

Minor Changes

  • 17ad88541: Exposes operationType to graphql-request sdk middlewares.

4.3.7

Patch Changes

4.3.6

Patch Changes

4.3.5

Patch Changes

  • 275d40ae5: Allow graphql-request@4 in peerDependencies range

4.3.4

Patch Changes

4.3.3

Patch Changes

4.3.2

Patch Changes

  • 22f6e4a92: Don't import print as type when supporting useTypeImports & rawRequest and documentMode is not a string.

4.3.1

Patch Changes

4.3.0

Minor Changes

  • 3b87f049a: Add the extensionsType config in order to change the default type for extensions when rawRequest is true.

4.2.0

Minor Changes

  • 97ddb487a: feat: GraphQL v16 compatibility

Patch Changes

4.1.6

Patch Changes

4.1.5

Patch Changes

4.1.4

Patch Changes

4.1.3

Patch Changes

4.1.2

Patch Changes

4.1.1

Patch Changes

4.1.0

Minor Changes

  • 440172cfe: support ESM

Patch Changes

4.0.0

Major Changes

  • b0cb13df4: Update to latest graphql-tools and graphql-config version.

    ‼️ ‼️ ‼️ Please note ‼️ ‼️ ‼️:

    This is a breaking change since Node 10 is no longer supported in graphql-tools, and also no longer supported for Codegen packages.

Patch Changes

3.2.5

Patch Changes

3.2.4

Patch Changes

3.2.3

Patch Changes

3.2.2

Patch Changes

3.2.1

Patch Changes

3.2.0

Minor Changes

  • 9b59605d: feat(typescript-graphql-request): Add enhancements to request middleware function (#5883, #5807) #5884

Patch Changes

3.1.1

Patch Changes

3.1.0

Minor Changes

  • af6fb509: Removed the unnecessary call to the print function, since graphql-request would call this function internally if needed.

Patch Changes

3.0.2

Patch Changes

  • 387d136f: fix(typescript-graphql-request): declare a peer dependency on graphql-request
  • ed8cab50: fix(plugin: graphql-requests): Fix type errors in auto-generated methods
  • Updated dependencies [5749cb8a]
  • Updated dependencies [5a12fe58]

3.0.1

Patch Changes

  • 85ba9f49: Fix for error thrown on anonymous operations
  • 4b1ca624: fix(plugin: graphql-requests): Fix argument types in auto-generated methods
  • f2e3548a: Added missing import for HeadersInit
  • Updated dependencies [63be0f40]
  • Updated dependencies [190482a1]
  • Updated dependencies [4444348d]
  • Updated dependencies [142b32b3]
  • Updated dependencies [42213fa0]

3.0.0

Major Changes

  • d41904e8: Support passing custom headers per each request method.

    NOTE: This version of this plugin requires you to update to graphql-request > 3.4.0

Patch Changes

2.0.3

Patch Changes

2.0.2

Patch Changes

2.0.1

Patch Changes

2.0.0

Major Changes

  • af3803b8: Upgrade generated code to match graphql-request v3.

    • @graphql-codegen/typescript-graphql-request @ v1 => matches graphql-request (v1 and v2)
    • @graphql-codegen/typescript-graphql-request @ v2 => matches graphql-request (v3)

    Breaking Changes

    v3 of graphql-request has changed the path of some files. That means that generated code needs to adjusted.

    The actual change is described here: https://github.com/prisma-labs/graphql-request/issues/186

Patch Changes