@graphql-tools/utils
10.7.2
Patch Changes
-
#6822
53bb601
Thanks @enisdenjo ! - dependencies updates:- Updated dependency
dset@^3.1.4
↗︎ (from^3.1.2
, independencies
)
- Updated dependency
-
#6822
53bb601
Thanks @enisdenjo ! - Bump dset dependency handling the CVE-2024-21529
10.7.1
Patch Changes
- #6809
4912f19
Thanks @AaronMoat ! - Remove use ofVoidFunction
type, which requires DOM types
10.7.0
Minor Changes
-
#6789
2c70d27
Thanks @n1ru4l ! - - New helper functiongetAbortPromise
to get a promise rejected whenAbortSignal
is aborted- New helper function
registerAbortSignalListener
to register a listener to abort a promise whenAbortSignal
is 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
6a8123b
Thanks @ardatan ! - Improvements forfakePromise
so it can be used without params to create avoid
Promise
10.6.3
Patch Changes
020b9e4
Thanks @ardatan ! - `AbortSignal` in `GraphQLResolveInfo`, and `AbortSignal` in `ExecutionRequest`
10.6.2
Patch Changes
-
#6737
1b24656
Thanks @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
dc5043b
Thanks @enisdenjo ! -onError
andonEnd
callbacks frommapAsyncIterator
are invoked only once regardless of how many timesthrow
/return
was 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
6291e14
Thanks @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
b8bf584
Thanks @ardatan ! - Introduce `getDirectiveExtensions` and refactor directive handling in the extensions
10.3.4
Patch Changes
10.3.3
Patch Changes
-
#6385
d0f7d75
Thanks @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
cacf20f
Thanks @ardatan ! - Implement Symbol.dispose or Symbol.asyncDispose to make `Executor`s `Disposable`
10.2.3
Patch Changes
10.2.2
Patch Changes
-
#6238
0f7059b
Thanks @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
7368829
Thanks @ardatan ! - Handle interface objects in a different way -
#6188
e10c13a
Thanks @ardatan ! - AddrespectArrayLength
flag tomergeDeep
so 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
5567347
Thanks @ardatan ! - Handle fields in unmerged types as both isolated and non-isolated fields
10.1.3
Patch Changes
-
#6055
4093f70
Thanks @enisdenjo ! - Disallow new lines in paths when checking withisValidPath
A 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
baf3c28
Thanks @henryqdineen ! - fix filterSchema argument filter for schema with non-default root types
10.1.0
Minor Changes
- #5924
f3ea7a5
Thanks @EmrysMyrddin ! - AddonEnd
onmapAsyncIterator
.
10.0.13
Patch Changes
10.0.12
Patch Changes
10.0.11
Patch Changes
- #4886
d3fe8d8c
Thanks @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
-
accd58fd
Thanks @ardatan ! - Extractinspect
into the newcross-inspect
package -
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
c1afb545
Thanks @kennyjwilli ! - Exports theDirectableGraphQLObject
type.
10.0.3
Patch Changes
- #5398
be3411c7
Thanks @EmrysMyrddin ! - incremental merge also merges extensions
10.0.2
Patch Changes
-
#5396
bb8f169e
Thanks @ardatan ! - dependencies updates:- Added dependency
dset@^3.1.2
↗︎ (todependencies
)
- Added dependency
-
#5396
bb8f169e
Thanks @ardatan ! - Move the merging logic of incremental results to the utils package
10.0.1
Patch Changes
10.0.0
Major Changes
-
#5274
944a68e8
Thanks @ardatan ! - Drop Node 14 support. Require Node.js>= 16
-
#5274
944a68e8
Thanks @ardatan ! -AggregateError
is no longer exported from@graphql-tools/utils
. You can use the nativeAggregateError
instead.
9.2.1
Patch Changes
9.2.0
Minor Changes
Patch Changes
- #5016
62d074be
Thanks @mayrn-techdivision ! - Fixes introspection query issues when visiting field ‘__type’
9.1.4
Patch Changes
- #4961
e3ec35ed
Thanks @gilgardosh ! - Bug fix: better handle array field types used for alias field names
9.1.3
Patch Changes
- #4887
904fe770
Thanks @ardatan ! - Fix leak on Node 14 and add cancellation to async iterables correctly
9.1.2
Patch Changes
9.1.1
Patch Changes
- #4842
7411a5e7
Thanks @charlypoly ! - Fix validation swallowing fragments on naming conflicts
9.1.0
Minor Changes
- #4827
c0639dd0
Thanks @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
8f6d3efc
Thanks @ardatan ! - BREAKING:checkValidationErrors
has been dropped andvalidateGraphQlDocuments
now acceptsDocumentNode[]
instead and it throws the originalGraphQLError
s with the correct stack trace -
#4796
80836fa7
Thanks @saihaj ! - updatecollectFields
to support collecting deffered values
Minor Changes
8.13.1
Patch Changes
8.13.0
Minor Changes
-
#4778
df5848b8
Thanks @saihaj ! - add isIterableObject, isObjectLike, isPromise, promiseReduce, hasOwnProperty -
#4778
df5848b8
Thanks @saihaj ! - addPath
util fromgraphql/jsutils
Patch Changes
8.12.0
Minor Changes
8.11.0
Minor Changes
- #4661
403ed450
Thanks @nicolaslt ! - Add getArgumentsWithDirectives
Patch Changes
- #4694
71cb4fae
Thanks @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
e3167edc
Thanks @n1ru4l ! - Fix CommonJS TypeScript resolution withmoduleResolution
node16
ornodenext
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:
mergeSchemas
was skippingdefaultFieldResolver
anddefaultMergedResolver
by 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 newincludeDefaultMergedResolver
flag is introduced ingetResolversFromSchema
to 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
defaultMergedResolver
in 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
createGraphQLError
helper 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 X
when 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: -
schemaExtensions
option has been added tomergeSchemas
,makeExecutableSchema
andstitchSchemas
configurationsBreaking Changes;
- Move
mergeSchemas
andMergeSchemasConfig
from@graphql-tools/merge
to@graphql-tools/schema
package to prevent circular dependency between them. mergeSchemasAsync
has been removed.- Move
NamedDefinitionNode
,resetComments
,collectComment
,pushComment
andprintComment
from@graphql-tools/merge
to@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
Source
object instead of singleSource
-
GraphQL Tag Pluck now respects code locations and returns graphql-js
Source
objects for each found code block -
Thanks to the one above,
CodeFileLoader
now returns differentSource
objects for each found SDL code block.
-
-
7d3e3006: BREAKING CHANGE
- Remove
fieldToFieldConfig
,argsToFieldConfigArgument
andargumentToArgumentConfig
-
- You can use
.toConfig
method 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;
mergeDeep
now 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
Request
toExecutionRequest
-
Add required
operationType: OperationTypeNode
field inExecutionRequest
-
Add
context
increateRequest
andcreateRequestInfo
instead 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
defaultExecutor
for a singleGraphQLSchema
so allowgetBatchingExecutor
to memoizebatchingExecutor
correctly. -
And there is no different
defaultExecutor
is created forsubscription
and other operation types. Only one executor is used.
Batch executor is memoized by
executor
reference butcreateDefaultExecutor
didn’t memoize the default executor so this memoization wasn’t working correctly onbatch-execute
side. https://github.com/ardatan/graphql-tools/blob/remove-info-executor/packages/batch-execute/src/getBatchingExecutor.ts#L9 -
-
7d3e3006: BREAKING CHANGE
- Now it uses the native
AggregateError
implementation. The major difference is the individual errors are kept undererrors
property 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
debugLog
but usesconsole.log
directly only ifDEBUG
is available underprocess.env
- No longer exports
-
7d3e3006: BREAKING CHANGE
- No longer applies
camelCase
naming 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
name
andargs
properties.New useful function
getDirective
returns 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
getDirective
function 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
Executor
can receiveAsyncIterable
and 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
,visitSchema
andVisitSchemaKind
-
- Use
mapSchema
instead
- 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
getDirectives
method. 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,@key
should 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
,warn
orignore
rather thantrue
orfalse
. In previous versions, some of the validators caused errors to be thrown, while some issued warnings. This changes brings consistency to validator behavior. -
The
allowResolversNotInSchema
has been renamed torequireResolversToMatchSchema
, to harmonize the naming convention of all the validators. The default setting ofrequireResolversToMatchSchema
iserror
, matching the previous behavior.
Schema Delegation (
delegateToSchema
&@graphql-tools/delegate
)-
The
delegateToSchema
return 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
,getErrorsByPathSegment
functions. Only external errors with missing or invalid paths must still be preserved by annotating the remote object with special properties. The newgetUnpathedErrors
function is therefore necessary for retrieving only these errors. Note also the newannotateExternalObject
andmergeExternalObjects
functions, as well as the renaming ofhandleResult
toresolveExternalValue
. -
Transform types and the
applySchemaTransforms
are now relocated to thedelegate
package;applyRequestTransforms
/applyResultTransforms
functions have been deprecated, however, as this functionality has been replaced since v6 by theTransformer
abstraction. -
The
transformRequest
/transformResult
methods are now provided additionaldelegationContext
andtransformationContext
arguments — these were introduced in v6, but previously optional. -
The
transformSchema
method may wish to create additional delegating resolvers and so it is now provided thesubschemaConfig
and final (non-executable)transformedSchema
parameters. As in v6, thetransformSchema
is 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 individualtransformSchema
methods also get access to the result of the first run, if necessary, they can create additional wrapping schema proxying resolvers. -
applySchemaTransforms
parameters have been updated to match and support thetransformSchema
parameters above.
Remote Schemas & Wrapping (
wrapSchema
,makeRemoteExecutableSchema
, and@graphql-tools/wrap
)-
wrapSchema
andgenerateProxyingResolvers
now only take a single options argument with named properties of typeSubschemaConfig
. The previously possible shorthand version with first argument consisting of aGraphQLSchema
and second argument representing the transforms should be reworked as aSubschemaConfig
object. -
Similarly, the
ICreateProxyingResolverOptions
interface that provides the options for thecreateProxyingResolver
property ofSubschemaConfig
options has been adjusted. Theschema
property previously could be set to aGraphQLSchema
or aSubschemaConfig
object. This property has been removed in favor of asubschemaConfig
property that will always be aSubschemaConfig
object. Thetransforms
property has been removed; transforms should be included within theSubschemaConfig
object.` -
The format of the wrapping schema has solidified. All non-root fields are expected to use identical resolvers, either
defaultMergedResolver
or a custom equivalent, with root fields doing the hard work of proxying. Support for custom merged resolvers throughtcreateMergedResolver
has been deprecated, as custom merging resolvers conflicts when using stitching’s type merging, where resolvers are expected to be identical across subschemas. -
The
WrapFields
transform’swrappingResolver
option 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 asTransformRootFields
orTransformObjectFields
. -
The
ExtendSchema
transform has been removed, as it is conceptually simpler just to usestitchSchemas
with one subschema. -
The
ReplaceFieldsWithFragment
,AddFragmentsByField
,AddSelectionSetsByField
, andAddMergedTypeSelectionSets
transforms has been removed, as they are superseded by theAddSelectionSets
andVisitSelectionSets
transforms. TheAddSelectionSets
purposely 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 theparseSelectionSet
function from@graphql-tools/utils
.
Schema Stitching (
stitchSchemas
&@graphql-tools/stitch
)-
stitchSchemas
’smergeTypes
option is now true by default! This causes theonTypeConflict
option to be ignored by default. To useonTypeConflict
to select a specific type instead of simply merging, simply setmergeTypes
to false. -
schemas
argument has been deprecated, usesubschemas
,typeDefs
, ortypes
, depending on what you are stitching. -
When using batch delegation in type merging, the
argsFromKeys
function is now set only via theargsFromKeys
property. Previously, ifargsFromKeys
was absent, it could be read fromargs
. -
Support for fragment hints has been removed in favor of selection set hints.
-
stitchSchemas
now processes allGraphQLSchema
andSubschemaConfig
subschema input into newSubschema
objects, handling schema config directives such aso@computed
as well as generating the final transformed schema, stored as thetransformedSchema
property, if transforms are used. Signatures of theonTypeConflict
,fieldConfigMerger
, andinputFieldConfigMerger
have been updated to include metadata related to the original and transformed subschemas. Note the property name change foronTypeConflict
fromschema
tosubschema
.
Mocking (
addMocksToSchema
and@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
, andinfo
withparent
available asthis
rather than as the first argument.
Other Utilities (
@graphql-tools/utils
)filterSchema
’sfieldFilter
will now filter all fields across Object, Interface, and Input types. For the previous Object-only behavior, switch to theobjectFieldFilter
option.- Unused
fieldNodes
utility functions have been removed. - Unused
typeContainsSelectionSet
function has been removed, andtypesContainSelectionSet
has been moved to thestitch
package. - Unnecessary
Operation
type has been removed in favor ofOperationTypeNode
from upstream graphql-js. - As above,
applySchemaTransforms
/applyRequestTransforms
/applyResultTransforms
have been removed from theutils
package, 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