Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and publish to npm yourself or setup this action to publish automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.
Releases
@graphql-ts/extend@2.0.0
Major Changes
#31
5d2341e2d4653f8370c05f0e07ba9a151bf6b085Thanks @emmatown! -graphql@15is no longer supported.graphql@16.0.0or newer is now required.#31
5d2341e2d4653f8370c05f0e07ba9a151bf6b085Thanks @emmatown! - Thewrapexport has been removed. Since the types in@graphql-ts/schema@1.0.0are compatible with the GraphQL.js types directly, these functions are no longer needed.#51
8169eb85cdfc22f1f9730fca9136bd44e057af81Thanks @emmatown! - TheKeytype parameter onFieldhas been replaced with a new type parameter (SourceAtKey) and represents essentiallySource[Key]instead ofKey. For example, a field like this can be written:and
fieldwill be usable like this:The field is usable at
namesince the source type has an object with anameproperty that's astringbut using it atotherwill result in a type error since the source type doesn't have aotherproperty.Previously, using
g.fieldoutside ag.object/g.fieldscall would require specifying a resolver and fields written withing.fieldswould be bound to be used at a specific key rather than the new behaviour of any key with the right type.This also reduces the need for
g.fields. For example, the example given in the previous JSDoc forg.fields:Now the
g.fieldscall is unnecessary and writingnodeFieldswill no longer error at theg.fieldcall and will instead work as expected.There is still some use to
g.fieldsfor when you want to define a number of shared fields with resolvers and specify the source type just once in theg.fieldscall rathe than in every resolver.This change is unlikely to break existing code except where you explicitly use the
Fieldtype or explicitly pass type parameters tog.field(the latter of which you likely shouldn't do) but since it changes the meaning of a type parameter ofField, it's regarded as a breaking change.Patch Changes
8169eb85cdfc22f1f9730fca9136bd44e057af81,8169eb85cdfc22f1f9730fca9136bd44e057af81,8169eb85cdfc22f1f9730fca9136bd44e057af81,8169eb85cdfc22f1f9730fca9136bd44e057af81,5d2341e2d4653f8370c05f0e07ba9a151bf6b085,d7151bd2a6333327ac1a57e0c924bd4bfdbdf01f,5d2341e2d4653f8370c05f0e07ba9a151bf6b085,5d2341e2d4653f8370c05f0e07ba9a151bf6b085,5d2341e2d4653f8370c05f0e07ba9a151bf6b085,8169eb85cdfc22f1f9730fca9136bd44e057af81]:@graphql-ts/schema@1.0.0
Major Changes
#51
8169eb85cdfc22f1f9730fca9136bd44e057af81Thanks @emmatown! - Thegandgraphqlexports from@graphql-ts/schemahave been removed. You should now usegWithContextto bindgto a specific context type.All types previously available at
g.*likeg.ObjectType<Source>can written instead likeg<typeof g.object<Source>>or from types imported from@graphql-ts/schemainstead of being accessible directly ong.#51
8169eb85cdfc22f1f9730fca9136bd44e057af81Thanks @emmatown! - The following types have been replaced as follows:ObjectType->GObjectTypeEnumType->GEnumTypeScalarType->GScalarTypeInputObjectType->GInputObjectTypeInterfaceType->GInterfaceTypeUnionType->GUnionTypeListType->GListNonNullType->GNonNullArg->GArgField->GFieldFieldResolver->GFieldResolverInterfaceField->GInterfaceFieldNullableInputType->GNullableInputTypeNullableOutputType->GNullableOutputTypeNullableType->GNullableTypeInputType->GInputTypeOutputType->GOutputTypeType->GTypeThey are all exactly adding
Gbefore the previous name except forListTypeandNonNullTypewhich are nowGListandGNonNullrespectively withoutTypeat the end.#51
8169eb85cdfc22f1f9730fca9136bd44e057af81Thanks @emmatown! - All of the GraphQL types returned by@graphql-ts/schemaare now directly runtime compatible with the equivalent types from GraphQL.js instead of being on.graphQLType.Handling this change should generally just require removing
.graphQLTypefrom where@graphql-ts/schematypes are used with GraphQL.js, like this:import { GraphQLSchema } from "graphql"; const Query = g.object()({ name: "Query", fields: { hello: g.field({ type: g.String, resolve() { return "Hello!"; }, }), }, }); const schema = new GraphQLSchema({ - query: Query.graphQLType, + query: Query, });The types returned by
@graphql-ts/schemaare internally now extended classes of the equivalent types from GraphQL.js (though only in the types, at runtime they are re-exports). These new classes are exported from@graphql-ts/schemaasGObjectTypeand etc. The constructors of theG*types can be used directly safely in place of theg.*functions in some cases though some are not safe and it's still recommended to useg.*to also have binding to the same context type without needed to provide it manually.#51
8169eb85cdfc22f1f9730fca9136bd44e057af81Thanks @emmatown! -bindGraphQLSchemaAPIToContextandGraphQLSchemaAPIWithContexthave been replaced with thegWithContextfunction andGWithContexttype respectively. They now also include all the APIs that aren't specifically bound to a context.#31
5d2341e2d4653f8370c05f0e07ba9a151bf6b085Thanks @emmatown! -graphql@15is no longer supported.graphql@16.0.0or newer is now required.#53
d7151bd2a6333327ac1a57e0c924bd4bfdbdf01fThanks @emmatown! - The@graphql-ts/schema/api-with-contextand@graphql-ts/schema/api-without-contextentrypoints have been removed. You should usegWithContextand the types exported from@graphql-ts/schemadirectly instead.#31
5d2341e2d4653f8370c05f0e07ba9a151bf6b085Thanks @emmatown! - TheObjectTypeFuncand other*TypeFunctypes are no longer exported. UseGWithContext<Context>['object']/etc. instead#31
5d2341e2d4653f8370c05f0e07ba9a151bf6b085Thanks @emmatown! - TheEnumValuetype no longer exists. The type parameter forEnumTypeis nowRecord<Key, Value>instead ofRecord<Key, EnumValue<Value>>.#31
5d2341e2d4653f8370c05f0e07ba9a151bf6b085Thanks @emmatown! - TypeScript 5.7 or newer is now required#51
8169eb85cdfc22f1f9730fca9136bd44e057af81Thanks @emmatown! - TheKeytype parameter onFieldhas been replaced with a new type parameter (SourceAtKey) and represents essentiallySource[Key]instead ofKey. For example, a field like this can be written:and
fieldwill be usable like this:The field is usable at
namesince the source type has an object with anameproperty that's astringbut using it atotherwill result in a type error since the source type doesn't have aotherproperty.Previously, using
g.fieldoutside ag.object/g.fieldscall would require specifying a resolver and fields written withing.fieldswould be bound to be used at a specific key rather than the new behaviour of any key with the right type.This also reduces the need for
g.fields. For example, the example given in the previous JSDoc forg.fields:Now the
g.fieldscall is unnecessary and writingnodeFieldswill no longer error at theg.fieldcall and will instead work as expected.There is still some use to
g.fieldsfor when you want to define a number of shared fields with resolvers and specify the source type just once in theg.fieldscall rathe than in every resolver.This change is unlikely to break existing code except where you explicitly use the
Fieldtype or explicitly pass type parameters tog.field(the latter of which you likely shouldn't do) but since it changes the meaning of a type parameter ofField, it's regarded as a breaking change.@graphql-ts/test-project@1.0.11
Patch Changes
8169eb85cdfc22f1f9730fca9136bd44e057af81,8169eb85cdfc22f1f9730fca9136bd44e057af81,8169eb85cdfc22f1f9730fca9136bd44e057af81,8169eb85cdfc22f1f9730fca9136bd44e057af81,5d2341e2d4653f8370c05f0e07ba9a151bf6b085,5d2341e2d4653f8370c05f0e07ba9a151bf6b085,d7151bd2a6333327ac1a57e0c924bd4bfdbdf01f,5d2341e2d4653f8370c05f0e07ba9a151bf6b085,5d2341e2d4653f8370c05f0e07ba9a151bf6b085,5d2341e2d4653f8370c05f0e07ba9a151bf6b085,8169eb85cdfc22f1f9730fca9136bd44e057af81]: