graphql-public-schema-filter
graphql-public-schema-filter copied to clipboard
chore(deps): update graphql-codegen (major)
This PR contains the following updates:
| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| @graphql-codegen/testing | 2.0.2 -> 3.0.4 |
||||
| @graphql-codegen/typescript (source) | 3.0.4 -> 4.1.5 |
Release Notes
dotansimha/graphql-code-generator (@graphql-codegen/typescript)
v4.1.5
Patch Changes
- Updated dependencies [
d8566c0]:
v4.1.4
Patch Changes
- Updated dependencies [
6d7c1d7]:
v4.1.3
Patch Changes
- Updated dependencies [
60dd72f]:
v4.1.2
Patch Changes
v4.1.1
Patch Changes
v4.1.0
Minor Changes
-
#10077
3f4f546Thanks @eddeee888! - Extendconfig.avoidOptionsto support query, mutation and subscriptionPreviously,
config.avoidOptions.resolverswas being used to make query, mutation and subscription fields non-optional. Now,config.avoidOptions.query,config.avoidOptions.mutationandconfig.avoidOptions.subscriptioncan be used to target the respective types.
Patch Changes
- Updated dependencies [
3f4f546]:
v4.0.9
Patch Changes
- Updated dependencies [
79fee3c]:
v4.0.8
Patch Changes
v4.0.7
Patch Changes
v4.0.6
Patch Changes
v4.0.5
Patch Changes
- Updated dependencies [
53f270a]:
v4.0.4
Patch Changes
-
Updated dependencies [
4e69568]:
v4.0.3
Patch Changes
- Updated dependencies [
7718a8113]:
v4.0.2
Patch Changes
- #9811
d8364e045Thanks @saihaj! - dependencies updates:- Updated dependency
tslib@~2.6.0↗︎ (from~2.5.0, independencies)
- Updated dependency
- Updated dependencies [
d8364e045,d8364e045,d8364e045,d8364e045,d8364e045]:
v4.0.1
Patch Changes
-
#9497
2276708d0Thanks @eddeee888! - Revert default ID scalar input type to stringWe changed the ID Scalar input type from
stringtostring | numberin the latest major version oftypescriptplugin. This causes issues for server plugins (e.g. typescript-resolvers) that depends ontypescriptplugin. This is because the scalar type needs to be manually inverted on setup which is confusing. -
Updated dependencies [
2276708d0]:
v4.0.0
Major Changes
-
#9375
ba84a3a27Thanks @eddeee888! - Implement Scalars with input/output typesIn GraphQL, Scalar types can be different for client and server. For example, given the native GraphQL ID:
- A client may send
stringornumberin the input - A client receives
stringin its selection set (i.e output) - A server receives
stringin the resolver (GraphQL parsesstringornumberreceived from the client tostring) - A server may return
stringornumber(GraphQL serializes the value tostringbefore sending it to the client )
Currently, we represent every Scalar with only one type. This is what codegen generates as base type:
export type Scalars = { ID: string }Then, this is used in both input and output type e.g.
export type Book = { __typename?: 'Book' id: Scalars['ID'] // Output's ID can be `string` 👍 } export type QueryBookArgs = { id: Scalars['ID'] // Input's ID can be `string` or `number`. However, the type is only `string` here 👎 }This PR extends each Scalar to have input and output:
export type Scalars = { ID: { input: string | number output: string } }Then, each input/output GraphQL type can correctly refer to the correct input/output scalar type:
export type Book = { __typename?: 'Book' id: Scalars['ID']['output'] // Output's ID can be `string` 👍 } export type QueryBookArgs = { id: Scalars['ID']['input'] // Input's ID can be `string` or `number` 👍 }Note that for
typescript-resolvers, the type of ID needs to be inverted. However, the referenced types in GraphQL input/output types should still work correctly:export type Scalars = { ID: { input: string; output: string | number; } } export type Book = { __typename?: "Book"; id: Scalars["ID"]['output']; // Resolvers can return `string` or `number` in ID fields 👍 }; export type QueryBookArgs = { id: Scalars["ID"]['input']; // Resolvers receive `string` in ID fields 👍 }; export type ResolversTypes = { ID: ID: ResolverTypeWrapper<Scalars['ID']['output']>; // Resolvers can return `string` or `number` in ID fields 👍 } export type ResolversParentTypes = { ID: Scalars['ID']['output']; // Resolvers receive `string` or `number` from parents 👍 };
Config changes:
- Scalars option can now take input/output types:
config: { scalars: { ID: { input: 'string', output: 'string | number' } } }- If a string is given (instead of an object with input/output fields), it will be used as both input and output types:
config: { scalars: { ID: 'string' // This means `string` will be used for both ID's input and output types } }- BREAKING CHANGE: External module Scalar types need to be an object with input/output fields
config: { scalars: { ID: './path/to/scalar-module' } }If correctly, wired up, the following will be generated:
// Previously, imported `ID` type can be a primitive type, now it must be an object with input/output fields import { ID } from './path/to/scalar-module' export type Scalars = { ID: { input: ID['input']; output: ID['output'] } }
BREAKING CHANGE: This changes Scalar types which could be referenced in other plugins. If you are a plugin maintainer and reference Scalar, please update your plugin to use the correct input/output types.
- A client may send
-
bb66c2a31Thanks @n1ru4l! - Require Node.js>= 16. Drop support for Node.js 14
Minor Changes
-
#9196
3848a2b73Thanks @beerose! - Add@deferdirective supportWhen a query includes a deferred fragment field, the server will return a partial response with the non-deferred fields first, followed by the remaining fields once they have been resolved.
Once start using the
@deferdirective in your queries, the generated code will automatically include support for the directive.// src/index.tsx import { graphql } from './gql' const OrdersFragment = graphql(` fragment OrdersFragment on User { orders { id total } } `) const GetUserQuery = graphql(` query GetUser($id: ID!) { user(id: $id) { id name ...OrdersFragment @​defer } } `)The generated type for
GetUserQuerywill have information that the fragment is incremental, meaning it may not be available right away.// gql/graphql.ts export type GetUserQuery = { __typename?: 'Query'; id: string; name: string } & ({ __typename?: 'Query' } & { ' $fragmentRefs'?: { OrdersFragment: Incremental<OrdersFragment> } })Apart from generating code that includes support for the
@deferdirective, the Codegen also exports a utility function calledisFragmentReady. You can use it to conditionally render components based on whether the data for a deferred fragment is available:const OrdersList = (props: { data: FragmentType<typeof OrdersFragment> }) => { const data = useFragment(OrdersFragment, props.data); return ( // render orders list ) }; function App() { const { data } = useQuery(GetUserQuery); return ( {data && ( <> {isFragmentReady(GetUserQuery, OrdersFragment, data) && <OrdersList data={data} />} </> )} ); } export default App; -
#9304
e1dc75f3cThanks @esfomeado! - Added support for disabling suffixes on Enums.
Patch Changes
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
👻 Immortal: This PR will be recreated if closed unmerged. Get config help if that's undesired.
- [ ] If you want to rebase/retry this PR, check this box
This PR was generated by Mend Renovate. View the repository job log.
⚠️ No Changeset found
Latest commit: 6e1e7c50f3e0c511ee50add19cdc239b7e9bf800
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR