Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update graphqlcodegenerator monorepo (major) #60

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented May 24, 2023

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
@graphql-codegen/cli (source) 3.3.1 -> 5.0.2 age adoption passing confidence
@graphql-codegen/typescript (source) 3.0.4 -> 4.0.9 age adoption passing confidence
@graphql-codegen/typescript-operations (source) 3.0.4 -> 4.2.3 age adoption passing confidence
@graphql-codegen/typescript-vue-urql (source) 2.3.6 -> 3.2.0 age adoption passing confidence
@graphql-codegen/urql-introspection (source) 2.2.1 -> 3.0.0 age adoption passing confidence

Release Notes

dotansimha/graphql-code-generator (@​graphql-codegen/cli)

v5.0.2

Compare Source

Patch Changes

v5.0.1

Compare Source

Patch Changes

v5.0.0

Compare Source

Major Changes
Patch Changes

v4.0.1

Compare Source

Patch Changes

v4.0.0

Compare Source

Major Changes
Patch Changes
dotansimha/graphql-code-generator (@​graphql-codegen/typescript)

v4.0.9

Compare Source

Patch Changes

v4.0.8

Compare Source

Patch Changes

v4.0.7

Compare Source

Patch Changes

v4.0.6

Compare Source

Patch Changes

v4.0.5

Compare Source

Patch Changes

v4.0.4

Compare Source

Patch Changes

v4.0.3

Compare Source

Patch Changes

v4.0.2

Compare Source

Patch Changes

v4.0.1

Compare Source

Patch Changes
  • #​9497 2276708d0 Thanks @​eddeee888! - Revert default ID scalar input type to string

    We changed the ID Scalar input type from string to string | number in the latest major version of typescript plugin. This causes issues for server plugins (e.g. typescript-resolvers) that depends on typescript plugin. This is because the scalar type needs to be manually inverted on setup which is confusing.

  • Updated dependencies [2276708d0]:

v4.0.0

Compare Source

Major Changes
  • #​9375 ba84a3a27 Thanks @​eddeee888! - Implement Scalars with input/output types

    In GraphQL, Scalar types can be different for client and server. For example, given the native GraphQL ID:

    • A client may send string or number in the input
    • A client receives string in its selection set (i.e output)
    • A server receives string in the resolver (GraphQL parses string or number received from the client to string)
    • A server may return string or number (GraphQL serializes the value to string before 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:

    1. Scalars option can now take input/output types:
    config: {
      scalars: {
        ID: {
          input: 'string',
          output: 'string | number'
        }
      }
    }
    1. 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
      }
    }
    1. 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.

  • bb66c2a31 Thanks @​n1ru4l! - Require Node.js >= 16. Drop support for Node.js 14

Minor Changes
  • #​9196 3848a2b73 Thanks @​beerose! - Add @defer directive support

    When 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 @defer directive 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 @&#8203;defer
        }
      }
    `);

    The generated type for GetUserQuery will 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 @defer directive, the Codegen also exports a utility function called isFragmentReady. 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 e1dc75f3c Thanks @​esfomeado! - Added support for disabling suffixes on Enums.

Patch Changes
dotansimha/graphql-code-generator (@​graphql-codegen/typescript-operations)

v4.2.3

Compare Source

Patch Changes

v4.2.2

Compare Source

Patch Changes

v4.2.1

Compare Source

Patch Changes

v4.2.0

Compare Source

Minor Changes
Patch Changes

v4.1.3

Compare Source

Patch Changes

v4.1.2

Compare Source

Patch Changes

v4.1.1

Compare Source

Patch Changes

v4.1.0

Compare Source

Minor Changes
  • #​9811 d8364e045 Thanks @​saihaj! - fix: out-of-memory crash (fixes #​7720)
    perf: implement a caching mechanism that makes sure the type originating at the same location is never generated twice, as long as the combination of selected fields and possible types matches
    feat: implement extractAllFieldsToTypes: boolean
    feat: implement printFieldsOnNewLines: boolean
Patch Changes

v4.0.1

Compare Source

Patch Changes

v4.0.0

Compare Source

Major Changes
  • #​9375 ba84a3a27 Thanks @​eddeee888! - Implement Scalars with input/output types

    In GraphQL, Scalar types can be different for client and server. For example, given the native GraphQL ID:

    • A client may send string or number in the input
    • A client receives string in its selection set (i.e output)
    • A server receives string in the resolver (GraphQL parses string or number received from the client to string)
    • A server may return string or number (GraphQL serializes the value to string before 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:

    1. Scalars option can now take input/output types:
    config: {
      scalars: {
        ID: {
          input: 'string',
          output: 'string | number'
        }
      }
    }
    1. 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
      }
    }
    1. 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.

  • bb66c2a31 Thanks @​n1ru4l! - Require Node.js >= 16. Drop support for Node.js 14

Minor Changes
  • #​9196 3848a2b73 Thanks @​beerose! - Add @defer directive support

    When 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 @defer directive 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 @&#8203;defer
        }
      }
    `);

    The generated type for GetUserQuery will 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 @defer directive, the Codegen also exports a utility function called isFragmentReady. 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 e1dc75f3c Thanks @​esfomeado! - Added support for disabling suffixes on Enums.

