@@ -1055,7 +1055,7 @@ async function completeAsyncIteratorValue(
10551055 fieldGroup : FieldGroup ,
10561056 info : GraphQLResolveInfo ,
10571057 path : Path ,
1058- iterator : AsyncIterator < unknown > ,
1058+ asyncIterator : AsyncIterator < unknown > ,
10591059 asyncPayloadRecord : AsyncPayloadRecord | undefined ,
10601060) : Promise < ReadonlyArray < unknown > > {
10611061 const stream = getStreamValues ( exeContext , fieldGroup , path ) ;
@@ -1072,7 +1072,7 @@ async function completeAsyncIteratorValue(
10721072 // eslint-disable-next-line @typescript-eslint/no-floating-promises
10731073 executeStreamAsyncIterator (
10741074 index ,
1075- iterator ,
1075+ asyncIterator ,
10761076 exeContext ,
10771077 fieldGroup ,
10781078 info ,
@@ -1088,7 +1088,7 @@ async function completeAsyncIteratorValue(
10881088 let iteration ;
10891089 try {
10901090 // eslint-disable-next-line no-await-in-loop
1091- iteration = await iterator . next ( ) ;
1091+ iteration = await asyncIterator . next ( ) ;
10921092 if ( iteration . done ) {
10931093 break ;
10941094 }
@@ -1140,15 +1140,15 @@ function completeListValue(
11401140 const itemType = returnType . ofType ;
11411141
11421142 if ( isAsyncIterable ( result ) ) {
1143- const iterator = result [ Symbol . asyncIterator ] ( ) ;
1143+ const asyncIterator = result [ Symbol . asyncIterator ] ( ) ;
11441144
11451145 return completeAsyncIteratorValue (
11461146 exeContext ,
11471147 itemType ,
11481148 fieldGroup ,
11491149 info ,
11501150 path ,
1151- iterator ,
1151+ asyncIterator ,
11521152 asyncPayloadRecord ,
11531153 ) ;
11541154 }
@@ -1948,7 +1948,7 @@ function executeStreamField(
19481948}
19491949
19501950async function executeStreamAsyncIteratorItem (
1951- iterator : AsyncIterator < unknown > ,
1951+ asyncIterator : AsyncIterator < unknown > ,
19521952 exeContext : ExecutionContext ,
19531953 fieldGroup : FieldGroup ,
19541954 info : GraphQLResolveInfo ,
@@ -1958,9 +1958,9 @@ async function executeStreamAsyncIteratorItem(
19581958) : Promise < IteratorResult < unknown > > {
19591959 let item ;
19601960 try {
1961- const { value, done } = await iterator . next ( ) ;
1961+ const { value, done } = await asyncIterator . next ( ) ;
19621962 if ( done ) {
1963- asyncPayloadRecord . setIsCompletedIterator ( ) ;
1963+ asyncPayloadRecord . setIsCompletedAsyncIterator ( ) ;
19641964 return { done, value : undefined } ;
19651965 }
19661966 item = value ;
@@ -1973,7 +1973,7 @@ async function executeStreamAsyncIteratorItem(
19731973 itemPath ,
19741974 asyncPayloadRecord ,
19751975 ) ;
1976- // don't continue if iterator throws
1976+ // don't continue if async iterator throws
19771977 return { done : true , value : null } ;
19781978 }
19791979 let completedItem ;
@@ -2019,7 +2019,7 @@ async function executeStreamAsyncIteratorItem(
20192019
20202020async function executeStreamAsyncIterator (
20212021 initialIndex : number ,
2022- iterator : AsyncIterator < unknown > ,
2022+ asyncIterator : AsyncIterator < unknown > ,
20232023 exeContext : ExecutionContext ,
20242024 fieldGroup : FieldGroup ,
20252025 info : GraphQLResolveInfo ,
@@ -2037,15 +2037,15 @@ async function executeStreamAsyncIterator(
20372037 label,
20382038 path : itemPath ,
20392039 parentContext : previousAsyncPayloadRecord ,
2040- iterator ,
2040+ asyncIterator ,
20412041 exeContext,
20422042 } ) ;
20432043
20442044 let iteration ;
20452045 try {
20462046 // eslint-disable-next-line no-await-in-loop
20472047 iteration = await executeStreamAsyncIteratorItem (
2048- iterator ,
2048+ asyncIterator ,
20492049 exeContext ,
20502050 fieldGroup ,
20512051 info ,
@@ -2058,8 +2058,8 @@ async function executeStreamAsyncIterator(
20582058 filterSubsequentPayloads ( exeContext , path , asyncPayloadRecord ) ;
20592059 asyncPayloadRecord . addItems ( null ) ;
20602060 // entire stream has errored and bubbled upwards
2061- if ( iterator ?. return ) {
2062- iterator . return ( ) . catch ( ( ) => {
2061+ if ( asyncIterator ?. return ) {
2062+ asyncIterator . return ( ) . catch ( ( ) => {
20632063 // ignore errors
20642064 } ) ;
20652065 }
@@ -2110,8 +2110,8 @@ function filterSubsequentPayloads(
21102110 }
21112111 }
21122112 // asyncRecord path points to nulled error field
2113- if ( isStreamPayload ( asyncRecord ) && asyncRecord . iterator ?. return ) {
2114- asyncRecord . iterator . return ( ) . catch ( ( ) => {
2113+ if ( isStreamPayload ( asyncRecord ) && asyncRecord . asyncIterator ?. return ) {
2114+ asyncRecord . asyncIterator . return ( ) . catch ( ( ) => {
21152115 // ignore error
21162116 } ) ;
21172117 }
@@ -2131,7 +2131,7 @@ function getCompletedIncrementalResults(
21312131 exeContext . subsequentPayloads . delete ( asyncPayloadRecord ) ;
21322132 if ( isStreamPayload ( asyncPayloadRecord ) ) {
21332133 const items = asyncPayloadRecord . items ;
2134- if ( asyncPayloadRecord . isCompletedIterator ) {
2134+ if ( asyncPayloadRecord . isCompletedAsyncIterator ) {
21352135 // async iterable resolver just finished but there may be pending payloads
21362136 continue ;
21372137 }
@@ -2196,9 +2196,9 @@ function yieldSubsequentPayloads(
21962196 exeContext . subsequentPayloads . forEach ( ( asyncPayloadRecord ) => {
21972197 if (
21982198 isStreamPayload ( asyncPayloadRecord ) &&
2199- asyncPayloadRecord . iterator ?. return
2199+ asyncPayloadRecord . asyncIterator ?. return
22002200 ) {
2201- promises . push ( asyncPayloadRecord . iterator . return ( ) ) ;
2201+ promises . push ( asyncPayloadRecord . asyncIterator . return ( ) ) ;
22022202 }
22032203 } ) ;
22042204 return Promise . all ( promises ) ;
@@ -2280,15 +2280,15 @@ class StreamRecord {
22802280 items : Array < unknown > | null ;
22812281 promise : Promise < void > ;
22822282 parentContext : AsyncPayloadRecord | undefined ;
2283- iterator : AsyncIterator < unknown > | undefined ;
2284- isCompletedIterator ?: boolean ;
2283+ asyncIterator : AsyncIterator < unknown > | undefined ;
2284+ isCompletedAsyncIterator ?: boolean ;
22852285 isCompleted : boolean ;
22862286 _exeContext : ExecutionContext ;
22872287 _resolve ?: ( arg : PromiseOrValue < Array < unknown > | null > ) => void ;
22882288 constructor ( opts : {
22892289 label : string | undefined ;
22902290 path : Path | undefined ;
2291- iterator ?: AsyncIterator < unknown > ;
2291+ asyncIterator ?: AsyncIterator < unknown > ;
22922292 parentContext : AsyncPayloadRecord | undefined ;
22932293 exeContext : ExecutionContext ;
22942294 } ) {
@@ -2297,7 +2297,7 @@ class StreamRecord {
22972297 this . label = opts . label ;
22982298 this . path = pathToArray ( opts . path ) ;
22992299 this . parentContext = opts . parentContext ;
2300- this . iterator = opts . iterator ;
2300+ this . asyncIterator = opts . asyncIterator ;
23012301 this . errors = [ ] ;
23022302 this . _exeContext = opts . exeContext ;
23032303 this . _exeContext . subsequentPayloads . add ( this ) ;
@@ -2322,8 +2322,8 @@ class StreamRecord {
23222322 this . _resolve ?.( items ) ;
23232323 }
23242324
2325- setIsCompletedIterator ( ) {
2326- this . isCompletedIterator = true ;
2325+ setIsCompletedAsyncIterator ( ) {
2326+ this . isCompletedAsyncIterator = true ;
23272327 }
23282328}
23292329
0 commit comments