File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -90,16 +90,18 @@ export function getIntrospectionQuery(options?: IntrospectionOptions): string {
9090 return optionsWithDefault . experimentalDirectiveDeprecation ? str : '' ;
9191 }
9292 const oneOf = optionsWithDefault . oneOf ? 'isOneOf' : '' ;
93- function ofType ( level = 9 ) : string {
93+ function ofType ( level : number , indent : string ) : string {
9494 if ( level <= 0 ) {
9595 return '' ;
9696 }
97+ if ( level > 100 ) {
98+ throw new Error ( "Please set typeDepth to a reasonable value; the default is 9." ) ;
99+ }
97100 return `
98- ofType {
99- name
100- kind
101- ${ ofType ( level - 1 ) }
102- }` ;
101+ ${ indent } ofType {
102+ ${ indent } name
103+ ${ indent } kind${ ofType ( level - 1 , indent + " " ) }
104+ ${ indent } }`;
103105 }
104106
105107 return `
@@ -174,8 +176,7 @@ export function getIntrospectionQuery(options?: IntrospectionOptions): string {
174176
175177 fragment TypeRef on __Type {
176178 kind
177- name
178- ${ ofType ( optionsWithDefault . typeDepth ) }
179+ name${ ofType ( optionsWithDefault . typeDepth ?? 9 , " " ) }
179180 }
180181 ` ;
181182}
You can’t perform that action at this time.
0 commit comments