Patch Changes
dotansimha/graphql-code-generator-community (@​graphql-codegen/typescript-vue-urql)

v3.2.0

Compare Source

Minor Changes

v3.1.0

Compare Source

Minor 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.

@renovate renovate bot force-pushed the renovate/major-graphqlcodegenerator-monorepo branch from ac85ef4 to d2f09ac Compare June 2, 2023 17:22
@renovate renovate bot force-pushed the renovate/major-graphqlcodegenerator-monorepo branch 4 times, most recently from 9f86c65 to 9555a61 Compare June 22, 2023 21:02
@renovate renovate bot force-pushed the renovate/major-graphqlcodegenerator-monorepo branch 2 times, most recently from bf695f5 to a8c92cc Compare July 3, 2023 04:00
@renovate renovate bot force-pushed the renovate/major-graphqlcodegenerator-monorepo branch 2 times, most recently from 8cf325d to d75fbdb Compare July 17, 2023 04:12
@renovate renovate bot force-pushed the renovate/major-graphqlcodegenerator-monorepo branch from d75fbdb to 37c5942 Compare July 24, 2023 04:14
@renovate renovate bot changed the title Update graphqlcodegenerator monorepo to v4 (major) Update graphqlcodegenerator monorepo (major) Jul 25, 2023
@renovate renovate bot force-pushed the renovate/major-graphqlcodegenerator-monorepo branch 2 times, most recently from a3327a8 to 7369b6f Compare July 31, 2023 03:39
@renovate renovate bot force-pushed the renovate/major-graphqlcodegenerator-monorepo branch 2 times, most recently from 0aefbdb to 0cace5d Compare August 14, 2023 04:16
@renovate renovate bot force-pushed the renovate/major-graphqlcodegenerator-monorepo branch 2 times, most recently from ee10a22 to fed8517 Compare August 21, 2023 03:48
@renovate renovate bot force-pushed the renovate/major-graphqlcodegenerator-monorepo branch 2 times, most recently from df2151b to 81394db Compare September 25, 2023 22:21
@renovate renovate bot force-pushed the renovate/major-graphqlcodegenerator-monorepo branch from 81394db to 89e2ad1 Compare February 6, 2024 15:25
@renovate renovate bot force-pushed the renovate/major-graphqlcodegenerator-monorepo branch 4 times, most recently from 89b9a46 to 464e17c Compare February 25, 2024 19:01
@renovate renovate bot force-pushed the renovate/major-graphqlcodegenerator-monorepo branch from 464e17c to 8edf2f1 Compare March 8, 2024 19:40
@renovate renovate bot force-pushed the renovate/major-graphqlcodegenerator-monorepo branch 3 times, most recently from aff19bf to 6f489a9 Compare May 21, 2024 00:54
@renovate renovate bot force-pushed the renovate/major-graphqlcodegenerator-monorepo branch from 6f489a9 to a07b640 Compare May 28, 2024 16:16
@renovate renovate bot force-pushed the renovate/major-graphqlcodegenerator-monorepo branch from a07b640 to 4684748 Compare June 12, 2024 18:23
@renovate renovate bot force-pushed the renovate/major-graphqlcodegenerator-monorepo branch 3 times, most recently from a76f66f to 223620b Compare June 28, 2024 10:00
@renovate renovate bot force-pushed the renovate/major-graphqlcodegenerator-monorepo branch 2 times, most recently from d071ae1 to ac252c2 Compare July 2, 2024 11:12
@renovate renovate bot force-pushed the renovate/major-graphqlcodegenerator-monorepo branch 2 times, most recently from ebbae3d to a8e553e Compare September 5, 2024 16:28
@renovate renovate bot force-pushed the renovate/major-graphqlcodegenerator-monorepo branch from a8e553e to 88a7373 Compare September 16, 2024 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants