@@ -1055,7 +1055,7 @@ async function completeAsyncIteratorValue(
1055
1055
fieldGroup : FieldGroup ,
1056
1056
info : GraphQLResolveInfo ,
1057
1057
path : Path ,
1058
- iterator : AsyncIterator < unknown > ,
1058
+ asyncIterator : AsyncIterator < unknown > ,
1059
1059
asyncPayloadRecord : AsyncPayloadRecord | undefined ,
1060
1060
) : Promise < ReadonlyArray < unknown > > {
1061
1061
const stream = getStreamValues ( exeContext , fieldGroup , path ) ;
@@ -1072,7 +1072,7 @@ async function completeAsyncIteratorValue(
1072
1072
// eslint-disable-next-line @typescript-eslint/no-floating-promises
1073
1073
executeStreamAsyncIterator (
1074
1074
index ,
1075
- iterator ,
1075
+ asyncIterator ,
1076
1076
exeContext ,
1077
1077
fieldGroup ,
1078
1078
info ,
@@ -1088,7 +1088,7 @@ async function completeAsyncIteratorValue(
1088
1088
let iteration ;
1089
1089
try {
1090
1090
// eslint-disable-next-line no-await-in-loop
1091
- iteration = await iterator . next ( ) ;
1091
+ iteration = await asyncIterator . next ( ) ;
1092
1092
if ( iteration . done ) {
1093
1093
break ;
1094
1094
}
@@ -1140,15 +1140,15 @@ function completeListValue(
1140
1140
const itemType = returnType . ofType ;
1141
1141
1142
1142
if ( isAsyncIterable ( result ) ) {
1143
- const iterator = result [ Symbol . asyncIterator ] ( ) ;
1143
+ const asyncIterator = result [ Symbol . asyncIterator ] ( ) ;
1144
1144
1145
1145
return completeAsyncIteratorValue (
1146
1146
exeContext ,
1147
1147
itemType ,
1148
1148
fieldGroup ,
1149
1149
info ,
1150
1150
path ,
1151
- iterator ,
1151
+ asyncIterator ,
1152
1152
asyncPayloadRecord ,
1153
1153
) ;
1154
1154
}
@@ -1948,7 +1948,7 @@ function executeStreamField(
1948
1948
}
1949
1949
1950
1950
async function executeStreamAsyncIteratorItem (
1951
- iterator : AsyncIterator < unknown > ,
1951
+ asyncIterator : AsyncIterator < unknown > ,
1952
1952
exeContext : ExecutionContext ,
1953
1953
fieldGroup : FieldGroup ,
1954
1954
info : GraphQLResolveInfo ,
@@ -1958,9 +1958,9 @@ async function executeStreamAsyncIteratorItem(
1958
1958
) : Promise < IteratorResult < unknown > > {
1959
1959
let item ;
1960
1960
try {
1961
- const { value, done } = await iterator . next ( ) ;
1961
+ const { value, done } = await asyncIterator . next ( ) ;
1962
1962
if ( done ) {
1963
- asyncPayloadRecord . setIsCompletedIterator ( ) ;
1963
+ asyncPayloadRecord . setIsCompletedAsyncIterator ( ) ;
1964
1964
return { done, value : undefined } ;
1965
1965
}
1966
1966
item = value ;
@@ -1973,7 +1973,7 @@ async function executeStreamAsyncIteratorItem(
1973
1973
itemPath ,
1974
1974
asyncPayloadRecord ,
1975
1975
) ;
1976
- // don't continue if iterator throws
1976
+ // don't continue if async iterator throws
1977
1977
return { done : true , value : null } ;
1978
1978
}
1979
1979
let completedItem ;
@@ -2019,7 +2019,7 @@ async function executeStreamAsyncIteratorItem(
2019
2019
2020
2020
async function executeStreamAsyncIterator (
2021
2021
initialIndex : number ,
2022
- iterator : AsyncIterator < unknown > ,
2022
+ asyncIterator : AsyncIterator < unknown > ,
2023
2023
exeContext : ExecutionContext ,
2024
2024
fieldGroup : FieldGroup ,
2025
2025
info : GraphQLResolveInfo ,
@@ -2037,15 +2037,15 @@ async function executeStreamAsyncIterator(
2037
2037
label,
2038
2038
path : itemPath ,
2039
2039
parentContext : previousAsyncPayloadRecord ,
2040
- iterator ,
2040
+ asyncIterator ,
2041
2041
exeContext,
2042
2042
} ) ;
2043
2043
2044
2044
let iteration ;
2045
2045
try {
2046
2046
// eslint-disable-next-line no-await-in-loop
2047
2047
iteration = await executeStreamAsyncIteratorItem (
2048
- iterator ,
2048
+ asyncIterator ,
2049
2049
exeContext ,
2050
2050
fieldGroup ,
2051
2051
info ,
@@ -2058,8 +2058,8 @@ async function executeStreamAsyncIterator(
2058
2058
filterSubsequentPayloads ( exeContext , path , asyncPayloadRecord ) ;
2059
2059
asyncPayloadRecord . addItems ( null ) ;
2060
2060
// entire stream has errored and bubbled upwards
2061
- if ( iterator ?. return ) {
2062
- iterator . return ( ) . catch ( ( ) => {
2061
+ if ( asyncIterator ?. return ) {
2062
+ asyncIterator . return ( ) . catch ( ( ) => {
2063
2063
// ignore errors
2064
2064
} ) ;
2065
2065
}
@@ -2110,8 +2110,8 @@ function filterSubsequentPayloads(
2110
2110
}
2111
2111
}
2112
2112
// 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 ( ( ) => {
2115
2115
// ignore error
2116
2116
} ) ;
2117
2117
}
@@ -2131,7 +2131,7 @@ function getCompletedIncrementalResults(
2131
2131
exeContext . subsequentPayloads . delete ( asyncPayloadRecord ) ;
2132
2132
if ( isStreamPayload ( asyncPayloadRecord ) ) {
2133
2133
const items = asyncPayloadRecord . items ;
2134
- if ( asyncPayloadRecord . isCompletedIterator ) {
2134
+ if ( asyncPayloadRecord . isCompletedAsyncIterator ) {
2135
2135
// async iterable resolver just finished but there may be pending payloads
2136
2136
continue ;
2137
2137
}
@@ -2196,9 +2196,9 @@ function yieldSubsequentPayloads(
2196
2196
exeContext . subsequentPayloads . forEach ( ( asyncPayloadRecord ) => {
2197
2197
if (
2198
2198
isStreamPayload ( asyncPayloadRecord ) &&
2199
- asyncPayloadRecord . iterator ?. return
2199
+ asyncPayloadRecord . asyncIterator ?. return
2200
2200
) {
2201
- promises . push ( asyncPayloadRecord . iterator . return ( ) ) ;
2201
+ promises . push ( asyncPayloadRecord . asyncIterator . return ( ) ) ;
2202
2202
}
2203
2203
} ) ;
2204
2204
return Promise . all ( promises ) ;
@@ -2280,15 +2280,15 @@ class StreamRecord {
2280
2280
items : Array < unknown > | null ;
2281
2281
promise : Promise < void > ;
2282
2282
parentContext : AsyncPayloadRecord | undefined ;
2283
- iterator : AsyncIterator < unknown > | undefined ;
2284
- isCompletedIterator ?: boolean ;
2283
+ asyncIterator : AsyncIterator < unknown > | undefined ;
2284
+ isCompletedAsyncIterator ?: boolean ;
2285
2285
isCompleted : boolean ;
2286
2286
_exeContext : ExecutionContext ;
2287
2287
_resolve ?: ( arg : PromiseOrValue < Array < unknown > | null > ) => void ;
2288
2288
constructor ( opts : {
2289
2289
label : string | undefined ;
2290
2290
path : Path | undefined ;
2291
- iterator ?: AsyncIterator < unknown > ;
2291
+ asyncIterator ?: AsyncIterator < unknown > ;
2292
2292
parentContext : AsyncPayloadRecord | undefined ;
2293
2293
exeContext : ExecutionContext ;
2294
2294
} ) {
@@ -2297,7 +2297,7 @@ class StreamRecord {
2297
2297
this . label = opts . label ;
2298
2298
this . path = pathToArray ( opts . path ) ;
2299
2299
this . parentContext = opts . parentContext ;
2300
- this . iterator = opts . iterator ;
2300
+ this . asyncIterator = opts . asyncIterator ;
2301
2301
this . errors = [ ] ;
2302
2302
this . _exeContext = opts . exeContext ;
2303
2303
this . _exeContext . subsequentPayloads . add ( this ) ;
@@ -2322,8 +2322,8 @@ class StreamRecord {
2322
2322
this . _resolve ?.( items ) ;
2323
2323
}
2324
2324
2325
- setIsCompletedIterator ( ) {
2326
- this . isCompletedIterator = true ;
2325
+ setIsCompletedAsyncIterator ( ) {
2326
+ this . isCompletedAsyncIterator = true ;
2327
2327
}
2328
2328
}
2329
2329
0 commit comments