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 GraphQL Dependencies (major) #101

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Jan 29, 2022

Mend Renovate

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
@graphql-codegen/cli 2.16.5 -> 3.3.0 age adoption passing confidence
@graphql-codegen/typescript 2.8.8 -> 3.0.3 age adoption passing confidence
@graphql-codegen/typescript-resolvers 2.7.13 -> 3.2.0 age adoption passing confidence
@types/graphql-upload (source) ^8.0.12 -> ^16.0.0 age adoption passing confidence
graphql-rate-limit-directive ^1.3.0 -> ^2.0.0 age adoption passing confidence
graphql-upload ^13.0.0 -> ^16.0.0 age adoption passing confidence

Release Notes

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

v3.3.0

Compare Source

Minor Changes
  • #​9151 b7dacb21f Thanks @​'./user/schema.mappers#UserMapper',! - Add watchPattern config option for generates sections.

    By default, watch mode automatically watches all GraphQL schema and document files. This means when a change is detected, Codegen CLI is run.

    A user may want to run Codegen CLI when non-schema and non-document files are changed. Each generates section now has a watchPattern option to allow more file patterns to be added to the list of patterns to watch.

    In the example below, mappers are exported from schema.mappers.ts files. We want to re-run Codegen if the content of *.mappers.ts files change because they change the generated types file. To solve this, we can add mapper file patterns to watch using the glob pattern used for schema and document files.

    // codegen.ts
    const config: CodegenConfig = {
      schema: 'src/schema/**/*.graphql',
      generates: {
        'src/schema/types.ts': {
          plugins: ['typescript', 'typescript-resolvers'],
          config: {
            mappers: {
    
              Book: './book/schema.mappers#BookMapper',
            },
          }
          watchPattern: 'src/schema/**/*.mappers.ts', // Watches mapper files in `watch` mode. Use an array for multiple patterns e.g. `['src/*.pattern1.ts','src/*.pattern2.ts']`
        },
      },
    };

    Then, run Codegen CLI in watch mode:

    yarn graphql-codegen --watch

    Now, updating *.mappers.ts files re-runs Codegen! 🎉

    Note: watchPattern is only used in watch mode i.e. running CLI with --watch flag.

Patch Changes

v3.2.2

Compare Source

Patch Changes

v3.2.1

Compare Source

Patch Changes

v3.2.0

Compare Source

Minor Changes
Patch Changes

v3.1.0

Compare Source

Minor Changes
  • #​8893 a118c307a Thanks @​n1ru4l! - It is no longer mandatory to declare an empty plugins array when using a preset

  • #​8723 a3309e63e Thanks @​kazekyo! - Introduce a new feature called DocumentTransform.

    DocumentTransform is a functionality that allows you to modify documents before they are processed by plugins. You can use functions passed to the documentTransforms option to make changes to GraphQL documents.

    To use this feature, you can write documentTransforms as follows:

    import type { CodegenConfig } from '@​graphql-codegen/cli';
    
    const config: CodegenConfig = {
      schema: 'https://localhost:4000/graphql',
      documents: ['src/**/*.tsx'],
      generates: {
        './src/gql/': {
          preset: 'client',
          documentTransforms: [
            {
              transform: ({ documents }) => {
                // Make some changes to the documents
                return documents;
              },
            },
          ],
        },
      },
    };
    export default config;

    For instance, to remove a @localOnlyDirective directive from documents, you can write the following code:

    import type { CodegenConfig } from '@​graphql-codegen/cli';
    import { visit } from 'graphql';
    
    const config: CodegenConfig = {
      schema: 'https://localhost:4000/graphql',
      documents: ['src/**/*.tsx'],
      generates: {
        './src/gql/': {
          preset: 'client',
          documentTransforms: [
            {
              transform: ({ documents }) => {
                return documents.map(documentFile => {
                  documentFile.document = visit(documentFile.document, {
                    Directive: {
                      leave(node) {
                        if (node.name.value === 'localOnlyDirective') return null;
                      },
                    },
                  });
                  return documentFile;
                });
              },
            },
          ],
        },
      },
    };
    export default config;

    DocumentTransform can also be specified by file name. You can create a custom file for a specific transformation and pass it to documentTransforms.

    Let's create the document transform as a file:

    module.exports = {
      transform: ({ documents }) => {
        // Make some changes to the documents
        return documents;
      },
    };

    Then, you can specify the file name as follows:

    import type { CodegenConfig } from '@​graphql-codegen/cli';
    
    const config: CodegenConfig = {
      schema: 'https://localhost:4000/graphql',
      documents: ['src/**/*.tsx'],
      generates: {
        './src/gql/': {
          preset: 'client',
          documentTransforms: ['./my-document-transform.js'],
        },
      },
    };
    export default config;
