File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1616 "sha.js" : " ^2.4.11"
1717 },
1818 "peerDependencies" : {
19- "graphql" : " ^14.2.1 || ^15.0.0"
19+ "graphql" : " ^14.2.1 || ^15.0.0 || ^16.0.0 "
2020 },
2121 "jest" : {
2222 "preset" : " ts-jest" ,
Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ const skippedSDLRules: ValidationRule[] = [
5656try {
5757 const PossibleTypeExtensions : typeof import ( "graphql/validation/rules/PossibleTypeExtensions" ) . PossibleTypeExtensions = require ( "graphql/validation/rules/PossibleTypeExtensions" )
5858 . PossibleTypeExtensions ;
59+
5960 if ( PossibleTypeExtensions ) {
6061 skippedSDLRules . push ( PossibleTypeExtensions ) ;
6162 }
6465 // by the version of `graphql` that is available to us.
6566}
6667
68+ // BREAKING AGAIN: PossibleTypeExtensions is finilized into PossibleTypeExtensionsRule in
69+ // graphql 16. For compatible reason, try catch logic for 15 is kept with extra logic for 16.
70+ try {
71+ // Compatible for graphql-js@16
72+ const PossibleTypeExtensionsRule = require ( "graphql" )
73+ . PossibleTypeExtensionsRule ;
74+
75+ if ( PossibleTypeExtensionsRule ) {
76+ skippedSDLRules . push ( PossibleTypeExtensionsRule ) ;
77+ }
78+ } catch ( e ) {
79+ // No need to fail in this case. Instead, if this validation rule is missing, we will assume its not used
80+ // by the version of `graphql` that is available to us.
81+ }
82+
6783const sdlRules = specifiedSDLRules . filter (
6884 rule => ! skippedSDLRules . includes ( rule )
6985) ;
You can’t perform that action at this time.
0 commit comments