@@ -540,39 +540,45 @@ export default function makeExtendSchemaPlugin(
540540 }
541541 } ) ;
542542
543- builder . hook (
544- "GraphQLInterfaceType:fields" ,
545- ( fields , build , context : any ) => {
546- const {
547- extend,
548- [ `ExtendSchemaPlugin_${ uniqueId } _typeExtensions` ] : typeExtensions ,
549- } = build ;
550- const { Self } = context ;
551- if ( typeExtensions . GraphQLInterfaceType [ Self . name ] ) {
552- const newFields = typeExtensions . GraphQLInterfaceType [
553- Self . name
554- ] . reduce (
555- (
556- memo : GraphQLFieldConfigMap < any , any > ,
557- extension : InterfaceTypeExtensionNode
558- ) => {
559- const moreFields = getFields (
560- Self ,
561- extension . fields ,
562- { } , // No resolvers for interfaces
563- context ,
564- build
565- ) ;
566- return extend ( memo , moreFields ) ;
567- } ,
568- { }
569- ) ;
570- return extend ( fields , newFields ) ;
571- } else {
572- return fields ;
543+ try {
544+ builder . hook (
545+ "GraphQLInterfaceType:fields" ,
546+ ( fields , build , context : any ) => {
547+ const {
548+ extend,
549+ [ `ExtendSchemaPlugin_${ uniqueId } _typeExtensions` ] : typeExtensions ,
550+ } = build ;
551+ const { Self } = context ;
552+ if ( typeExtensions . GraphQLInterfaceType [ Self . name ] ) {
553+ const newFields = typeExtensions . GraphQLInterfaceType [
554+ Self . name
555+ ] . reduce (
556+ (
557+ memo : GraphQLFieldConfigMap < any , any > ,
558+ extension : InterfaceTypeExtensionNode
559+ ) => {
560+ const moreFields = getFields (
561+ Self ,
562+ extension . fields ,
563+ { } , // No resolvers for interfaces
564+ context ,
565+ build
566+ ) ;
567+ return extend ( memo , moreFields ) ;
568+ } ,
569+ { }
570+ ) ;
571+ return extend ( fields , newFields ) ;
572+ } else {
573+ return fields ;
574+ }
573575 }
574- }
575- ) ;
576+ ) ;
577+ } catch ( e ) {
578+ console . warn (
579+ "Please update your version of PostGraphile/Graphile Engine, the version you're using does not support the GraphQLInterfaceType:fields hook"
580+ ) ;
581+ }
576582 } ;
577583
578584 function getName ( name : NameNode ) {
0 commit comments