Patch Changes

v3.0.0

Compare Source

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

v3.0.3

Compare Source

Patch Changes

v3.0.2

Compare Source

Patch Changes

v3.0.1

Compare Source

Patch Changes

v3.0.0

Compare Source

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

v3.2.0

Compare Source

Minor Changes
  • #​9146 9f4d9c5a4 Thanks @​eddeee888! - [typescript-resolvers] Add resolversNonOptionalTypename config option.

    This is extending on ResolversUnionTypes implemented in https://github.com/dotansimha/graphql-code-generator/pull/9069

    resolversNonOptionalTypename adds non-optional __typename to union members of ResolversUnionTypes, without affecting the union members' base intefaces.

    A common use case for non-optional __typename of union members is using it as the common field to work out the final schema type. This makes implementing the union's __resolveType very simple as we can use __typename to decide which union member the resolved object is. Without this, we have to check the existence of field/s on the incoming object which could be verbose.

    For example, consider this schema:

    type Query {
      book(id: ID!): BookPayload!
    }
    
    type Book {
      id: ID!
      isbn: String!
    }
    
    type BookResult {
      node: Book
    }
    
    type PayloadError {
      message: String!
    }
    
    union BookPayload = BookResult | PayloadError

    With optional __typename: We need to check existence of certain fields to resolve type in the union resolver:

    // Query/book.ts
    export const book = async () => {
      try {
        const book = await fetchBook();
        // 1. No `__typename` in resolver results...
        return {
          node: book,
        };
      } catch (e) {
        return {
          message: 'Failed to fetch book',
        };
      }
    };
    
    // BookPayload.ts
    export const BookPayload = {
      __resolveType: parent => {
        // 2. ... means more checks in `__resolveType`
        if ('message' in parent) {
          return 'PayloadError';
        }
        return 'BookResult';
      },
    };

    With non-optional __typename: Resolvers declare the type. This which gives us better TypeScript support in resolvers and simplify __resolveType implementation:

    // Query/book.ts
    export const book = async () => {
      try {
        const book = await fetchBook();
        // 1. `__typename` is declared in resolver results...
        return {
          __typename: 'BookResult', // 1a. this also types `node` for us 🎉
          node: book,
        };
      } catch (e) {
        return {
          __typename: 'PayloadError',
          message: 'Failed to fetch book',
        };
      }
    };
    
    // BookPayload.ts
    export const BookPayload = {
      __resolveType: parent => parent.__typename, // 2. ... means a very simple check in `__resolveType`
    };

    Using resolversNonOptionalTypename: add it into typescript-resolvers plugin config:

    // codegen.ts
    const config: CodegenConfig = {
      schema: 'src/schema/**/*.graphql',
      generates: {
        'src/schema/types.ts': {
          plugins: ['typescript', 'typescript-resolvers'],
          config: {
            resolversNonOptionalTypename: true, // Or `resolversNonOptionalTypename: { unionMember: true }`
          },
        },
      },
    };
