- Update @graphql-tools/utils dependency and fix samples for Apollo server v3.
- Update graphql peer-dependency for Apollo server v3.
- Updated @apollo/federation dependency for Node 18 compatibility.
- Drop Node 12 compatibility.
- Updated graphql-tools dependency to fix security vulnerabilities
- Updated schema pruning dependency and TS definitions
- [FIXED] - imported components directives are merged into final schema
- schema pruning and remove broken makeExecutableSchema override
- [FIXED] - if
exclude
is undefined in a component config
- Modernized to utilize new graphql-tools
- [BREAKING] - directives are not imported and maintained throughout the tree : top level component is responsible for directive implementations
- [FEATURE] - Add "hook" for custom
makeExecutableSchema
function
- [FIXED] - Explicitly removed wrapping of the federation
__resolveReference()
resolver which was preventing__resolveReference()
from running when usinggraphql-component
to build federated schemas in seperate graphql services.
- [FIXED] - A bug with
graphql-component
being used in a federated schema was brought to our attention and was attributed to the non-root type field resolver wrapping performed to help prevent double execution of resolvers with local delegation. Effectively, the resolver wrapping functionality was causing a null value to be returned (by attempting to return a value from the root arg) when the wrapper should have been calling through to the actual resolver. To fix this, separate wrapper functions are used for fields that begin with__
(such as__resolveType()
) versus "normal" non-root type fields. These separated wrapper functions look for similar but slightly different conditions to determine whether to "short circuit" an already computed result which ensures that the wrapper functions are short circuiting or calling through to the actual resolver in the desired situations.
- [FIXED] - delegateToComponent()'s second parameter is an options object that supports an
args
key for passing arguments to the target GraphQL operation via JavaScript from the calling resolver. Previously, if you attempted to pass an array (wrapping any form of JavaScript scalar) a type coersion error would surface. delegateToComponent's options.args parameter now supports passing Array like arguments as expected.
- [REVERT] - reverting both fixes in 2.1.2. The change made to unify exclusions and return pre-computed results from non-root resolvers resulted in non-root resolvers not executing when they should have. Being able to exclude non-root resolvers (not their types) is a valid work around in certain situations.
- [FIXED] - modified automatic pruning mechanism during delegation to use parent types/parent type fields instead of getFieldDef()
- [FIXED] - non-root resolvers being executed twice in certain delegate situations
- [FIXED] - resolver exclusion now works identical to type exclusion. Only root types (
Query
,Mutation
,Subscription
) and/or fields on root types can be excluded, which was not the case for resolver functions prior to this fix.
- update
@apollo/federation
to^0.20.4
- [FEATURE]
delegateToComponent()
- automatically prune fields from the delegated document selection set that are not defined in the schema (component) being delegated to. This will reduced potential down stream errors as well as ensures no unintended fields are forwarded and all fields forwarded can be resolved by the schema be delegated to. This feature addresses some edge cases around variable forwarding that were not addressed in prior patch releases2.0.4
and2.0.5
.
- [FIXED] Reinstated variable passing to the sub-document created by
delegateToComponent()
. All variable values will be forwarded to the delegated operation, but only the variable definitions for input types or types that are in the target schema will be forwarded. This prevents errors in certain delegate situations while also allowing valid resolution of args passed as variables.
- [FIXED] the error path on errors surfaced through
delegateToComponent()
calls such that error path takes into account the already traversed path and exclusions - [FIXED] Variables from an outer operation are no longer forwarded to the sub operation created by
delegateToComponent()
this is to avoid passing along variables for types that dont exist in the schema being delegated to.
- [FIXED] individual field exclusions during import - individual field exclusions will no longer modify the original resolver map that is being imported.
- [FIXED] tightened up argument forwarding when using
delegateToComponent()
- only arguments the target field is expecting will be extracted from the calling resolver or from theargs
object provided todelegateToComponent()
depending on the situation. Previously, there were some unintended argument leakage in certain edge cases.
- [FIXED] importing directives
- [FIXED] error merging to iteratively consider the merge path to properly merge errors in complex situations such as lists
- [BREAKING] removed fragment helpers
- [BREAKING]
schemaDirectives
(which returned merged directives) removed from component api - [BREAKING] removed
proxyImportedResolvers
feature flag - [BREAKING] removed
execute
- [FEATURE] added
delegateToComponent
to replaceexecute
- [FEATURE] args can be overridden/passed via
delegateToComponent
- [FEATURE] added
targetRootField
option todelegateToComponent
- [FIXED] delegation for subscription operations
- [FIXED] Memoizing resolvers didn't take into account aliased requests
- [FIXED] delegating an operation that contains an abstract type
- [DOCS] added documentation for
delegateToComponent
- [CLEANUP] use fieldNodes to build sub-operation document in delegateToComponent such that the original operation document isn't unintentionally modified
- [CLEANUP] removal of proxy resolvers creation when importing resolvers
- [CLEANUP] Refactor how imports are merged together to be optimized and only run when a schema is requested
- [CLEANUP] Moved tests alongside source code
- Fixed exclude mapping in GraphQLComponent constructor - Array.map was erroniously changed to Array.filter
- Imported resolvers will delegate to the imported component schema to which they belong.
- Remove
this._context
as default value for context inexecute()
requiringexecute()
users to pass in context from a calling resolver. - Remove binding of
GraphQLComponent
class context to Subscription resolvers. - Apply proxyImportedResolvers regardless of how the way a component is imported and whether or not exclusions are provided. proxyImportedResolvers can still be turned off for an imported component if the component is passed via config object.
- Execute flag
mergeErrors
allows inline errors to facilitate returning multiple errors from resolvers that useexecute
.
- Allow extended properties in federated schema with custom directives
- Allow custom directives in federation (#40)
- Clean up empty types that were excluded (#38)
- Reduced package size with npmignore
- Added federation support
- New license copyright
- Fixed data source proxy losing instance binding
- Upgraded to graphql peer ^14
execute
now supports both document objects and strings.
- [BREAKING from 1.1.0 (sorry, but it is 5 minutes later)]: data sources appear by constructor name on context
- Added first class data source support and overriding
- Fixes #23
- Disabling type resolvers from memoization — this doesn't work right for type resolvers.
- Outer global context setup occurs only once when
context
is fetched off component.
- Fixed .npmignore to not include misc files that added to the package size