@graphql-tools/utils
10.8.6
Patch Changes
10.8.5
Patch Changes
-
#6977
90a717eThanks @ardatan ! - In executor, do not use leakingregisterAbortSignalListener, and handle listeners inside the execution context -
#7025
26518deThanks @ardatan ! - Better handling for field name handling inbuildOperationForField
10.8.4
Patch Changes
10.8.3
Patch Changes
- #6971
4a2eb14Thanks @ardatan ! - dependencies updates:- Added dependency
@whatwg-node/promise-helpers@^1.0.0↗︎ (todependencies)
- Added dependency
10.8.2
Patch Changes
10.8.1
Patch Changes
10.8.0
Minor Changes
Patch Changes
10.7.2
Patch Changes
-
#6822
53bb601Thanks @enisdenjo ! - dependencies updates:- Updated dependency
dset@^3.1.4↗︎ (from^3.1.2, independencies)
- Updated dependency
-
#6822
53bb601Thanks @enisdenjo ! - Bump dset dependency handling the CVE-2024-21529
10.7.1
Patch Changes
- #6809
4912f19Thanks @AaronMoat ! - Remove use ofVoidFunctiontype, which requires DOM types
10.7.0
Minor Changes
-
#6789
2c70d27Thanks @n1ru4l ! - - New helper functiongetAbortPromiseto get a promise rejected whenAbortSignalis aborted- New helper function
registerAbortSignalListenerto register a listener to abort a promise whenAbortSignalis aborted
Instead of using
.addEventListener('abort', () => {/* ... */}), we register a single listener to avoid warnings on Node.js likeMaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 abort listeners added. Use emitter.setMaxListeners() to increase limit. - New helper function
10.6.4
Patch Changes
- #6769
6a8123bThanks @ardatan ! - Improvements forfakePromiseso it can be used without params to create avoidPromise
10.6.3
Patch Changes
020b9e4Thanks @ardatan ! - `AbortSignal` in `GraphQLResolveInfo`, and `AbortSignal` in `ExecutionRequest`
10.6.2
Patch Changes
-
#6737
1b24656Thanks @ardatan ! - Handle array of primitives correctlyThe bug was following;
mergeDeep([{ options: ['$a', '$b'] }, { options: ['$c'] }, { options: ['$d', '$e'] }]) // results in { options: [{}, {}] }
10.6.1
Patch Changes
10.6.0
Minor Changes
10.5.6
Patch Changes
- #6677
dc5043bThanks @enisdenjo ! -onErrorandonEndcallbacks frommapAsyncIteratorare invoked only once regardless of how many timesthrow/returnwas called on the iterator
10.5.5
Patch Changes
10.5.4
Patch Changes
10.5.3
Patch Changes
10.5.2
Patch Changes
10.5.1
Patch Changes
6291e14Thanks @ardatan ! - Add all args from extensions to the AST even if they don’t exist in the directive def
10.5.0
Minor Changes
10.4.0
Minor Changes
b8bf584Thanks @ardatan ! - Introduce `getDirectiveExtensions` and refactor directive handling in the extensions
10.3.4
Patch Changes
10.3.3
Patch Changes
-
#6385
d0f7d75Thanks @tobiasdiez ! - remove generic package export -
Updated dependencies [
d0f7d75]:- cross-inspect@1.0.1
10.3.2
Patch Changes
10.3.1
Patch Changes
10.3.0
Minor Changes
- #6323
cacf20fThanks @ardatan ! - Implement Symbol.dispose or Symbol.asyncDispose to make `Executor`s `Disposable`
10.2.3
Patch Changes
10.2.2
Patch Changes
-
#6238
0f7059bThanks @ardatan ! - If the given objects are arrays with the same length, merge the elements.const a = [{ a: 1 }, { b: 2 }] const b = [{ c: 3 }, { d: 4 }] const result = mergeDeep(a, b) // [{ a: 1, c: 3 }, { b: 2, d: 4 }]
10.2.1
Patch Changes
-
#6194
7368829Thanks @ardatan ! - Handle interface objects in a different way -
#6188
e10c13aThanks @ardatan ! - AddrespectArrayLengthflag tomergeDeepso instead of concatenating the arrays, elements of them will be merged if they have the same length
10.2.0
Minor Changes
Patch Changes
- #6105
5567347Thanks @ardatan ! - Handle fields in unmerged types as both isolated and non-isolated fields
10.1.3
Patch Changes
-
#6055
4093f70Thanks @enisdenjo ! - Disallow new lines in paths when checking withisValidPathA string may sometimes look like a path but is not (like an SDL of a simple GraphQL schema). To make sure we don’t yield false-positives in such cases, we disallow new lines in paths (even though most Unix systems support new lines in file names).
10.1.2
Patch Changes
10.1.1
Patch Changes
- #5931
baf3c28Thanks @henryqdineen ! - fix filterSchema argument filter for schema with non-default root types
10.1.0
Minor Changes
- #5924
f3ea7a5Thanks @EmrysMyrddin ! - AddonEndonmapAsyncIterator.
10.0.13
Patch Changes
10.0.12
Patch Changes
10.0.11
Patch Changes
- #4886
d3fe8d8cThanks @ldiqual ! - Print debug timer logs by respecting the filters in DEBUG env var
10.0.10
Patch Changes
10.0.9
Patch Changes
10.0.8
Patch Changes
-
accd58fdThanks @ardatan ! - Extractinspectinto the newcross-inspectpackage -
Updated dependencies [
accd58fd]:- cross-inspect@1.0.0
10.0.7
Patch Changes
10.0.6
Patch Changes
10.0.5
Patch Changes
10.0.4
Patch Changes
- #5444
c1afb545Thanks @kennyjwilli ! - Exports theDirectableGraphQLObjecttype.
10.0.3
Patch Changes
- #5398
be3411c7Thanks @EmrysMyrddin ! - incremental merge also merges extensions
10.0.2
Patch Changes
-
#5396
bb8f169eThanks @ardatan ! - dependencies updates:- Added dependency
dset@^3.1.2↗︎ (todependencies)
- Added dependency
-
#5396
bb8f169eThanks @ardatan ! - Move the merging logic of incremental results to the utils package
10.0.1
Patch Changes
10.0.0
Major Changes
-
#5274
944a68e8Thanks @ardatan ! - Drop Node 14 support. Require Node.js>= 16 -
#5274
944a68e8Thanks @ardatan ! -AggregateErroris no longer exported from@graphql-tools/utils. You can use the nativeAggregateErrorinstead.
9.2.1
Patch Changes
9.2.0
Minor Changes
Patch Changes
- #5016
62d074beThanks @mayrn-techdivision ! - Fixes introspection query issues when visiting field ‘__type’
9.1.4
Patch Changes
- #4961
e3ec35edThanks @gilgardosh ! - Bug fix: better handle array field types used for alias field names
9.1.3
Patch Changes
- #4887
904fe770Thanks @ardatan ! - Fix leak on Node 14 and add cancellation to async iterables correctly
9.1.2
Patch Changes
9.1.1
Patch Changes
- #4842
7411a5e7Thanks @charlypoly ! - Fix validation swallowing fragments on naming conflicts
9.1.0
Minor Changes
- #4827
c0639dd0Thanks @ardatan ! - TypeError and all other GraphQLError s from argument value parsing should return 400
9.0.1
Patch Changes
9.0.0
Major Changes
-
#4801
8f6d3efcThanks @ardatan ! - BREAKING:checkValidationErrorshas been dropped andvalidateGraphQlDocumentsnow acceptsDocumentNode[]instead and it throws the originalGraphQLErrors with the correct stack trace -
#4796
80836fa7Thanks @saihaj ! - updatecollectFieldsto support collecting deffered values
Minor Changes
8.13.1
Patch Changes
8.13.0
Minor Changes
-
#4778
df5848b8Thanks @saihaj ! - add isIterableObject, isObjectLike, isPromise, promiseReduce, hasOwnProperty -
#4778
df5848b8Thanks @saihaj ! - addPathutil fromgraphql/jsutils
Patch Changes
8.12.0
Minor Changes
8.11.0
Minor Changes
- #4661
403ed450Thanks @nicolaslt ! - Add getArgumentsWithDirectives
Patch Changes
- #4694
71cb4faeThanks @dimatill ! - Fix pruneSchema to not remove type that is used only as a directive argument type
8.10.1
Patch Changes
8.10.0
Minor Changes
8.9.1
Patch Changes
- #4624
e3167edcThanks @n1ru4l ! - Fix CommonJS TypeScript resolution withmoduleResolutionnode16ornodenext
8.9.0
Minor Changes
-
2a3b45e3: Allow
&in filenames.Related to https://github.com/dotansimha/graphql-code-generator/issues/6174
8.8.0
Minor Changes
- d76a299c: Support TypeScript module resolution.
Patch Changes
- a0abbbcd: fix(visitResult): handle introspection fields correctly with an introspection query result
8.7.0
Minor Changes
-
4914970b:
mergeSchemaswas skippingdefaultFieldResolveranddefaultMergedResolverby default while extracting resolvers for each given schema to reduce the overhead. But this doesn’t work properly if you mix wrapped schemas and local schemas. So newincludeDefaultMergedResolverflag is introduced ingetResolversFromSchemato put default “proxy” resolvers in the extracted resolver map formergeSchemas.This fixes an issue with alias issue, so nested aliased fields weren’t resolved properly because of the missing
defaultMergedResolverin the final merged schema which should come from the wrapped schema.
8.6.13
Patch Changes
- 041c5ba1: Use caret range for the tslib dependency
8.6.12
Patch Changes
- da7ad43b: Fix GraphQL v17 incompatibility issues and introduce
createGraphQLErrorhelper function for backwards compatibility.
8.6.11
Patch Changes
- c0762ee3: Incoming GraphQL v17 compatibility #4468
8.6.10
Patch Changes
- 0fc510cb: Interface implementations should be included when a return type is an interface.
8.6.9
Patch Changes
- 31a33e2b: pruneSchema will no longer removed used input object type.
8.6.8
Patch Changes
- cb238877: pruneSchema will now prune unused implementations of interfaces
8.6.7
Patch Changes
-
0bbb1769: Refine generic typings using
extends Xwhen appropriateTypescript 4.7 has stricter requirements around generics which is explained well in the related PR: https://github.com/microsoft/TypeScript/pull/48366
These changes resolve the errors that these packages will face when attempting to upgrade to TS 4.7 (still in beta at the time of writing this). Landing these changes now will allow other TS libraries which depend on these packages to experiment with TS 4.7 in the meantime.
8.6.6
Patch Changes
- 904c0847: Support deprecated directive on enum values
8.6.5
Patch Changes
- be2c02d7: fix(utils): use 3 as inspect recursive depth
8.6.4
Patch Changes
- d36d530b: fix(utils): pass the value as-is if it cannot be parsed by the actual type
8.6.3
Patch Changes
- 3da3d66c: fix - align versions
8.6.2
Patch Changes
- 18341363: feat(visitResult): ignore if field not present in visited object
8.6.1
Patch Changes
-
43a60f93: Improve getArgumentValues check for null values
-
20e1058b: fix pruneSchema
Schema pruning must be done in rounds, as pruning types will automatically prune any fields that rely on them (within mapSchema), but then the empty types may also require pruning.
8.6.0
Minor Changes
- 69b316c2: feat(utils): more withCancel utils
8.5.5
Patch Changes
- 7b5d72c5: enhance(utils): better typing for withCancel
8.5.4
Patch Changes
- 51315610: enhance: avoid using globalThis
8.5.3
Patch Changes
- 960e178a: fix: isAsyncIterable should check if it is an object with iterator factory function
- 947a3fe0: enhance(utils): show error with details in inspect fn
8.5.2
Patch Changes
- 233e0379: fix(utils): respect new specifiedByURL of GraphQL v16
8.5.1
Patch Changes
- 4bfb3428: enhance: use ^ for tslib dependency
8.5.0
Minor Changes
- ad04dc79: enhance: make operationType optional
8.4.0
Minor Changes
- 149afddb: fix: getting ready for GraphQL v16
8.3.0
Minor Changes
- 58262be7: feat(utils): export createDefaultRules
8.2.5
Patch Changes
- 1043219f: fix implicit dependencies
8.2.4
Patch Changes
- 014937db: batch-execute enhancements:
- fixes bugs with batched fragment definitions
- unpathed errors are now returned for all batch results
- the “graphqlTools” prefix is simplified down to just ”_”
- new tests and documentation
8.2.3
Patch Changes
- da157d62: fix(utils): Avoid processing read-only properties on visitData method
8.2.2
Patch Changes
- d4918a78: fix(commentDescriptions): handle descriptions and comments correctly during merge
8.2.1
Patch Changes
- 50609df8: fix(utils): print specifiedBy directive correctly
- be6fdb88: fix(utils): bring back breaking change for fixSchemaAst
8.2.0
Minor Changes
- c5b0719c: enhance(utils): copy inspect util from graphql-js
- c5b0719c: feat: GraphQL v16 support
- c5b0719c: enhance(utils): move memoize functions to utils
- c5b0719c: enhance(utils): copy collectFields from graphql-js@16 for backwards compat
Patch Changes
- c5b0719c: enhance(utils): memoize root types utility functions
8.1.2
Patch Changes
- c8c13ed1: enhance: remove TypeMap and small improvements
8.1.1
Patch Changes
- 2c807ddb: enhance(buildOperationNodeForField): mutation response return a field of type Query
8.1.0
Minor Changes
-
b9684631: feat(validate-documents): more clear error messages with stack
-
67691b78: -
schemaExtensionsoption has been added tomergeSchemas,makeExecutableSchemaandstitchSchemasconfigurationsBreaking Changes;
- Move
mergeSchemasandMergeSchemasConfigfrom@graphql-tools/mergeto@graphql-tools/schemapackage to prevent circular dependency between them. mergeSchemasAsynchas been removed.- Move
NamedDefinitionNode,resetComments,collectComment,pushCommentandprintCommentfrom@graphql-tools/mergeto@graphql-tools/utils.
- Move
Patch Changes
- 9ede806a: enhance(utils): use inspect from graphql-js instead of node:util #3324
8.0.2
Patch Changes
- 04830049: fix(utils): support old TypeScript versions
8.0.1
Patch Changes
- b823dbaf: fix(utils): fix AggregateErrorConstructor type issue
8.0.0
Major Changes
-
af9a78de: BREAKING CHANGE
-
Now each loader handles glob patterns internally and returns an array of
Sourceobject instead of singleSource -
GraphQL Tag Pluck now respects code locations and returns graphql-js
Sourceobjects for each found code block -
Thanks to the one above,
CodeFileLoadernow returns differentSourceobjects for each found SDL code block.
-
-
7d3e3006: BREAKING CHANGE
- Remove
fieldToFieldConfig,argsToFieldConfigArgumentandargumentToArgumentConfig -
- You can use
.toConfigmethod instead for each.
- You can use
- Remove
-
7d3e3006: BREAKING CHANGE
- Legacy Schema Directives and Directive Resolvers have been removed
-
- You can check the new method for both;
-
dae6dc7b: refactor: ExecutionParams type replaced by Request type
rootValue property is now a part of the Request type.
When delegating with delegateToSchema, rootValue can be set multiple ways:
- when using a custom executor, the custom executor can utilize a rootValue in whichever custom way it specifies.
- when using the default executor (execute/subscribe from graphql-js): — rootValue can be passed to delegateToSchema via a named option — rootValue can be included within a subschemaConfig — otherwise, rootValue is inferred from the originating schema
When using wrapSchema/stitchSchemas, a subschemaConfig can specify the createProxyingResolver function which can pass whatever rootValue it wants to delegateToSchema as above.
-
6877b913: BREAKING CHANGES;
mergeDeepnow takes an array of sources instead of set of parameters as input and it takes an additional flag to enable prototype merging Instead ofmergeDeep(...sources)=>mergeDeep(sources) -
c42e811d: BREAKING CHANGES;
- Rename
RequesttoExecutionRequest - Add required
operationType: OperationTypeNodefield inExecutionRequest - Add
contextincreateRequestandcreateRequestInfoinstead ofdelegateToSchema
It doesn’t rely on info.operation.operationType to allow the user to call an operation from different root type. And it doesn’t call getOperationAST again and again to get operation type from the document/operation because we have it in Request and ExecutionParams https://github.com/ardatan/graphql-tools/pull/3166/files#diff-d4824895ea613dcc1f710c3ac82e952fe0ca12391b671f70d9f2d90d5656fdceR38
Improvements;
- Memoize
defaultExecutorfor a singleGraphQLSchemaso allowgetBatchingExecutorto memoizebatchingExecutorcorrectly. - And there is no different
defaultExecutoris created forsubscriptionand other operation types. Only one executor is used.
Batch executor is memoized by
executorreference butcreateDefaultExecutordidn’t memoize the default executor so this memoization wasn’t working correctly onbatch-executeside. https://github.com/ardatan/graphql-tools/blob/remove-info-executor/packages/batch-execute/src/getBatchingExecutor.ts#L9 - Rename
-
7d3e3006: BREAKING CHANGE
- Now it uses the native
AggregateErrorimplementation. The major difference is the individual errors are kept undererrorsproperty instead of the object itself withSymbol.iterator.
// From; for (const error of aggregateError) // To; for (const error of aggregateError.errors) - Now it uses the native
-
8c8d4fc0: BREAKING CHANGE: remove cloneSchema
-
7d3e3006: BREAKING CHANGE
- No longer exports
debugLogbut usesconsole.logdirectly only ifDEBUGis available underprocess.env
- No longer exports
-
7d3e3006: BREAKING CHANGE
- No longer applies
camelCasenaming convention inbuildOperationNodeForField
- No longer applies
-
74581cf3: fix(getDirectives): preserve order around repeatable directives
BREAKING CHANGE: getDirectives now always return an array of individual DirectiveAnnotation objects consisting of
nameandargsproperties.New useful function
getDirectivereturns an array of objects representing any args for each use of a single directive (returning the empty object{}when a directive is used without arguments).Note: The
getDirectivefunction returns an array even when the specified directive is non-repeatable. This is because one use of this function is to throw an error if more than one directive annotation is used for a non repeatable directive!When specifying directives in extensions, one can use either the old or new format.
-
c0ca3190: BREAKING CHANGE
- Remove Subscriber and use only Executor
-
- Now
Executorcan receiveAsyncIterableand subscriptions will also be handled byExecutor. This is a future-proof change for defer, stream and live queries
- Now
-
7d3e3006: BREAKING CHANGE
- No longer exports
SchemaVisitor,visitSchemaandVisitSchemaKind -
- Use
mapSchemainstead
- Use
- No longer exports
Minor Changes
- 9c26b847: enhance(loaders): remove optional methods from the Loader interface
- 7d3e3006: feat(utils): Respect operationName and rootValue in ExecutionParams
Patch Changes
- 982c8f53: enhance(utils): refactor, cleanup and remove extra work
7.10.0
Minor Changes
- e632c5d1: Make executors not generic over context types
Patch Changes
- 99f092fd: fix(getResolversFromSchema) Fix resolvers for type names starting with a single underscore.
7.9.1
Patch Changes
- be23817f: enhance(utils): do not extract default resolvers
7.9.0
Minor Changes
- 20d2c7bc: feat(utils): add withCancel
7.8.1
Patch Changes
- dbdb78e0: fix(visitResult): don’t throw on encountering __typename in request (#2860)
7.8.0
Minor Changes
- 03c579b1: enhance(utils): astFromDirective doesn’t need schema anymore
7.7.3
Patch Changes
- d2a17c70: enhance(printSchemaWithDirectives): show directives before other definitions #2752
7.7.2
Patch Changes
- a4f1ee58: __ is reserved for introspection
7.7.1
Patch Changes
- 194ac370: fix(utils): add createSchemaDefinition again to fix breaking change
7.7.0
Minor Changes
- 58fd4b28: feat(types): add TContext to stitchSchemas and executor
Patch Changes
- 43da6b59: enhance(merge): reduce number of iterations
7.6.0
Minor Changes
- 5b637e2f: Add generic pruning filter option
7.5.2
Patch Changes
- de16fff4: Fix pruneSchema with unimplemented interfaces
7.5.1
Patch Changes
- 33d1b9e7: Fix pruneSchema with unused interfaces
7.5.0
Minor Changes
- 219ed392: enhance(utils): Extract getDocumentNodeFromSchema from printSchemaWithDirectives
Patch Changes
- 219ed392: fix(utils): fix missing default value of input object type field
- 219ed392: fix(utils): print specifiedBy directive definitions correctly
7.4.0
Minor Changes
- 8f331aaa: enhance(utils): Extract getDocumentNodeFromSchema from printSchemaWithDirectives
Patch Changes
- 8f331aaa: fix(utils): fix missing default value of input object type field
7.3.0
Minor Changes
- 6387572c: feat(utils): export astFrom* helper functions
7.2.6
Patch Changes
- e53f97b3: fix(utils): provide
{ done: true }from iterator when complete is called on observer in observableToAsyncIterable
7.2.5
Patch Changes
-
4fc05eb7: Fixes the handling of repeatable directives in the
getDirectivesmethod. Previously repeatable directives were nested and duplicated. They will now return as a flat array map:@mydir(arg: "first") @mydir(arg: "second")translates into:
{ mydir: [{ arg: 'first' }, { arg: 'second' }] }
7.2.4
Patch Changes
-
6e50d9fc: enhance(stitching-directives): use keyField
When using simple keys, i.e. when using the keyField argument to
@merge, the keyField can be added implicitly to the types’ key. In most cases, therefore,@keyshould not be required at all.
7.2.3
Patch Changes
- 3d1340a3: fix(printSchemaWithDirectives): typo
7.2.2
Patch Changes
- 63ab0034: fix(printSchemaWithDirectives): should print directives where used, even if directives themselves are not defined within the schema.
7.2.1
Patch Changes
- 270046a1: fix(TransformInputObjectFields): transform variables #2353
7.2.0
Minor Changes
- c3996f60: enhance(utils): support code-first schemas by allowing directives to be read from extensions
Patch Changes
- c3996f60: fix(stitchingDirectives): complete support for code first schemas
- c3996f60: fix(printSchemaWithDirectives): should work for code-first schemas as well
- c3996f60: enhance(utils) filter root field arguments with filterSchema
7.1.6
Patch Changes
- cd5da458: fix(utils): fix crashes when return null while visitSchema
7.1.5
Patch Changes
- 298cd39e: fix(url-loader): do not fail multipart request when null variable given
7.1.4
Patch Changes
- 4240a959: fix(utils): fix Observable signature for observableToAsyncIterator
7.1.3
Patch Changes
- 6165c827: Trow on SDL syntax errors
7.1.2
Patch Changes
- 21da6904: fix release
7.1.1
Patch Changes
- b48a91b1: add ability to specify merge config within subschemas using directives
7.1.0
Minor Changes
- 4f5a4efe: enhance(schema): add some options to improve schema creation performance
7.0.2
Patch Changes
- e3176633: fix(utils): revert to old observableToAsyncIterable return type
7.0.1
Patch Changes
- 8133a907: fix(utils): Remove $ from invalidPathRegex
- 2b6c813e: fix(utils): fix typing mismatch between linkToSubscriber and observableToAsyncIterable
7.0.0
Major Changes
-
be1a1575: ## Breaking Changes:
Schema Generation and Decoration API (
@graphql-tools/schema)-
Resolver validation options should now be set to
error,warnorignorerather thantrueorfalse. In previous versions, some of the validators caused errors to be thrown, while some issued warnings. This changes brings consistency to validator behavior. -
The
allowResolversNotInSchemahas been renamed torequireResolversToMatchSchema, to harmonize the naming convention of all the validators. The default setting ofrequireResolversToMatchSchemaiserror, matching the previous behavior.
Schema Delegation (
delegateToSchema&@graphql-tools/delegate)-
The
delegateToSchemareturn value has matured and been formalized as anExternalObject, in which all errors are integrated into the GraphQL response, preserving their initial path. Those advanced users accessing the result directly will note the change in error handling. This also allows for the deprecation of unnecessary helper functions includingslicedError,getErrors,getErrorsByPathSegmentfunctions. Only external errors with missing or invalid paths must still be preserved by annotating the remote object with special properties. The newgetUnpathedErrorsfunction is therefore necessary for retrieving only these errors. Note also the newannotateExternalObjectandmergeExternalObjectsfunctions, as well as the renaming ofhandleResulttoresolveExternalValue. -
Transform types and the
applySchemaTransformsare now relocated to thedelegatepackage;applyRequestTransforms/applyResultTransformsfunctions have been deprecated, however, as this functionality has been replaced since v6 by theTransformerabstraction. -
The
transformRequest/transformResultmethods are now provided additionaldelegationContextandtransformationContextarguments — these were introduced in v6, but previously optional. -
The
transformSchemamethod may wish to create additional delegating resolvers and so it is now provided thesubschemaConfigand final (non-executable)transformedSchemaparameters. As in v6, thetransformSchemais kicked off once to produce the non-executable version, and then, if a wrapping schema is being generated, proxying resolvers are created with access to the (non-executable) initial result. In v7, the individualtransformSchemamethods also get access to the result of the first run, if necessary, they can create additional wrapping schema proxying resolvers. -
applySchemaTransformsparameters have been updated to match and support thetransformSchemaparameters above.
Remote Schemas & Wrapping (
wrapSchema,makeRemoteExecutableSchema, and@graphql-tools/wrap)-
wrapSchemaandgenerateProxyingResolversnow only take a single options argument with named properties of typeSubschemaConfig. The previously possible shorthand version with first argument consisting of aGraphQLSchemaand second argument representing the transforms should be reworked as aSubschemaConfigobject. -
Similarly, the
ICreateProxyingResolverOptionsinterface that provides the options for thecreateProxyingResolverproperty ofSubschemaConfigoptions has been adjusted. Theschemaproperty previously could be set to aGraphQLSchemaor aSubschemaConfigobject. This property has been removed in favor of asubschemaConfigproperty that will always be aSubschemaConfigobject. Thetransformsproperty has been removed; transforms should be included within theSubschemaConfigobject.` -
The format of the wrapping schema has solidified. All non-root fields are expected to use identical resolvers, either
defaultMergedResolveror a custom equivalent, with root fields doing the hard work of proxying. Support for custom merged resolvers throughtcreateMergedResolverhas been deprecated, as custom merging resolvers conflicts when using stitching’s type merging, where resolvers are expected to be identical across subschemas. -
The
WrapFieldstransform’swrappingResolveroption has been removed, as this complicates multiple wrapping layers, as well as planned functionality to wrap subscription root fields in potentially multiple layers, as the wrapping resolvers may be different in different layers. Modifying resolvers can still be performed by use of an additional transform such asTransformRootFieldsorTransformObjectFields. -
The
ExtendSchematransform has been removed, as it is conceptually simpler just to usestitchSchemaswith one subschema. -
The
ReplaceFieldsWithFragment,AddFragmentsByField,AddSelectionSetsByField, andAddMergedTypeSelectionSetstransforms has been removed, as they are superseded by theAddSelectionSetsandVisitSelectionSetstransforms. TheAddSelectionSetspurposely takes parsed SDL rather than strings, to nudge end users to parse these strings at build time (when possible), rather than at runtime. Parsing of selection set strings can be performed using theparseSelectionSetfunction from@graphql-tools/utils.
Schema Stitching (
stitchSchemas&@graphql-tools/stitch)-
stitchSchemas’smergeTypesoption is now true by default! This causes theonTypeConflictoption to be ignored by default. To useonTypeConflictto select a specific type instead of simply merging, simply setmergeTypesto false. -
schemasargument has been deprecated, usesubschemas,typeDefs, ortypes, depending on what you are stitching. -
When using batch delegation in type merging, the
argsFromKeysfunction is now set only via theargsFromKeysproperty. Previously, ifargsFromKeyswas absent, it could be read fromargs. -
Support for fragment hints has been removed in favor of selection set hints.
-
stitchSchemasnow processes allGraphQLSchemaandSubschemaConfigsubschema input into newSubschemaobjects, handling schema config directives such aso@computedas well as generating the final transformed schema, stored as thetransformedSchemaproperty, if transforms are used. Signatures of theonTypeConflict,fieldConfigMerger, andinputFieldConfigMergerhave been updated to include metadata related to the original and transformed subschemas. Note the property name change foronTypeConflictfromschematosubschema.
Mocking (
addMocksToSchemaand@graphql-tools/mock)- Mocks returning objects with fields set as functions are now operating according to upstream
graphql-js convention, i.e. these functions take three arguments,
args,context, andinfowithparentavailable asthisrather than as the first argument.
Other Utilities (
@graphql-tools/utils)filterSchema’sfieldFilterwill now filter all fields across Object, Interface, and Input types. For the previous Object-only behavior, switch to theobjectFieldFilteroption.- Unused
fieldNodesutility functions have been removed. - Unused
typeContainsSelectionSetfunction has been removed, andtypesContainSelectionSethas been moved to thestitchpackage. - Unnecessary
Operationtype has been removed in favor ofOperationTypeNodefrom upstream graphql-js. - As above,
applySchemaTransforms/applyRequestTransforms/applyResultTransformshave been removed from theutilspackage, as they are implemented elsewhere or no longer necessary.
Related Issues
- proxy all the errors: #1047, #1641
- better error handling for merges #2016, #2062
- fix typings #1614
- disable implicit schema pruning #1817
- mocks not working for functions #1807
-
6.2.4
Patch Changes
- 32c3c4f8: Fix duplication of scalar directives in merge
- 533d6d53: Bump all packages to allow adjustments