Patch Changes
  • #​9206 e56790104 Thanks @​eddeee888! - Fix ResolversUnionTypes being used in ResolversParentTypes

    Previously, objects with mappable fields are converted to Omit format that references its own type group or ResolversTypes or ResolversParentTypes e.g.

    export type ResolversTypes = {
      Book: ResolverTypeWrapper<BookMapper>;
      BookPayload: ResolversTypes['BookResult'] | ResolversTypes['StandardError'];
      // Note: `result` on the next line references `ResolversTypes["Book"]`
      BookResult: ResolverTypeWrapper<Omit<BookResult, 'result'> & { result?: Maybe<ResolversTypes['Book']> }>;
      StandardError: ResolverTypeWrapper<StandardError>;
    };
    
    export type ResolversParentTypes = {
      Book: BookMapper;
      BookPayload: ResolversParentTypes['BookResult'] | ResolversParentTypes['StandardError'];
      // Note: `result` on the next line references `ResolversParentTypes["Book"]`
      BookResult: Omit<BookResult, 'result'> & { result?: Maybe<ResolversParentTypes['Book']> };
      StandardError: StandardError;
    };

    In https://github.com/dotansimha/graphql-code-generator/pull/9069, we extracted resolver union types to its own group:

    export type ResolversUnionTypes = {
      // Note: `result` on the next line references `ResolversTypes["Book"]` which is only correct for the `ResolversTypes` case
      BookPayload: (Omit<BookResult, 'result'> & { result?: Maybe<ResolversTypes['Book']> }) | StandardError;
    };
    
    export type ResolversTypes = {
      Book: ResolverTypeWrapper<BookMapper>;
      BookPayload: ResolverTypeWrapper<ResolversUnionTypes['BookPayload']>;
      BookResult: ResolverTypeWrapper<Omit<BookResult, 'result'> & { result?: Maybe<ResolversTypes['Book']> }>;
      StandardError: ResolverTypeWrapper<StandardError>;
    };
    
    export type ResolversParentTypes = {
      Book: BookMapper;
      BookPayload: ResolversUnionTypes['BookPayload'];
      BookResult: Omit<BookResult, 'result'> & { result?: Maybe<ResolversParentTypes['Book']> };
      StandardError: StandardError;
    };

    This change creates an extra ResolversUnionParentTypes that is referenced by ResolversParentTypes to ensure backwards compatibility:

    export type ResolversUnionTypes = {
      BookPayload: (Omit<BookResult, 'result'> & { result?: Maybe<ResolversParentTypes['Book']> }) | StandardError;
    };
    
    // ... and the reference is changed in ResolversParentTypes:
    export type ResolversParentTypes = {
      // ... other fields
      BookPayload: ResolversUnionParentTypes['BookPayload'];
    };
  • f104619ac Thanks @​saihaj! - Resolve issue with nesting fields in @provides directive being prevented

  • Updated dependencies [e56790104, b7dacb21f, f104619ac, 92d86b009, acb647e4e, 9f4d9c5a4]:

v3.1.1

Compare Source

Patch Changes

v3.1.0

Compare Source

Minor Changes
Patch Changes

v3.0.0

Compare Source

Major Changes
Patch Changes
ravangen/graphql-rate-limit

v2.0.3

Compare Source

  • Update dependencies

v2.0.2

Compare Source

  • Add support of field extensions to enable granular directive customization per field.

v2.0.1

Compare Source

  • Update dependencies, switched to using peerDependencies over dependencies.
  • Add setState option to RateLimitOptions. When provided, puts the rate limit information for the current operation into context. Includes an example of how to return this information in a response's extensions.

v2.0.0

Compare Source

  • Update dependencies, minimum graphql-tools version is now 8
  • IOptions renamed to RateLimitOptions, adds name, defaultLimit, defaultDuration optional arguments.
Version 2 Migration

Due to interface changes with graphql-tools, the approach to setting up the directive has changed:

const { makeExecutableSchema } = require('@&#8203;graphql-tools/schema');
const {
- createRateLimitDirective,
- createRateLimitTypeDef,
+ rateLimitDirective
} = require('graphql-rate-limit-directive');

+ const { rateLimitDirectiveTypeDefs, rateLimitDirectiveTransformer } = rateLimitDirective();

let schema = makeExecutableSchema({
  typeDefs: [
-   createRateLimitTypeDef(),
+   rateLimitDirectiveTypeDefs,
    /* other defs */
  ],
  resolvers,
- schemaDirectives: {
-   rateLimit: createRateLimitDirective(),
- },
});
+ schema = rateLimitDirectiveTransformer(schema);
jaydenseric/graphql-upload

v16.0.2

Compare Source

Patch
  • Updated dev dependencies.
  • Use the node: URL scheme for Node.js builtin module imports.
  • Improved JSDoc in the module GraphQLUpload.mjs.
  • Revamped the readme:

v16.0.1

Compare Source

Patch
  • Support non latin1 characters in file names by setting the busboy option defParamCharset to utf8, fixing #​328.
  • Removed a redundant @ts-ignore comment.

v16.0.0

Compare Source

