New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
merge graphql-tools-fork into v5 #1307
Commits on Mar 26, 2020
-
graphql-subscriptions 1.1.0 only adds listeners after first call to next(), see apollographql/graphql-subscriptions#148
-
-
[feat] Add transformers to rename, filter, and arbitrarily transform …
…object fields, fixes ardatan#819.
-
feat(errors): Pass through all possible errors.
Use new relocatedError function to update the original GraphQLErrors with the new path. Addresses ardatan#743, ardatan#1037, ardatan#1046, apollographql/apollo-server#1582.
-
fix(stitching): fix regression
Refactoring in v5.1.0 introduced a regression when nullable root fields returned null without errors.
-
-
-
-
fix(stitching): serialize/deserialize enum/custom scalar values
BREAKING CHANGE: This change allows enums and custom scalars to be used as arguments within merged schemas. It also fixes seralization and deserialization more generally within merged schemas. If an implementation is available for a custom scalar within a merged schema (i.e., the schema is local), the internal representation will be available for use with stitching. Previously, the merged schema internally used the serialized version.
-
-
-
fix(stitching): fix legacy custom scalar recreation to more closely m…
…atch pre-v6.0.1 functionality.
-
-
fix(stitching): include specified directives even when merging of dir…
…ectives is disabled
-
-
-
fix(stitching): do not convert falsy values to null.
Closes #10. Renamed resultObject to result to remind code/coders that the result may be a scalrar, not an object, and may be falsy without being equivalent to null.
-
-
feat(stitching): allow delegateToSchema, mergeSchemas and transformSc…
…hema to take remote schema configurations as parameters This removes the need for makeRemoteExecutableSchema, removing an unnecessary layer of schema delegation. This change introduces a RemoteGraphQLSchema type which consists of a GraphQLSchema object annotated with link, fetcher, or dispatcher properties that can be used by delegateToSchema to access the remote schema. The dispatcher function takes the graphql context eventually passed to delegateToSchema as an argument and returns a link or fetcher function.
-
-
feat(transformers): TransformQuery transformer adds errorPathTransfor…
…mer property to properly return errors from transformed queries.
-
feat(transforms): add dedicated filterSchema function to allow schema…
… filtering without a layer of delegation
-
feat(transforms): map object fields to new structures
Provides building blocks to allow transforming object types by wrapping a field with a new object type or by extracting subfields from a field of a certain object type into the parent: = Adds new ExtendSchema transformer to extend the wrapping schema within transformSchema with new fields. = Adds new functions that create resolvers that can wrap, extract, and rename merged fields, for use within the ExtendSchema transformer = Adds new MapFields transformer to allow transformation of field nodes within a request by object type and field name.
-
fix(stitching): fixes error mapping with ExtendSchema transform. Also…
…, refactors! = uses createMergedResolver instead of individual wrapFields, extractFields, and renameFields functions. These functionss likely should be deprecated or at least renamed, as their function (creating specialized resolvers for merging) is not clear from current names. createMergedResolver works with multiple layers of wrapping, extracting, or even a combination thereof. = exports new extractFields function for use within a fieldNodeTransformerMap when wrapping fields. = allows specification of the fieldNodeTransformerMap directly on ExtendSchema transform so that separate MapFields transform not required. Under the hood, the ExtendSchema transform calls its own MapFields transform. = fixes file structure; as most of the recent new functionality is stitching functionality rather than transform functionality, even though it relies on the new ExtendSchema and MapFields transforms.
-
fix(stitching): input fields without default value
Input fields without default values should not have default values of null after transformation -- they should still have no default values. Closes #15.
-
fix(transforms): support custom scalar input variables on root fields…
… when transforming. Fixes #18.
-
chore(deps): upgrade dependencies.
Required changes to comply with new type definitions as graphql changes from flow to typescript.
-
-
fix(generate): addResolversToSchema should update enums and scalars o…
…f original schema. Closes #19.
-
fix(healSchema): healing schema requires reparsing default field valu…
…es as types are updated.
-
fix(healSchema): revert most recent change
healSchema cannot automatically include reparsing of default values. Automatic reparsing assumes that the default value corresponds to the old type, but that may not always be the case, and when it is not the case, the default value will be lost if automatic reparsing is implemented as in 6.3.6.
-
-
-
-
feat(cloning): export methods to shallow clone types and directives a…
…nd deep clone schemas
-
chore(deps): drop support for graphql 14.0 and 14.1
as refactoring relies heavily on toConfig
-
refactor(transforms): export wrapSchema
wrapSchema better describes what transformSchema does, it wraps requests to initial schema with request and response transforms, including any outer schema modifications that themselves can modify the response.
-
feat(filterSchema): provide type argument to type filter
also removes unnecessary checks considering defaults provides lint: default values obviate checks
-
-
fix(cloneSchema): healSchema requires a new array for object interfac…
…es and union types. toConfig provides a new map for fields, but not new arrays.
-
refactor: rewrite transforms visitSchema to use cloneSchema and healT…
…ypeMap. Required changes to healTypeMap to handle removed types and/or fields.
-
refactor: deprecate stripResolvers argument for transforms visitSchema
use wrapSchema instead
-
refactor: use graphql toConfig() instead of fieldToFieldConfig
toConfig does recreate the field map even though it does not recreate object interfaces and union types arrays.
-
refactor: use cloneType and healTypeMap within mergeSchemas instead o…
…f recreateType. Requires modifying healTypeMap to handle stub types.
-
refactor: rename healTypeMap to healTypes
As does not just heal typeMap, also heals types within directives.
-
rename cloneSchema to clone move healSchema to new file heal break out SchemaDirectiveVisitor and visitSchema from SchemaVisitor
-
-
feat(visitSchema): export consolidated visitSchema method
Takes an object of type SchemaVisitorDef, a SchemaVisitor class instance, an array of either, or a function that returns the schema visitor spec.
-
-
-
fix(visitSchema): visitSchema must reinitialize private variables whe…
…n updating interfaces.
-
-
fix(release): broken npmignore
due to incomplete npmignore whitelist
-
refactor(delegateToSchema): refactor away delegateToRemoteSchema
Allow delegateToSchema to take remote execution options or a schema execution config containg remote execution options. Remove unnecessary RemoteSchemaExecutionConfig type.
-
-
-
-
refactor(schemaRecreation): deprecate most of schema recreation now t…
…hat healTypes operational
-
-
fix(remote schemas): must add __typename to remote query to properly …
…resolve interfaces. Error will occur only when querying directly on the remote schema, as delegateToSchema automatically adds type names. addTypenameToAbstract is necessary for resolveType to work in the parent schema just as checkResultAndHandleErrors is necessary for resolve to work!
-
-
-
feat(utils): getResolversFromSchema
add function to get graphql-tools style resolvers map from an existing schema, parallels graphql-js toConfig.
-
-
fix(transforms): to properly allow chaining.
BREAKING CHANGE: Result transforms should be reversed, so that multiple request and result transforms can be properly executed. Request and result transforms must be inverted when transforming a schema, as these transforms work to move from the final schema back to the original schema. These CHANGES have the potential to be BREAKING.
-
-
-
feat(RenameTypes): remove extra result traversal
RenameTypes transform now relies on wrapping the resolveType methods within the outer schema instead of using transformResult. Required changing the resolveFromParentTypename to return a string instead of an object, as the string may need to be renamed before it corresponds to a type in the outer schema. So that the transform can be used as a operation transform as well, the transformResult function is preserved, but a new flag is used to skip result transformation when the resolvers will be responsible for transforming the result, i.e. when used with transformSchema/wrapSchema.
-
fix(docs): use delegateToSchema
instead of info.mergeInfo.delegateToSchema
-
-
-
fix(deps): correct graphql peer dependency.
Last npm-check-updates update upgraded the peer dependency instead of dev dependency.
-
refactor(mergeSchemas): consolidate code
Remove unnecessary MergeTypeCandidatesResult type. Use new SchemaLikeObject type.
-
refactor(mergeSchemas): remove variable
Remove unnecessary variable.
-
refactor(utils): consolidate more utils.
Consolidate forEachField functions. Move forEachField and forEachDefaultValue to utils folder. Change forEachField, forEachDefaultValue and mergeDeep to no longer use default exports to fit style of other utils files. TODO: streamline use/nonuse of default exports within entire library.
-
feat(mergeSchemas): allow transform specification
Allow specification of transforms directly within mergeSchemas. Allows for removal of an additional round of delegationg when merging transformed schemas. Requires schema wrapping prior to registering a type candidate for merge.
-
refactor(subschemas): improve delegation workflow
- refine SubschemaConfig type to allow using identical objects to merge different schemas and then delegate to those subschemas. - consolidate SchemaExecutionConfig type into SubschemaConfig type. - add separate subschemas, types, and typeDefs options to mergeSchemas to highlight different things that are being merged -- schemas options still works. - allow wrapSchema to take just a subschemaConfig as an argument, will apply the subschemas execution configuration and transforms to yield the appropriate delegating outer schema. - add rootValue to delegateToSchema options and move all other newish delegateToSchema options within the subSchemaConfig. rootValue is parallel in some ways to context, so ok to have at top level. - rename SubSchemaConfig => SubschemaConfig - - remove support for renaming types based on modification of an outer schema, this breaks when inner type is renamed and outer schema has interface not defined in inner schema. ExpandAbstractTypes currently handles this use case, but works only when the delegated result contains the correct typename. An alternative workflow would be to add the outer interface prior to renaming to each subschema and then merge interfaces. - remove resolversTransformResult property from transforms, no longer being used. - update docs! This change paves the way for annotating a result with a reference to the delegated schema. With a modified merged resolver, an outer merged schema could check to see if it received a partial result of a merged type and then merge the partial result with the necessary additional schemas defining the type.
-
fix(stitching): change merged result format
Merged results that are null may carry errors from deeper within the query tree. Previous merged result format carries this metadata within a property on the result, but null has no properties. New result format differs only in that a null result is transformed to an object with a special property signifying that the result was null, so that metadata can be added in the same way. When merging within defaultMergedResolver, all null checks must check for this property as well. Because a result may be changed during annotation, the function is essentially no longer annotating only/i.e. modifying the object in place, and so it has been renamed to reflect that, with forEach changed to map when processing a list. Fixes #26.
-
refactor(handleResult): remove some extra logic checks.
Streamlines code to skip a few extra checks with full recursive version, i.e. composite types do not require parsing.
-
refactor(handleNull): refactor to handleErrors
Consolidates a bit more code within checkResultAndHandleErrors.
-
-
-
-
-
-
RenameObjectFields and RenameRootFields should work when used together.
-
fix(transforms): cloneSchema prior to transformSchema
This allows individual schema transforms to save intermediate schema representations even if other schema transformations modify them in place.
-
refactor(TransformObjectFields)
visitSchema in this fork modifies schemas in place, but this change makes code more explicit that final schema is being used as base for transformRequest.
-
-
-
refactor(addTypenameToAbstract)
Remove unnecessary search. Duplicate typename fields are also included elsewhere!
-
Use graphql TypeInfo and visitWithTypeInfo to keep track of types during traversal.
-
-
Move renameFieldNode, wrapFieldNode, and collectFields into utils.
-
fix(stitching): improve error proxying for lists
required significant refactoring of error handling
-
fix(WrapType): fix root type edge case
Allow wrapping root types even when a root type value is not defined for the query.
-
fix(handleList): missing context
linter thought it referred to mocha context...
-
fix(stitching): wrapping and hoisting field transforms
BREAKING CHANGE: Previous version of createMergedResolver did not work with multiple layers of field wrapping. extractFields was not working, deprecated in favor of hoistFieldNodes. createMergedResolver now relies on two helper functions, dehoistResult, complement to hoistFieldNoes, and unwrapResult, complement to wrapFieldNodes.
-
refactor(transforms): streamline with upstream
remove all uses of fieldToFieldConfig in favor of type.toConfig() will support extensions for all graphql objects allow renaming of root and object fields without requiring field argument if field unchanged.
-
refactor(createMergedResolver)
Precompile resolver at build time. Default delimeter to '__gqtlf__'.
-
Update field name in tests to better reflect what is being tests.
-
feat(WrapFields): add new transform
--WrapFields can wrap a subset of a types fields with any number of wrapping fields and types. --fixes createMergedResolver and hoistFields. --refactors WrapType to use the underlying more generic WrapFields transform.
-
-
-
fix(filterToSchema): remove map in favor of plain object
some links (e.g. apollo-upload-client) may expect a plain object with constructor.name === 'Object'
-
feat(stitching): enable proxying uploads
Adds a new scalar for the gateway and a new server to server link that allows proxying of remote file uploads using the graphql-upload format.
-
-
-
questionable improvement in brevity vs clarity
-
-
-
fix(wrapping): wrapped field names must be unique.
...so they can be combined from multiple schemas. This change also adds use of a delimeter when wrapping fields and fixes specification of the delimeter more broadly, which was not set up appropriately within the dehoist property. The delimeter can now be specified when using the WrapFields and WrapType transforms. This change also removes the now unnecessary fromField property, as renaming no longer requires a dedicated resolver now that it just uses aliases.
-
feat(transforms): add HoistField transform
New HoistField transform allows moving a field on a remote type into a higher level object within the wrapping schema. The appendFields and filterFields methods from the WrapFIelds transform have been moved to the utils directory and exported; filterFields has been renamed to removeFields to better describe what it does.
-
refactor(addResolveFunctionsToSchema)
remove function hiding type checks
-
Remove references to resolve functions in favor of the generic term "resolver." Retain old exports for backwards compatibility.
-
new version of typescript and iterall don't play nice with this code
-
-
No need to prealias when wrapping if using deep merge instead of assign to merge types from multiple schemas, as the query tree should always be unique. If not prealiasing when wrapping, wrapping does not require a delimeter, and so hoisting does not require a prefix either as all delimeters are used only when hoisting.
-
fix(stitching): custom scalars/enums
Provide support for overriding scalars or enums used within input objects.
-
Simply example usage within test. Inclusion of the GraphQLUpload scalar within the resolver map is only necessary when merging an executable "local" subschema, as if the subschema has the original GraphqlUpload scalar defined, it will throw when attempting to serialize after it is merged into the gateway. The custom GraphqlUpload scalar can be used in that case to avoid that either within the local subschema or within the gateway. In this case, the subschema is remote, and so the subschema custom scalar is imported with the default serialize method that does not throw.
-
refactor(stitching): type merging
simplifies logic around type merging to automatically merge types that have merging resolvers specified.
-
-
fix(stitching): do not make sync delegation async
delegateToSchema now returns a synchronous result when possible rather than always returning a promise. merging types is also performed synchronously when possible. Fixes #36.
-
fix(healing): empty types should be pruned even if fields of those ty…
…pes still exist Fixes #37.
-
feat(stitching): add returnType option to delegateToSchema
facilitates proxying from objects to lists or possibly otherwise incompatible schemas, see #33.
-
feat(stitching): export createDelegatingRequest and delegateRequest m…
…ethods. May be useful for use with dataloaders or memoization. See ardatan#724
-
refactor(mergeTypes): provide flag
Allows specification that type merging is only performed in a wrapping schema without overriding info object. delegateToSchema will likely be used to obtain additional fields from subschemas, but only the initial wrapping delegateToSchema call should mergeTypes, otherwise type merging will never conclude. Previously this was done by creating a new info object.
-
- Default delegateToSchema operation to the original operation for root fields and query otherwise. - Change mergeTypes option to skipTypeMerging to reverse default so that skipTypeMerging should be specified for mergeTypeResolvers but can be omitted for stitching on gateway - serialize original variable values so that they can be ommited by default
-
-
fix(delegateToSchema): standardize args format
now that all directly proxied args are serialized automatically, including variables, appropriate to standardize args passed to delegateToSchema. Previously, the typeName would be inferred from the proxy target, but serialization would be according to the gateway schema if the type names matched. This would introduce a lot of edge cases and was only necessary as a workaround to facilitate serialization of variables. Now we can standardize as follows: args format is the internal representation of the proxy target schema. By default, local schemas internal representation will be imported, so that local schema custom enums/scalars do not require manual serialization. For remote schemas should, the internal and external representation is the same, so this is the same as the external representation. If the gateway introduces a new internal representation, args must be converted to the old internal representation manually. addresses #34 reverts fd1bd8f#diff-06b180be3290dd53bea4c1c98c9dfdd2
-
-
-
refactor(AddArgumentsAsVariables): to AddArguments
Why add arguments as variables when you can just add as an AST with graphql utility method?
-
refactor(AddArguments): transform not necessary
Additional arguments can be handled within initial proxy query creation just like a change in operation or fieldName.
-
refactor(delegateToSchema): organize imports
Also export useful transform application methods.
-
delegateRequest should take a query created for the targetSchema prior to application of request transforms. If request batching/caching/manipulation is to be performed, it should be possible to do this before or after request transforms are applied. Now createRequestFromInfo and the underlying createRequest methods create requests for the targetSchema prior to application of request transforms, and so that allows for a hook there. Using an Apollo link within the subschema config passed to delegateRequest allows for manipulation after request transforms are applied.
-
feat(stitching): support advanced type merging
Also fixes algorithmic error in type merging in which previously not recorded the correct originating subschema for fields. Nested type merging is now enabled, with tests (hopefully!) to follow.
-
fix(stitching): add arguments as variables
Reverts 3144e41. Adding args as variables can be useful if using only known queries.
-
-
-
-
feat(merging): check subschema rather than fragment for merging
allows for memoization as delegation plan no longer dependent on object includes additional refactoring and code cleanup drawback is that keys for fields cannot be spread across subschemas
-
feat(delegation): selectionSet option
Specifying the selection Set option can indicate that there are no existing arguments. Use selectionSets instead of fragments for type merging.
-
fix(merging): fixes merging for non root types
adds a canonical test
-
refactor(addMockFunctionsToSchema)
shorten name, retain old name for backwards compatibility
-
refactor(delegationTransforms)
separate out function, some of these can be precompiled.
-
feat(merging): set up default mergeTypeResolver
mergeType resolver functions can also simply be named resolve.
-
Closes #30. Again. Not sure if eslint will work better than tslint in terms of this.
-
fix(generation): allow modification of default scalar types
Add back support, although still not recommended.
-
chore(linting): switch from tslint to eslint
permanently fixes #30 aligns style rules with upstream graphql
-
-
chore(lint): pin eslint-plugin-import to 2.22.0
To avoid windows import/order error, see: import-js/eslint-plugin-import#1643
-
chore(prettier): use prettier!
Run prettier on codebase. Add prettier-check to ci workflow.
-
-
chore(ci): add releaseonly option
for manually releasing immediately after testing!
-
fix(transformSchema): handle schemaConfig objects
Regression caused by 3c3a256. Fixes gatsbyjs/gatsby#21443
-
chore(lint): fix a few eslint issues
instead of disabling a few rules
-
feat(graphql): initial v15 support.
Does not yet support v15 specific features that require graphql version checking, i.e. interfaces that implement interfaces, but existing tests should pass. A few unnecessary verbose tests deleted.
-
-
-
tsc must run successfully for both graphql v14 and v15
-
-
-
chore(deps): remove unnecessary dependency
@types/supertest was also hiding need for explicit inclusion of dom within typescript libs to avoid apollo-link-http-common related errors on node, see #41 and apollographql/apollo-link#544
-
chore(deps): remove dev dependency
@types/apollo-upload-client not necessary
-
-
provide cross-compatibility for graphql upload v9 and v10 in exported GraphQLUpload scalar
-
-
-
fix(ci): properly polyfill graphql v14.1 and 14.2
to properly support all graphql versions >= v0.12
-
-
-
-
-
feat(RenameRootTypes): add new transform
Fixes healing, which previously ignored changes in root types.
-
-
-
feat(mapSchema): initial version
mapSchema enables transformation of schema objects without modification of the original schema. See graphql/graphql-js#1199
-
-
toConfig returns an actual configuration, rather than a thunk.
-
-
-
-
-
-
-
-
-
-
-
-
Streamline mapper selection for types and directives. Lays groundwork for additional SchemaMapper object formats, i.e. the resolver map format with specification of individual types/directives by name.
-
-
fix(tests): v12 and v13 extensionASTNode support
v12 does not support extensionASTNodes v13 supports extensionASTNodes for query, mutation, and interface types
-
refactor(RenameTypes): to use mapSchema
MapSchema actually can be used to rename scalars -- even to rename specified types -- because rewiring does not modify the original types (as opposed to healing).
-
refactor(organize): folders and types
Use interfaces over tpes whenever possible as per official TypeScript recommendation, so as to support declaration merging. Separate delegation methods from stitching. Rename folders to verbs when possible for consistency. Rename transforms folder => wrap. Move makeRemoteExecutableSchema to wrap folder, as it wraps a remote schema.
-
refactor(npmignore): into package.json
Use files property within package json to white-list files in straightforward fashion. Do not publish extra markdown/images.
-
using mapSchema rather than visitSchema changes print(schema) order
-
-
fix(toConfig): accept field or inputField as arguments
now that fieldToFieldConfig has been removed, closes #44
-
-
-
fix(addResolveFunctionsToSchema): return modified schema
for backwards compatibility See ardatan/graphql-toolkit@46ce356#commitcomment-37987581
-
-
refactor(transforms): collect wrapping transforms
move wrapping transforms into separate subfolder
-
-
refactor(wrap): move wrapping resolvers
move wrapping resolvers to wrap folder, was placed in old stitching folder because makeRemoteExecutableSchema was in stitching, but makeRemoteExecutableSchema now belongs in the wrap folder, an older method besides wrapSchema/transformSchema of wrapping a schema, specifically for remote schema.
-
-
feat(transforms): add interface transforms
- adds TransformCompositeFields as generic transform that can function on fields belonging to objects and interfaces - refactoring TransformObjectFields to use TransformCompositeFIelds - adds TransformInterfaceFields along similar lines - adds RenameInterfaceFields and FilterInterfaceFields in parallel to RenameObjectFields and FilterObjectFields - make supporting types more generic and export them - add test for RenameInterfaceFields
-
refactor(transforms): remove unnecessary exports
already contained within transforms folder
-
-
-
fix(stitching): delegateToSchema args specification
BREAKING CHANGE: Allow specification of args even with root field transformations. Includes changes to createRequestFromInfo and createRequest signatures and related interfaces, streamlining them to only use the targetOperation and targetFieldName, returning to the original upstream graphql-tools behavior of adding args later as a transform. args passed to delegateToSchema, however, are still optional. All args passed to delegateToSchema are serialized using the targetSchema serialization, if available.
-