@@ -1087,7 +1087,7 @@ async function completeAsyncIteratorValue(
1087
1087
fieldGroup : FieldGroup ,
1088
1088
info : GraphQLResolveInfo ,
1089
1089
path : Path ,
1090
- iterator : AsyncIterator < unknown > ,
1090
+ asyncIterator : AsyncIterator < unknown > ,
1091
1091
asyncPayloadRecord ?: AsyncPayloadRecord ,
1092
1092
) : Promise < ReadonlyArray < unknown > > {
1093
1093
const errors = asyncPayloadRecord ?. errors ?? exeContext . errors ;
@@ -1103,9 +1103,9 @@ async function completeAsyncIteratorValue(
1103
1103
index >= stream . initialCount
1104
1104
) {
1105
1105
// eslint-disable-next-line @typescript-eslint/no-floating-promises
1106
- executeStreamIterator (
1106
+ executeStreamAsyncIterator (
1107
1107
index ,
1108
- iterator ,
1108
+ asyncIterator ,
1109
1109
exeContext ,
1110
1110
fieldGroup ,
1111
1111
info ,
@@ -1120,7 +1120,7 @@ async function completeAsyncIteratorValue(
1120
1120
let iteration ;
1121
1121
try {
1122
1122
// eslint-disable-next-line no-await-in-loop
1123
- iteration = await iterator . next ( ) ;
1123
+ iteration = await asyncIterator . next ( ) ;
1124
1124
if ( iteration . done ) {
1125
1125
break ;
1126
1126
}
@@ -1989,8 +1989,8 @@ function executeStreamField(
1989
1989
return asyncPayloadRecord ;
1990
1990
}
1991
1991
1992
- async function executeStreamIteratorItem (
1993
- iterator : AsyncIterator < unknown > ,
1992
+ async function executeStreamAsyncIteratorItem (
1993
+ asyncIterator : AsyncIterator < unknown > ,
1994
1994
exeContext : ExecutionContext ,
1995
1995
fieldGroup : FieldGroup ,
1996
1996
info : GraphQLResolveInfo ,
@@ -2000,9 +2000,9 @@ async function executeStreamIteratorItem(
2000
2000
) : Promise < IteratorResult < unknown > > {
2001
2001
let item ;
2002
2002
try {
2003
- const { value, done } = await iterator . next ( ) ;
2003
+ const { value, done } = await asyncIterator . next ( ) ;
2004
2004
if ( done ) {
2005
- asyncPayloadRecord . setIsCompletedIterator ( ) ;
2005
+ asyncPayloadRecord . setIsCompletedAsyncIterator ( ) ;
2006
2006
return { done, value : undefined } ;
2007
2007
}
2008
2008
item = value ;
@@ -2057,9 +2057,9 @@ async function executeStreamIteratorItem(
2057
2057
}
2058
2058
}
2059
2059
2060
- async function executeStreamIterator (
2060
+ async function executeStreamAsyncIterator (
2061
2061
initialIndex : number ,
2062
- iterator : AsyncIterator < unknown > ,
2062
+ asyncIterator : AsyncIterator < unknown > ,
2063
2063
exeContext : ExecutionContext ,
2064
2064
fieldGroup : FieldGroup ,
2065
2065
info : GraphQLResolveInfo ,
@@ -2077,15 +2077,15 @@ async function executeStreamIterator(
2077
2077
path : itemPath ,
2078
2078
deferDepth,
2079
2079
parentContext : previousAsyncPayloadRecord ,
2080
- iterator ,
2080
+ asyncIterator ,
2081
2081
exeContext,
2082
2082
} ) ;
2083
2083
2084
2084
let iteration ;
2085
2085
try {
2086
2086
// eslint-disable-next-line no-await-in-loop
2087
- iteration = await executeStreamIteratorItem (
2088
- iterator ,
2087
+ iteration = await executeStreamAsyncIteratorItem (
2088
+ asyncIterator ,
2089
2089
exeContext ,
2090
2090
fieldGroup ,
2091
2091
info ,
@@ -2098,8 +2098,8 @@ async function executeStreamIterator(
2098
2098
filterSubsequentPayloads ( exeContext , path , asyncPayloadRecord ) ;
2099
2099
asyncPayloadRecord . addItems ( null ) ;
2100
2100
// entire stream has errored and bubbled upwards
2101
- if ( iterator ?. return ) {
2102
- iterator . return ( ) . catch ( ( ) => {
2101
+ if ( asyncIterator ?. return ) {
2102
+ asyncIterator . return ( ) . catch ( ( ) => {
2103
2103
// ignore errors
2104
2104
} ) ;
2105
2105
}
@@ -2150,8 +2150,8 @@ function filterSubsequentPayloads(
2150
2150
}
2151
2151
}
2152
2152
// asyncRecord path points to nulled error field
2153
- if ( isStreamPayload ( asyncRecord ) && asyncRecord . iterator ?. return ) {
2154
- asyncRecord . iterator . return ( ) . catch ( ( ) => {
2153
+ if ( isStreamPayload ( asyncRecord ) && asyncRecord . asyncIterator ?. return ) {
2154
+ asyncRecord . asyncIterator . return ( ) . catch ( ( ) => {
2155
2155
// ignore error
2156
2156
} ) ;
2157
2157
}
@@ -2171,7 +2171,7 @@ function getCompletedIncrementalResults(
2171
2171
exeContext . subsequentPayloads . delete ( asyncPayloadRecord ) ;
2172
2172
if ( isStreamPayload ( asyncPayloadRecord ) ) {
2173
2173
const items = asyncPayloadRecord . items ;
2174
- if ( asyncPayloadRecord . isCompletedIterator ) {
2174
+ if ( asyncPayloadRecord . isCompletedAsyncIterator ) {
2175
2175
// async iterable resolver just finished but there may be pending payloads
2176
2176
continue ;
2177
2177
}
@@ -2233,9 +2233,9 @@ function yieldSubsequentPayloads(
2233
2233
exeContext . subsequentPayloads . forEach ( ( asyncPayloadRecord ) => {
2234
2234
if (
2235
2235
isStreamPayload ( asyncPayloadRecord ) &&
2236
- asyncPayloadRecord . iterator ?. return
2236
+ asyncPayloadRecord . asyncIterator ?. return
2237
2237
) {
2238
- promises . push ( asyncPayloadRecord . iterator . return ( ) ) ;
2238
+ promises . push ( asyncPayloadRecord . asyncIterator . return ( ) ) ;
2239
2239
}
2240
2240
} ) ;
2241
2241
return Promise . all ( promises ) ;
@@ -2317,15 +2317,15 @@ class StreamRecord {
2317
2317
items : Array < unknown > | null ;
2318
2318
promise : Promise < void > ;
2319
2319
parentContext : AsyncPayloadRecord | undefined ;
2320
- iterator : AsyncIterator < unknown > | undefined ;
2321
- isCompletedIterator ?: boolean ;
2320
+ asyncIterator : AsyncIterator < unknown > | undefined ;
2321
+ isCompletedAsyncIterator ?: boolean ;
2322
2322
isCompleted : boolean ;
2323
2323
_exeContext : ExecutionContext ;
2324
2324
_resolve ?: ( arg : PromiseOrValue < Array < unknown > | null > ) => void ;
2325
2325
constructor ( opts : {
2326
2326
path : Path | undefined ;
2327
2327
deferDepth : number | undefined ;
2328
- iterator ?: AsyncIterator < unknown > ;
2328
+ asyncIterator ?: AsyncIterator < unknown > ;
2329
2329
parentContext : AsyncPayloadRecord | undefined ;
2330
2330
exeContext : ExecutionContext ;
2331
2331
} ) {
@@ -2334,7 +2334,7 @@ class StreamRecord {
2334
2334
this . path = pathToArray ( opts . path ) ;
2335
2335
this . deferDepth = opts . deferDepth ;
2336
2336
this . parentContext = opts . parentContext ;
2337
- this . iterator = opts . iterator ;
2337
+ this . asyncIterator = opts . asyncIterator ;
2338
2338
this . errors = [ ] ;
2339
2339
this . _exeContext = opts . exeContext ;
2340
2340
this . _exeContext . subsequentPayloads . add ( this ) ;
@@ -2359,8 +2359,8 @@ class StreamRecord {
2359
2359
this . _resolve ?.( items ) ;
2360
2360
}
2361
2361
2362
- setIsCompletedIterator ( ) {
2363
- this . isCompletedIterator = true ;
2362
+ setIsCompletedAsyncIterator ( ) {
2363
+ this . isCompletedAsyncIterator = true ;
2364
2364
}
2365
2365
}
2366
2366
0 commit comments