Major
  • Updated the fs-capacitor dependency to v8, fixing #​318.

  • The type FileUploadCreateReadStreamOptions from the processRequest.mjs module now uses types from fs-capacitor that are slightly more specific.

  • The API is now ESM in .mjs files instead of CJS in .js files, accessible via import but not require. To migrate imports:

    - import GraphQLUpload from "graphql-upload/GraphQLUpload.js";
    + import GraphQLUpload from "graphql-upload/GraphQLUpload.mjs";
    - import graphqlUploadExpress from "graphql-upload/graphqlUploadExpress.js";
    + import graphqlUploadExpress from "graphql-upload/graphqlUploadExpress.mjs";
    - import graphqlUploadKoa from "graphql-upload/graphqlUploadKoa.js";
    + import graphqlUploadKoa from "graphql-upload/graphqlUploadKoa.mjs";
    - import processRequest from "graphql-upload/processRequest.js";
    + import processRequest from "graphql-upload/processRequest.mjs";
    - import Upload from "graphql-upload/Upload.js";
    + import Upload from "graphql-upload/Upload.mjs";
Patch
  • Updated dev dependencies.
  • Updated examples in JSDoc comments.
  • Updated the changelog entry for v14.0.0 to show how to migrate imports.

v15.0.2

Compare Source

Patch
  • Updated dev dependencies.
  • Corrected the TypeScript type for the Koa context ctx parameter for the Koa middleware created by the function graphqlUploadKoa, from import("koa").Context to import("koa").ParameterizedContext.

v15.0.1

Compare Source

Patch
  • Don’t import and link types from the middlware modules graphqlUploadExpress.js and graphqlUploadKoa.js within the module processRequest.js, fixing #​314.

v15.0.0

Compare Source

Major
  • Updated the busboy dependency to v1, fixing #​311.
    • This important update addresses the vulnerability CVE-2022-24434 (GHSA-wm7h-9275-46v2).
    • Some error messages have changed.
    • Temporarily until mscdex/busboy#​297 is fixed upstream, for the function processRequest and the middleware graphqlUploadExpress and graphqlUploadKoa the option maxFileSize is actually 1 byte less than the amount specified.
Patch
  • Updated the typescript dev dependency.
  • In the function processRequest use the on method instead of once to listen for error events on the busboy parser, as in edge cases the same parser could have multiple error events and all must be handled to prevent the Node.js process exiting with an error.
  • Simplified error handling within the function processRequest.
  • Added a test for the function processRequest with a maliciously malformed multipart request.

v14.0.0

Compare Source

Major
  • Updated Node.js support to ^14.17.0 || ^16.0.0 || >= 18.0.0.

  • Updated the graphql peer dependency to ^16.3.0.

  • Updated the http-errors dependency to v2.

  • Public modules are now individually listed in the package files and exports fields.

  • Removed the package main index module; deep imports must be used. To migrate imports:

    - import { GraphQLUpload } from "graphql-upload";
    + import GraphQLUpload from "graphql-upload/GraphQLUpload.js";
    - import { graphqlUploadExpress } from "graphql-upload";
    + import graphqlUploadExpress from "graphql-upload/graphqlUploadExpress.js";
    - import { graphqlUploadKoa } from "graphql-upload";
    + import graphqlUploadKoa from "graphql-upload/graphqlUploadKoa.js";
    - import { processRequest } from "graphql-upload";
    + import processRequest from "graphql-upload/processRequest.js";
    - import { Upload } from "graphql-upload";
    + import Upload from "graphql-upload/Upload.js";
  • Shortened public module deep import paths, removing the /public/. To migrate imports:

    - import GraphQLUpload from "graphql-upload/public/GraphQLUpload.js";
    + import GraphQLUpload from "graphql-upload/GraphQLUpload.js";
    - import graphqlUploadExpress from "graphql-upload/public/graphqlUploadExpress.js";
    + import graphqlUploadExpress from "graphql-upload/graphqlUploadExpress.js";
    - import graphqlUploadKoa from "graphql-upload/public/graphqlUploadKoa.js";
    + import graphqlUploadKoa from "graphql-upload/graphqlUploadKoa.js";
    - import processRequest from "graphql-upload/public/processRequest.js";
    + import processRequest from "graphql-upload/processRequest.js";
    - import Upload from "graphql-upload/public/Upload.js";
    + import Upload from "graphql-upload/Upload.js";
  • Implemented TypeScript types via JSDoc comments, closing #​282.

  • The GraphQLUpload scalar no longer uses deprecated GraphQLError constructor parameters.

