Packages

@graphql-tools/utils

13.2.1 · 31 Oct 2026MIT56.3M / weekRepositoryHomepagenpmAtom feed

Your version

Where each line stands

Plan an upgrade
  • 13.x13.2.1No known advisoryLatest line
  • 12.x12.1.0Safe from 12.0.2To 13.2.1
  • 11.x11.2.22 open advisories, worst highTo 13.2.1
  • 10.x10.11.02 open advisories, worst highTo 13.2.1
  • 9.x and older9.2.14 open advisories, worst high · last release Feb 2023, no longer updatedTo 13.2.1

Latest releases

All 188 releases
  1. 13.x · latest line
  2. 13.2.1

    31 Oct 2026
    • Dependencies updates:

    • Cache collectFields / collectSubfields across executions when the document has no variable-conditional @skip, @include, or @defer, so variableValues are omitted from the cache key for those documents.

    • Dependencies updates:

  3. 13.2.0

    26 Oct 2026
    • loadDocuments / loadTypedefs now accept errorHandling so a single invalid file does not have to hide the rest of the load.

      A glob that mixes a valid operation with broken SDL used to throw the first Syntax Error and drop every other file:

      # valid.query.graphql
      query ValidQuery {
        a
      }
      # broken-a.query.graphql
      query {
        a
      await loadDocuments('**/*.query.graphql', {
        loaders: [new GraphQLFileLoader()],
      });
      // throws Syntax Error

      errorHandling chooses what happens next. The default is unchanged (throw the first error).

      aggregate waits until every source is attempted, then throws AggregateError with each parse/load failure:

      await loadDocuments('**/*.query.graphql', {
        loaders: [new GraphQLFileLoader()],
        errorHandling: 'aggregate',
      });

      return does not throw. Failed sources stay in the result as { location, error } without a document, next to the sources that parsed:

      const sources = await loadDocuments('**/*.query.graphql', {
        loaders: [new GraphQLFileLoader(), new CodeFileLoader()],
        errorHandling: 'return',
      });
      
      sources[0].document; // ValidQuery
      sources[1].document; // undefined
      sources[1].error; // GraphQLError: Syntax Error

      Source now has an optional error field. @graphql-tools/graphql-file-loader and @graphql-tools/code-file-loader honor the same option. CodeFileLoader's existing noSilentErrors default is unchanged unless errorHandling is set.

      Custom loader failures and incomplete inline documents (query Foo {) follow the same option. errorHandling: 'throw' raises the first failure, not AggregateError.

    • rewireTypes (used by mapSchema and addTypes) now recreates only the types that actually reference a replaced type.

      mapSchema already changes just the mapped types. rewireTypes then walked every type and built a new GraphQLObjectType / enum / scalar so field pointers stayed consistent. That is correct, and it is overkill when a pipeline maps one type on a large schema: unrelated types, unused enums, and unused scalars were cloned on every pass.

      The crawl now finds types whose field, argument, interface, or union members point at a different object than the type map (including wrapper types created during mapping), then rebuilds only that set. Specified directives stay as-is. Types that do not reach a replacement keep the same JavaScript object.

      createStub returns the graphql-js specified scalars for String / ID / Int / Float / Boolean instead of building an object or input with that name. Stitch typeFromAST uses createStub for every field type.

      const schema = buildSchema(/* GraphQL */ `
        scalar Unused
        enum Color { RED }
        type Query { foo: Foo }
        type Foo { id: ID }
      `)
      
      const mapped = mapSchema(schema, {
        [MapperKind.OBJECT_TYPE]: type =>
          type.name === 'Foo'
            ? new GraphQLObjectType({ ...type.toConfig(), description: 'mapped' })
            : undefined,
      })
      
      mapped.getType('Unused') === schema.getType('Unused')
      mapped.getType('Color') === schema.getType('Color')
    • transformInputValue now keeps falsy list items when GraphQL coerces a singleton into a list.

      A [String] / [Int] / [Boolean] field can receive "", 0, or false instead of a one-element array. The previous asArray helper treated those as empty and produced ``, so rename and other input transforms dropped a valid value. null is still returned as-is. A real list is still walked item by item.

  4. 13.1.3

    22 Oct 2026
    • mapSchema now remaps directive argument defaults the same way it already remaps field argument defaults.

      Use case: UserRole is remapped to internal ids, and @auth defaults to USER.

      const schema = mapSchema(originalSchema, {
        [MapperKind.ENUM_VALUE]: (valueConfig, typeName, _schema, externalValue) => {
          if (typeName === 'UserRole' && externalValue === 'USER') {
            return { ...valueConfig, value: '3user' };
          }
          return valueConfig;
        },
      });
      
      // directive @auth(role: UserRole = USER)
      schema.getDirective('auth').args.find(arg => arg.name === 'role').defaultValue;
      // before: "USER"
      // after:  "3user"

      mapSchema serializes the stored default with the source type before parsing with the remapped type, so an internal value that matches another enum name (USER -> "ADMIN") stays "ADMIN" instead of being parsed as that name.

      forEachDefaultValue walks directive arguments too, so makeExecutableSchema enum resolvers get the same result.

    • Published Executor types include /// <reference lib="esnext.disposable" preserve="true" /> so consumers do not need skipLibCheck or a full esnext lib just to import this package.

      Use case: an app with "lib": ["es2022"] or ["es2024"] and skipLibCheck: false that imports @graphql-tools/utils:

      import type { Executor } from '@graphql-tools/utils';
      
      export const executor: Executor = async request => {
        // ...
      };

      Executor can return a Disposable / AsyncIterable result. Those names live in TypeScript's esnext.disposable lib, which is not part of es2022/es2024. Without the preserved reference, tsc reports Cannot find name 'Disposable'. With it, the published .d.ts pulls in that lib for the consumer automatically.

Dependency tracking · free for 3 projects

Know when your own dependencies move

@graphql-tools/utils had 2 security advisories in the last 12 months. inlinr emails you the day one touches a project of yours, with the version that fixes it.

  • Advisories reach you

    An email when a critical or high advisory affects a project, before the next install.

  • Upgrades checked first

    Peer ranges, Node, ESM-only and types changes read before you bump.

  • Only what matters

    Majors and breaking notes stay; patches and sibling bumps fold into one line.

How dependency tracking works

Registry facts last checked 6 Nov 2026. Releases and advisories last read 6 Nov 2026.