@@ -48,6 +48,7 @@ import { GraphQLStreamDirective } from '../type/directives.js';
4848import type { GraphQLSchema } from '../type/schema.js' ;
4949import { assertValidSchema } from '../type/validate.js' ;
5050
51+ import { AbortSignalListener } from './AbortSignalListener.js' ;
5152import type { DeferUsageSet , ExecutionPlan } from './buildExecutionPlan.js' ;
5253import { buildExecutionPlan } from './buildExecutionPlan.js' ;
5354import type {
@@ -63,7 +64,6 @@ import {
6364import { getVariableSignature } from './getVariableSignature.js' ;
6465import { buildIncrementalResponse } from './IncrementalPublisher.js' ;
6566import { mapAsyncIterable } from './mapAsyncIterable.js' ;
66- import { PromiseCanceller } from './PromiseCanceller.js' ;
6767import type {
6868 CancellableStreamRecord ,
6969 CompletedExecutionGroup ,
@@ -164,7 +164,7 @@ export interface ValidatedExecutionArgs {
164164export interface ExecutionContext {
165165 validatedExecutionArgs : ValidatedExecutionArgs ;
166166 errors : Array < GraphQLError > | undefined ;
167- promiseCanceller : PromiseCanceller | undefined ;
167+ abortSignalListener : AbortSignalListener | undefined ;
168168 completed : boolean ;
169169 cancellableStreams : Set < CancellableStreamRecord > | undefined ;
170170}
@@ -318,8 +318,8 @@ export function experimentalExecuteQueryOrMutationOrSubscriptionEvent(
318318 const exeContext : ExecutionContext = {
319319 validatedExecutionArgs,
320320 errors : undefined ,
321- promiseCanceller : abortSignal
322- ? new PromiseCanceller ( abortSignal )
321+ abortSignalListener : abortSignal
322+ ? new AbortSignalListener ( abortSignal )
323323 : undefined ,
324324 completed : false ,
325325 cancellableStreams : undefined ,
@@ -378,7 +378,7 @@ export function experimentalExecuteQueryOrMutationOrSubscriptionEvent(
378378 } ,
379379 ( error : unknown ) => {
380380 exeContext . completed = true ;
381- exeContext . promiseCanceller ?. disconnect ( ) ;
381+ exeContext . abortSignalListener ?. disconnect ( ) ;
382382 return {
383383 data : null ,
384384 errors : withError ( exeContext . errors , error as GraphQLError ) ,
@@ -392,7 +392,7 @@ export function experimentalExecuteQueryOrMutationOrSubscriptionEvent(
392392 exeContext . completed = true ;
393393 // TODO: add test case for synchronous null bubbling to root with cancellation
394394 /* c8 ignore next */
395- exeContext . promiseCanceller ?. disconnect ( ) ;
395+ exeContext . abortSignalListener ?. disconnect ( ) ;
396396 return { data : null , errors : withError ( exeContext . errors , error ) } ;
397397 }
398398}
@@ -483,7 +483,7 @@ function buildDataResponse(
483483 const { rawResult : data , incrementalDataRecords } = graphqlWrappedResult ;
484484 const errors = exeContext . errors ;
485485 if ( incrementalDataRecords === undefined ) {
486- exeContext . promiseCanceller ?. disconnect ( ) ;
486+ exeContext . abortSignalListener ?. disconnect ( ) ;
487487 return errors !== undefined ? { errors, data } : { data } ;
488488 }
489489
@@ -834,7 +834,7 @@ function executeField(
834834 incrementalContext : IncrementalContext | undefined ,
835835 deferMap : ReadonlyMap < DeferUsage , DeferredFragmentRecord > | undefined ,
836836) : PromiseOrValue < GraphQLWrappedResult < unknown > > | undefined {
837- const { validatedExecutionArgs, promiseCanceller } = exeContext ;
837+ const { validatedExecutionArgs, abortSignalListener } = exeContext ;
838838 const { schema, contextValue, variableValues, hideSuggestions, abortSignal } =
839839 validatedExecutionArgs ;
840840 const fieldName = fieldDetailsList [ 0 ] . node . name . value ;
@@ -879,7 +879,7 @@ function executeField(
879879 fieldDetailsList ,
880880 info ,
881881 path ,
882- promiseCanceller ?. withCancellation ( result ) ?? result ,
882+ abortSignalListener ?. cancellablePromise ( result ) ?? result ,
883883 incrementalContext ,
884884 deferMap ,
885885 ) ;
@@ -1598,7 +1598,7 @@ async function completePromisedListItemValue(
15981598 deferMap : ReadonlyMap < DeferUsage , DeferredFragmentRecord > | undefined ,
15991599) : Promise < unknown > {
16001600 try {
1601- const resolved = await ( exeContext . promiseCanceller ?. withCancellation (
1601+ const resolved = await ( exeContext . abortSignalListener ?. cancellablePromise (
16021602 item ,
16031603 ) ?? item ) ;
16041604 let completed = completeValue (
@@ -2220,19 +2220,19 @@ function executeSubscription(
22202220 const result = resolveFn ( rootValue , args , contextValue , info , abortSignal ) ;
22212221
22222222 if ( isPromise ( result ) ) {
2223- const promiseCanceller = abortSignal
2224- ? new PromiseCanceller ( abortSignal )
2223+ const abortSignalListener = abortSignal
2224+ ? new AbortSignalListener ( abortSignal )
22252225 : undefined ;
2226- const promise = promiseCanceller ?. withCancellation ( result ) ?? result ;
2226+ const promise = abortSignalListener ?. cancellablePromise ( result ) ?? result ;
22272227 return promise . then ( assertEventStream ) . then (
22282228 ( resolved ) => {
22292229 // TODO: add test case
22302230 /* c8 ignore next */
2231- promiseCanceller ?. disconnect ( ) ;
2231+ abortSignalListener ?. disconnect ( ) ;
22322232 return resolved ;
22332233 } ,
22342234 ( error : unknown ) => {
2235- promiseCanceller ?. disconnect ( ) ;
2235+ abortSignalListener ?. disconnect ( ) ;
22362236 throw locatedError ( error , fieldNodes , pathToArray ( path ) ) ;
22372237 } ,
22382238 ) ;
@@ -2604,7 +2604,7 @@ function completeStreamItem(
26042604 fieldDetailsList ,
26052605 info ,
26062606 itemPath ,
2607- exeContext . promiseCanceller ?. withCancellation ( item ) ?? item ,
2607+ exeContext . abortSignalListener ?. cancellablePromise ( item ) ?? item ,
26082608 incrementalContext ,
26092609 new Map ( ) ,
26102610 ) . then (
0 commit comments