@@ -1101,19 +1101,17 @@ async function completeAsyncIteratorValue(
1101
1101
/* c8 ignore start */
1102
1102
if ( isPromise ( item ) ) {
1103
1103
completedResults . push (
1104
- completePromisedValue (
1104
+ completePromisedListItemValue (
1105
+ item ,
1106
+ graphqlWrappedResult ,
1105
1107
exeContext ,
1106
1108
itemType ,
1107
1109
fieldGroup ,
1108
1110
info ,
1109
1111
itemPath ,
1110
- item ,
1111
1112
incrementalContext ,
1112
1113
deferMap ,
1113
- ) . then ( ( resolved ) => {
1114
- graphqlWrappedResult [ 1 ] . push ( ...resolved [ 1 ] ) ;
1115
- return resolved [ 0 ] ;
1116
- } ) ,
1114
+ ) ,
1117
1115
) ;
1118
1116
containsPromise = true ;
1119
1117
} else if (
@@ -1226,19 +1224,17 @@ function completeListValue(
1226
1224
1227
1225
if ( isPromise ( item ) ) {
1228
1226
completedResults . push (
1229
- completePromisedValue (
1227
+ completePromisedListItemValue (
1228
+ item ,
1229
+ graphqlWrappedResult ,
1230
1230
exeContext ,
1231
1231
itemType ,
1232
1232
fieldGroup ,
1233
1233
info ,
1234
1234
itemPath ,
1235
- item ,
1236
1235
incrementalContext ,
1237
1236
deferMap ,
1238
- ) . then ( ( resolved ) => {
1239
- graphqlWrappedResult [ 1 ] . push ( ...resolved [ 1 ] ) ;
1240
- return resolved [ 0 ] ;
1241
- } ) ,
1237
+ ) ,
1242
1238
) ;
1243
1239
containsPromise = true ;
1244
1240
} else if (
@@ -1328,6 +1324,41 @@ function completeListItemValue(
1328
1324
return false ;
1329
1325
}
1330
1326
1327
+ async function completePromisedListItemValue (
1328
+ item : unknown ,
1329
+ parent : GraphQLWrappedResult < Array < unknown > > ,
1330
+ exeContext : ExecutionContext ,
1331
+ itemType : GraphQLOutputType ,
1332
+ fieldGroup : FieldGroup ,
1333
+ info : GraphQLResolveInfo ,
1334
+ itemPath : Path ,
1335
+ incrementalContext : IncrementalContext | undefined ,
1336
+ deferMap : ReadonlyMap < DeferUsage , DeferredFragmentRecord > | undefined ,
1337
+ ) : Promise < unknown > {
1338
+ try {
1339
+ const resolved = await item ;
1340
+ let completed = completeValue (
1341
+ exeContext ,
1342
+ itemType ,
1343
+ fieldGroup ,
1344
+ info ,
1345
+ itemPath ,
1346
+ resolved ,
1347
+ incrementalContext ,
1348
+ deferMap ,
1349
+ ) ;
1350
+ if ( isPromise ( completed ) ) {
1351
+ completed = await completed ;
1352
+ }
1353
+ parent [ 1 ] . push ( ...completed [ 1 ] ) ;
1354
+ return completed [ 0 ] ;
1355
+ } catch ( rawError ) {
1356
+ const errors = ( incrementalContext ?? exeContext ) . errors ;
1357
+ handleFieldError ( rawError , itemType , fieldGroup , itemPath , errors ) ;
1358
+ return null ;
1359
+ }
1360
+ }
1361
+
1331
1362
/**
1332
1363
* Complete a Scalar or Enum by serializing to a valid value, returning
1333
1364
* null if serialization is not possible.
0 commit comments