Patch
  • Updated dev dependencies.
  • Simplified dev dependencies and config for ESLint.
  • Check TypeScript types via a new package types script.
  • Removed the jsdoc-md dev dependency and the related package scripts, replacing the readme “API” section with a manually written “Exports” section.
  • Removed the hard-rejection dev dependency. Instead, tests are run with the Node.js CLI flag --unhandled-rejections=throw to make Node.js v14 behave like newer versions.
  • Removed the formdata-node dev dependency. Instead, File and FormData are imported from node-fetch.
  • Updated GitHub Actions CI config:
    • Run tests with Node.js v14, v16, v18.
    • Updated actions/checkout to v3.
    • Updated actions/setup-node to v3.
  • Reorganized the test file structure.
  • Use the .js file extension in require paths.
  • Use the Node.js Readable property readableEncoding instead of _readableState.encoding in tests.
  • Use substring instead of the deprecated string method substr in tests.
  • Fixed a typo in a code comment.
  • Updated documentation.
  • Added a license.md MIT License file, closing #​86.

Configuration

📅 Schedule: Branch creation - "every weekend" (UTC), 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 has been generated by Mend Renovate. View repository job log here.

@Ninjaman494
Copy link
Owner

Can't merge until graphql-rate-limit's graphql dependency is updated to v16

@renovate renovate bot force-pushed the renovate/major-graphql-dependencies branch from 871e465 to b2cf4fe Compare February 14, 2022 13:32
@Ninjaman494
Copy link
Owner

Ninjaman494 commented Feb 14, 2022

Can't merge until graphql-rate-limit's graphql dependency is updated to v16

They updated to 16.0.0 2 days ago (commit), but it hasn't been published yet.

@renovate renovate bot force-pushed the renovate/major-graphql-dependencies branch from b2cf4fe to fdfe547 Compare February 14, 2022 13:42
@renovate renovate bot force-pushed the renovate/major-graphql-dependencies branch 4 times, most recently from d0fc4ce to 3ddec14 Compare March 12, 2022 21:04
@renovate renovate bot force-pushed the renovate/major-graphql-dependencies branch from 3ddec14 to 1bb2a0a Compare June 18, 2022 15:19
@renovate renovate bot changed the title Update dependency graphql-rate-limit-directive to v2 Update GraphQL Dependencies (major) Jun 18, 2022
@renovate renovate bot force-pushed the renovate/major-graphql-dependencies branch 3 times, most recently from e04ef47 to b08252e Compare August 3, 2022 01:05
@renovate renovate bot changed the title Update GraphQL Dependencies (major) Update GraphQL Dependencies to v2 (major) Aug 9, 2022
@renovate renovate bot changed the title Update GraphQL Dependencies to v2 (major) Update GraphQL Dependencies (major) Aug 10, 2022
@renovate renovate bot force-pushed the renovate/major-graphql-dependencies branch 9 times, most recently from 14bcb7d to 265c537 Compare November 6, 2022 22:26
@renovate renovate bot force-pushed the renovate/major-graphql-dependencies branch 6 times, most recently from 38a25bf to 67d1f4c Compare November 19, 2022 19:55
@renovate renovate bot force-pushed the renovate/major-graphql-dependencies branch 6 times, most recently from 34c1c84 to 7d15fed Compare December 10, 2022 20:37
@renovate renovate bot force-pushed the renovate/major-graphql-dependencies branch 5 times, most recently from 2f5fdc0 to 735ddfd Compare December 29, 2022 13:07
@renovate renovate bot force-pushed the renovate/major-graphql-dependencies branch 3 times, most recently from e8f0b85 to 13b6ebc Compare January 1, 2023 20:06
@renovate renovate bot force-pushed the renovate/major-graphql-dependencies branch from 13b6ebc to 712c14a Compare February 3, 2023 12:22
@renovate renovate bot force-pushed the renovate/major-graphql-dependencies branch 3 times, most recently from 93bf4e2 to f99a23c Compare February 23, 2023 22:02
@renovate renovate bot force-pushed the renovate/major-graphql-dependencies branch from f99a23c to 34b0d38 Compare March 16, 2023 21:45
@renovate renovate bot force-pushed the renovate/major-graphql-dependencies branch 7 times, most recently from cecf5d2 to 241a355 Compare April 22, 2023 16:38
@renovate renovate bot force-pushed the renovate/major-graphql-dependencies branch from 241a355 to 394a534 Compare April 30, 2023 21:17
@renovate
Copy link
Contributor Author

renovate bot commented Apr 30, 2023

Edited/Blocked Notification

Renovate will not automatically rebase this PR, because it does not recognize the last commit author and assumes somebody else may have edited the PR.

You can manually request rebase by checking the rebase/retry box above.

⚠️ Warning: custom changes will be lost.

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.

1 participant