Skip to content
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

v6 Monorepo #1419

Merged
merged 130 commits into from
May 21, 2020
Merged

v6 Monorepo #1419

merged 130 commits into from
May 21, 2020

Conversation

ardatan
Copy link
Owner

@ardatan ardatan commented Apr 27, 2020

generate

  • Several functions have been renamed.
    • addResolveFunctionsToSchema => addResolversToSchema
    • addSchemaLevelResolveFunctions => addSchemaLevelResolver
    • addMockFunctionsToSchema => addMocksToSchema
    • appendFields => appendObjectFields
    • removeFields => removeObjectFields
  • graphql-tools now attempts to avoid modifying schemas in place and to instead return new schemas, modified as necessary, with the exception of the legacy visitSchema and visitSchemaDirectives functionality.
  • Majority of schema modification functions now return new schemas without editing the original schema, rather than modifying the original schema in place. The return value of the function has the new schema:
    • makeExecutableSchema
    • addResolversToSchemas
    • attachDirectiveResolvers
    • addSchemaLevelResolver
    • addCatchUndefinedToSchema,
    • addErrorLoggingToSchema
    • addMocksToSchema
  • schema modification functions operating on fields now similarly take a schema as a parameter and return a new schema, rather than modifying the passed in typeMap (and requiring manual schema healing)
    • appendObjectFields
    • removeObjectFields
  • abstract types that use resolveType properties to return an actual type rather than a type name may be unstable when using graphql-tools, as these types are hidden from the type map and cannot be recreated. These resolveType resolvers should be relatively easy to rewrite to use the name of a known GraphQLObject type included within the schema’s type map. This may limit the use of graphql-tools for advanced schemas that rely on dynamic abstract types, but greatly simplifies the code base.
  • addConnectorsToContext has been deprecated, attaching context manually is clearer
    Deprecate attachConnectorsToContext #140

delegate

  • AddMergedTypeSelectionSets (now AddSelectionSetsByType, see below) has been slightly altered so that it can generically add selection sets when provided any map of selection sets by type name
  • transforms have been renamed to reflect that they generically add fragments/selection sets when given a map specified by either typeName/fieldName combination or just typeName:
    • AddReplacementSelectionSets => AddSelectionSetsByField
    • AddReplacementFragments => AddFragmentsSetsByField
    • AddMergedTypeSelectionSets => AddSelectionSetsByType

wrap

  • remote schema wrapping is now accomplished by using executors and subscribers rather than fetchers and links. Functions that convert links to executors/subscribers are included with @graphql-tools/links. See https://github.com/ardatan/graphql-tools/blob/move-graphql-toolkit/website/docs/remote-schemas.md.

  • Transform<*>Field Transforms now all take a fieldTransformer with altered FieldTransformer type.
    A FieldTransformer receives a field config as an argument rather than a field, so that library users are spared having to call fieldToFieldConfig. A FieldTransformer can return an array of type [string, GraphQLFieldConfig<any, any>] instead of an object { name: string, field: GraphQLFieldConfig<any, any> } if it wishes to rename the field, the tuple is less verbose and the object is misnamed, it should be { newName, newFieldConfig } anyway.

stitch

  • stitching has been renamed (mergeSchemas => stitchSchemas)
  • use selectionSet hints instead of fragment hints within the resolver map
    allows inheritance from interfaces
  • resolvers passed to stitchSchemas match type of resolvers passed to makeExecutableSchema (and can no longer be functions). Stitching metadata stored within “mergeInfo” may still be accessed within each resolver as info.mergeInfo
  • custom proxying resolvers now take an options object instead of individual parameters, a breaking change from v5, when the custom proxying resolvers were introduced

delegate

  • info.mergeInfo.delegate/info.mergeInfo.delegateToSchema => delegateToSchema
    utils
  • polyfills for graphql versions earlier than 14.2 have been removed, including toConfig
  • fieldToFieldConfig and inputFieldToInputFieldConfig functionality is now exported separately, although library users should ideally not have to use them.

@theguild-bot
Copy link
Collaborator

theguild-bot commented Apr 27, 2020

The latest changes of this PR are available as alpha in npm: 6.0.0-alpha-ae7c968.0

Quickly update your package.json by running:

npx match-version @graphql-tools 6.0.0-alpha-ae7c968.0

@ardatan ardatan changed the title Move graphql toolkit WIP: Move graphql toolkit Apr 27, 2020
renovate bot and others added 7 commits May 19, 2020 21:54
Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Renovate Bot <bot@renovateapp.com>
…1517)

within the graphql ecosystem, many users still annotate schemas, types, and
possibly directives with custom properties instead of using the
newer extensions property.

mapSchema should copy all custom properties when creating graphql
objects as possible.
for full backwards compatibility

reverts changes with respect to type annotation -- if types have already been modified in place, more straightforward to
just keep doing so
Copy link
Collaborator

@kamilkisiela kamilkisiela left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants