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