@graphql-tools/utils
13.2.2 · 10 Nov 2026MIT57M / weekRepositoryHomepagenpmAtom feed
13.2.2 is the newest release of 13.x.
Summary· from the note as AI read it
No actionNothing to change: 2 new, 1 fixed.
New
loadDocuments/loadTypedefsnow accepterrorHandlingso a single invalid file does not have to hide the rest of the load.rewireTypes(used bymapSchemaandaddTypes) now recreates only the types that actually reference a replaced type.
In short
1 new1 faster1 fixed
Release note
The section about @graphql-tools/utils of a note shared by several packages.
Minor Changes
loadDocuments/loadTypedefsnow accepterrorHandlingso 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 Errorand drop every other file:# valid.query.graphql query ValidQuery { a }# broken-a.query.graphql query { aawait loadDocuments('**/*.query.graphql', { loaders: [new GraphQLFileLoader()], }); // throws Syntax ErrorerrorHandlingchooses what happens next. The default is unchanged (throwthe first error).aggregatewaits until every source is attempted, then throwsAggregateErrorwith each parse/load failure:await loadDocuments('**/*.query.graphql', { loaders: [new GraphQLFileLoader()], errorHandling: 'aggregate', });returndoes not throw. Failed sources stay in the result as{ location, error }without adocument, 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 ErrorSourcenow has an optionalerrorfield.@graphql-tools/graphql-file-loaderand@graphql-tools/code-file-loaderhonor the same option.CodeFileLoader's existingnoSilentErrorsdefault is unchanged unlesserrorHandlingis set.Custom loader failures and incomplete inline documents (
query Foo {) follow the same option.errorHandling: 'throw'raises the first failure, notAggregateError.
Patch Changes
rewireTypes(used bymapSchemaandaddTypes) now recreates only the types that actually reference a replaced type.mapSchemaalready changes just the mapped types.rewireTypesthen walked every type and built a newGraphQLObjectType/ 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.
createStubreturns the graphql-js specified scalars forString/ID/Int/Float/Booleaninstead of building an object or input with that name. StitchtypeFromASTusescreateStubfor 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')transformInputValuenow keeps falsy list items when GraphQL coerces a singleton into a list.A
[String]/[Int]/[Boolean]field can receive"",0, orfalseinstead of a one-element array. The previousasArrayhelper treated those as empty and produced ``, so rename and other input transforms dropped a valid value.nullis still returned as-is. A real list is still walked item by item.
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.