1
1
import { after } from '../jsutils/after.js' ;
2
- import { afterMaybeAsync } from '../jsutils/afterMaybeAsync.js' ;
3
- import { catchAfter } from '../jsutils/catchAfter.js' ;
4
2
import { inspect } from '../jsutils/inspect.js' ;
5
3
import { invariant } from '../jsutils/invariant.js' ;
6
4
import { isAsyncIterable } from '../jsutils/isAsyncIterable.js' ;
@@ -15,7 +13,6 @@ import { addPath, pathToArray } from '../jsutils/Path.js';
15
13
import { promiseForObject } from '../jsutils/promiseForObject.js' ;
16
14
import type { PromiseOrValue } from '../jsutils/PromiseOrValue.js' ;
17
15
import { promiseReduce } from '../jsutils/promiseReduce.js' ;
18
- import { tryAfter } from '../jsutils/tryAfter.js' ;
19
16
20
17
import type { GraphQLFormattedError } from '../error/GraphQLError.js' ;
21
18
import { GraphQLError } from '../error/GraphQLError.js' ;
@@ -349,7 +346,7 @@ function executeImpl(
349
346
try {
350
347
const result = executeOperation ( exeContext ) ;
351
348
if ( isPromise ( result ) ) {
352
- return tryAfter (
349
+ return after (
353
350
result ,
354
351
( data ) => {
355
352
const initialResult = buildResponse ( data , exeContext . errors ) ;
@@ -650,7 +647,7 @@ function executeFields(
650
647
}
651
648
} catch ( error ) {
652
649
if ( containsPromise ) {
653
- return tryAfter (
650
+ return after (
654
651
promiseForObject ( results ) ,
655
652
( ) => {
656
653
throw error ;
@@ -747,7 +744,7 @@ function executeField(
747
744
) ;
748
745
749
746
if ( isPromise ( completed ) ) {
750
- return catchAfter ( completed , ( rawError ) => {
747
+ return after ( completed , undefined , ( rawError ) => {
751
748
const error = locatedError ( rawError , fieldNodes , pathToArray ( path ) ) ;
752
749
const handledError = handleFieldError ( error , returnType , errors ) ;
753
750
filterSubsequentPayloads ( exeContext , path , asyncPayloadRecord ) ;
@@ -1221,7 +1218,7 @@ function completeListItemValue(
1221
1218
// Note: we don't rely on a `catch` method, but we do expect "thenable"
1222
1219
// to take a second callback for the error case.
1223
1220
completedResults . push (
1224
- catchAfter ( completedItem , ( rawError ) => {
1221
+ after ( completedItem , undefined , ( rawError ) => {
1225
1222
const error = locatedError (
1226
1223
rawError ,
1227
1224
fieldNodes ,
@@ -1283,7 +1280,7 @@ function completeAbstractValue(
1283
1280
const runtimeType = resolveTypeFn ( result , contextValue , info , returnType ) ;
1284
1281
1285
1282
if ( isPromise ( runtimeType ) ) {
1286
- return afterMaybeAsync ( runtimeType , ( resolvedRuntimeType ) =>
1283
+ return after ( runtimeType , ( resolvedRuntimeType ) =>
1287
1284
completeObjectValue (
1288
1285
exeContext ,
1289
1286
ensureValidRuntimeType (
@@ -1395,7 +1392,7 @@ function completeObjectValue(
1395
1392
const isTypeOf = returnType . isTypeOf ( result , exeContext . contextValue , info ) ;
1396
1393
1397
1394
if ( isPromise ( isTypeOf ) ) {
1398
- return afterMaybeAsync ( isTypeOf , ( resolvedIsTypeOf ) => {
1395
+ return after ( isTypeOf , ( resolvedIsTypeOf ) => {
1399
1396
if ( ! resolvedIsTypeOf ) {
1400
1397
throw invalidReturnTypeError ( returnType , result , fieldNodes ) ;
1401
1398
}
@@ -1765,7 +1762,7 @@ function createSourceEventStreamImpl(
1765
1762
try {
1766
1763
const eventStream = executeSubscription ( exeContext ) ;
1767
1764
if ( isPromise ( eventStream ) ) {
1768
- return catchAfter ( eventStream , ( error ) => ( { errors : [ error ] } ) ) ;
1765
+ return after ( eventStream , undefined , ( error ) => ( { errors : [ error ] } ) ) ;
1769
1766
}
1770
1767
1771
1768
return eventStream ;
@@ -1836,7 +1833,7 @@ function executeSubscription(
1836
1833
const result = resolveFn ( rootValue , args , contextValue , info ) ;
1837
1834
1838
1835
if ( isPromise ( result ) ) {
1839
- return tryAfter ( result , assertEventStream , ( error ) => {
1836
+ return after ( result , assertEventStream , ( error ) => {
1840
1837
throw locatedError ( error , fieldNodes , pathToArray ( path ) ) ;
1841
1838
} ) ;
1842
1839
}
@@ -1890,7 +1887,7 @@ function executeDeferredFragment(
1890
1887
) ;
1891
1888
1892
1889
if ( isPromise ( promiseOrData ) ) {
1893
- promiseOrData = catchAfter ( promiseOrData , ( error ) => {
1890
+ promiseOrData = after ( promiseOrData , undefined , ( error ) => {
1894
1891
asyncPayloadRecord . errors . push ( error ) ;
1895
1892
return null ;
1896
1893
} ) ;
@@ -1929,7 +1926,7 @@ function executeStreamField(
1929
1926
item ,
1930
1927
asyncPayloadRecord ,
1931
1928
) ;
1932
- const completedItems = tryAfter (
1929
+ const completedItems = after (
1933
1930
completedItem ,
1934
1931
( resolved ) => [ resolved ] ,
1935
1932
( error ) => {
@@ -1972,7 +1969,7 @@ function executeStreamField(
1972
1969
}
1973
1970
1974
1971
if ( isPromise ( completedItem ) ) {
1975
- const completedItems = tryAfter (
1972
+ const completedItems = after (
1976
1973
completedItem ,
1977
1974
( resolved ) => [ resolved ] ,
1978
1975
( rawError ) => {
@@ -2041,7 +2038,7 @@ async function executeStreamIteratorItem(
2041
2038
) ;
2042
2039
2043
2040
if ( isPromise ( completedItem ) ) {
2044
- completedItem = catchAfter ( completedItem , ( rawError ) => {
2041
+ completedItem = after ( completedItem , undefined , ( rawError ) => {
2045
2042
const error = locatedError ( rawError , fieldNodes , pathToArray ( itemPath ) ) ;
2046
2043
const handledError = handleFieldError (
2047
2044
error ,
@@ -2115,7 +2112,7 @@ async function executeStreamIterator(
2115
2112
2116
2113
let completedItems : PromiseOrValue < Array < unknown > | null > ;
2117
2114
if ( isPromise ( completedItem ) ) {
2118
- completedItems = tryAfter (
2115
+ completedItems = after (
2119
2116
completedItem ,
2120
2117
( resolved ) => [ resolved ] ,
2121
2118
( error ) => {
@@ -2315,7 +2312,7 @@ class DeferredFragmentRecord {
2315
2312
addData ( data : PromiseOrValue < ObjMap < unknown > | null > ) {
2316
2313
const parentData = this . parentContext ?. promise ;
2317
2314
if ( parentData ) {
2318
- this . _resolve ?.( afterMaybeAsync ( parentData , ( ) => data ) ) ;
2315
+ this . _resolve ?.( after ( parentData , ( ) => data ) ) ;
2319
2316
return ;
2320
2317
}
2321
2318
this . _resolve ?.( data ) ;
@@ -2369,7 +2366,7 @@ class StreamRecord {
2369
2366
addItems ( items : PromiseOrValue < Array < unknown > | null > ) {
2370
2367
const parentData = this . parentContext ?. promise ;
2371
2368
if ( parentData ) {
2372
- this . _resolve ?.( afterMaybeAsync ( parentData , ( ) => items ) ) ;
2369
+ this . _resolve ?.( after ( parentData , ( ) => items ) ) ;
2373
2370
return ;
2374
2371
}
2375
2372
this . _resolve ?.( items ) ;
0 commit comments