@@ -93,15 +93,15 @@ export interface FormattedSubsequentIncrementalExecutionResult<
9393  extensions ?: TExtensions ; 
9494} 
9595
96- interface  RawDeferResult < TData  =  ObjMap < unknown > >  { 
96+ interface  BareDeferredGroupedFieldSetResult < TData  =  ObjMap < unknown > >  { 
9797  errors ?: ReadonlyArray < GraphQLError > ; 
9898  data : TData ; 
9999} 
100100
101101export  interface  IncrementalDeferResult < 
102102  TData  =  ObjMap < unknown > , 
103103  TExtensions  =  ObjMap < unknown > , 
104- >  extends  RawDeferResult < TData >  { 
104+ >  extends  BareDeferredGroupedFieldSetResult < TData >  { 
105105  id : string ; 
106106  subPath ?: ReadonlyArray < string  |  number > ; 
107107  extensions ?: TExtensions ; 
@@ -118,15 +118,15 @@ export interface FormattedIncrementalDeferResult<
118118  extensions ?: TExtensions ; 
119119} 
120120
121- interface  RawStreamItemsResult < TData  =  ReadonlyArray < unknown > >  { 
121+ interface  BareStreamItemsResult < TData  =  ReadonlyArray < unknown > >  { 
122122  errors ?: ReadonlyArray < GraphQLError > ; 
123123  items : TData ; 
124124} 
125125
126126export  interface  IncrementalStreamResult < 
127127  TData  =  ReadonlyArray < unknown > , 
128128  TExtensions  =  ObjMap < unknown > , 
129- >  extends  RawStreamItemsResult < TData >  { 
129+ >  extends  BareStreamItemsResult < TData >  { 
130130  id : string ; 
131131  subPath ?: ReadonlyArray < string  |  number > ; 
132132  extensions ?: TExtensions ; 
@@ -175,10 +175,14 @@ export function buildIncrementalResponse(
175175  context : IncrementalPublisherContext , 
176176  result : ObjMap < unknown > , 
177177  errors : ReadonlyArray < GraphQLError >  |  undefined , 
178-   futures : ReadonlyArray < Future > , 
178+   incrementalDataRecords : ReadonlyArray < IncrementalDataRecord > , 
179179) : ExperimentalIncrementalExecutionResults  { 
180180  const  incrementalPublisher  =  new  IncrementalPublisher ( context ) ; 
181-   return  incrementalPublisher . buildResponse ( result ,  errors ,  futures ) ; 
181+   return  incrementalPublisher . buildResponse ( 
182+     result , 
183+     errors , 
184+     incrementalDataRecords , 
185+   ) ; 
182186} 
183187
184188interface  IncrementalPublisherContext  { 
@@ -195,7 +199,7 @@ class IncrementalPublisher {
195199  private  _context : IncrementalPublisherContext ; 
196200  private  _nextId : number ; 
197201  private  _pending : Set < SubsequentResultRecord > ; 
198-   private  _completedResultQueue : Array < FutureResult > ; 
202+   private  _completedResultQueue : Array < IncrementalDataRecordResult > ; 
199203  private  _newPending : Set < SubsequentResultRecord > ; 
200204  private  _incremental : Array < IncrementalResult > ; 
201205  private  _completed : Array < CompletedResult > ; 
@@ -217,9 +221,9 @@ class IncrementalPublisher {
217221  buildResponse ( 
218222    data : ObjMap < unknown > , 
219223    errors : ReadonlyArray < GraphQLError >  |  undefined , 
220-     futures : ReadonlyArray < Future > , 
224+     incrementalDataRecords : ReadonlyArray < IncrementalDataRecord > , 
221225  ) : ExperimentalIncrementalExecutionResults  { 
222-     this . _addFutures ( futures ) ; 
226+     this . _addIncrementalDataRecords ( incrementalDataRecords ) ; 
223227    this . _pruneEmpty ( ) ; 
224228
225229    const  pending  =  this . _pendingSourcesToResults ( ) ; 
@@ -235,14 +239,16 @@ class IncrementalPublisher {
235239    } ; 
236240  } 
237241
238-   private  _addFutures ( futures : ReadonlyArray < Future > ) : void { 
239-     for  ( const  future  of  futures )  { 
240-       if  ( isDeferredGroupedFieldSetRecord ( future ) )  { 
241-         for  ( const  deferredFragmentRecord  of  future . deferredFragmentRecords )  { 
242+   private  _addIncrementalDataRecords ( 
243+     incrementalDataRecords : ReadonlyArray < IncrementalDataRecord > , 
244+   ) : void { 
245+     for  ( const  incrementalDataRecord  of  incrementalDataRecords )  { 
246+       if  ( isDeferredGroupedFieldSetRecord ( incrementalDataRecord ) )  { 
247+         for  ( const  deferredFragmentRecord  of  incrementalDataRecord . deferredFragmentRecords )  { 
242248          this . _addDeferredFragmentRecord ( deferredFragmentRecord ) ; 
243249        } 
244250
245-         const  result  =  future . result ; 
251+         const  result  =  incrementalDataRecord . result ; 
246252        if  ( isPromise ( result ) )  { 
247253          // eslint-disable-next-line @typescript-eslint/no-floating-promises 
248254          result . then ( ( resolved )  =>  { 
@@ -255,12 +261,12 @@ class IncrementalPublisher {
255261        continue ; 
256262      } 
257263
258-       const  streamRecord  =  future . streamRecord ; 
264+       const  streamRecord  =  incrementalDataRecord . streamRecord ; 
259265      if  ( streamRecord . id  ===  undefined )  { 
260266        this . _newPending . add ( streamRecord ) ; 
261267      } 
262268
263-       const  result  =  future . getResult ( ) ; 
269+       const  result  =  incrementalDataRecord . getResult ( ) ; 
264270      if  ( isPromise ( result ) )  { 
265271        // eslint-disable-next-line @typescript-eslint/no-floating-promises 
266272        result . then ( ( resolved )  =>  { 
@@ -383,7 +389,7 @@ class IncrementalPublisher {
383389      while  ( ! isDone )  { 
384390        let  pending : Array < PendingResult >  =  [ ] ; 
385391
386-         let  completedResult : FutureResult  |  undefined ; 
392+         let  completedResult : IncrementalDataRecordResult  |  undefined ; 
387393        while  ( 
388394          ( completedResult  =  this . _completedResultQueue . shift ( ) )  !==  undefined 
389395        )  { 
@@ -514,8 +520,10 @@ class IncrementalPublisher {
514520      ) ; 
515521    } 
516522
517-     if  ( deferredGroupedFieldSetResult . futures )  { 
518-       this . _addFutures ( deferredGroupedFieldSetResult . futures ) ; 
523+     if  ( deferredGroupedFieldSetResult . incrementalDataRecords )  { 
524+       this . _addIncrementalDataRecords ( 
525+         deferredGroupedFieldSetResult . incrementalDataRecords , 
526+       ) ; 
519527    } 
520528
521529    for  ( const  deferredFragmentRecord  of  deferredGroupedFieldSetResult . deferredFragmentRecords )  { 
@@ -608,8 +616,10 @@ class IncrementalPublisher {
608616
609617      this . _incremental . push ( incrementalEntry ) ; 
610618
611-       if  ( streamItemsResult . futures )  { 
612-         this . _addFutures ( streamItemsResult . futures ) ; 
619+       if  ( streamItemsResult . incrementalDataRecords )  { 
620+         this . _addIncrementalDataRecords ( 
621+           streamItemsResult . incrementalDataRecords , 
622+         ) ; 
613623        this . _pruneEmpty ( ) ; 
614624      } 
615625    } 
@@ -655,16 +665,16 @@ export function isDeferredFragmentRecord(
655665} 
656666
657667export  function  isDeferredGroupedFieldSetRecord ( 
658-   future :  Future , 
659- ) : future  is DeferredGroupedFieldSetRecord  { 
660-   return  future  instanceof  DeferredGroupedFieldSetRecord ; 
668+   incrementalDataRecord :  IncrementalDataRecord , 
669+ ) : incrementalDataRecord  is DeferredGroupedFieldSetRecord  { 
670+   return  incrementalDataRecord  instanceof  DeferredGroupedFieldSetRecord ; 
661671} 
662672
663673export  interface  IncrementalContext  { 
664674  deferUsageSet : DeferUsageSet  |  undefined ; 
665675  path : Path  |  undefined ; 
666676  errors ?: Map < Path  |  undefined ,  GraphQLError >  |  undefined ; 
667-   futures ?: Array < Future >  |  undefined ; 
677+   incrementalDataRecords ?: Array < IncrementalDataRecord >  |  undefined ; 
668678} 
669679
670680export  type  DeferredGroupedFieldSetResult  = 
@@ -680,8 +690,8 @@ export function isDeferredGroupedFieldSetResult(
680690interface  ReconcilableDeferredGroupedFieldSetResult  { 
681691  deferredFragmentRecords : ReadonlyArray < DeferredFragmentRecord > ; 
682692  path : Array < string  |  number > ; 
683-   result : RawDeferResult ; 
684-   futures ?: ReadonlyArray < Future >  |  undefined ; 
693+   result : BareDeferredGroupedFieldSetResult ; 
694+   incrementalDataRecords ?: ReadonlyArray < IncrementalDataRecord >  |  undefined ; 
685695  sent ?: true  |  undefined ; 
686696} 
687697
@@ -785,14 +795,14 @@ interface NonReconcilableStreamItemsResult {
785795
786796interface  NonTerminatingStreamItemsResult  { 
787797  streamRecord : StreamRecord ; 
788-   result : RawStreamItemsResult ; 
789-   futures ?: ReadonlyArray < Future >  |  undefined ; 
798+   result : BareStreamItemsResult ; 
799+   incrementalDataRecords ?: ReadonlyArray < IncrementalDataRecord >  |  undefined ; 
790800} 
791801
792802interface  TerminatingStreamItemsResult  { 
793803  streamRecord : StreamRecord ; 
794804  result ?: never ; 
795-   futures ?: never ; 
805+   incrementalDataRecords ?: never ; 
796806  errors ?: never ; 
797807} 
798808
@@ -848,14 +858,21 @@ export class StreamItemsRecord {
848858      this . nextStreamItems  !==  undefined 
849859      ? { 
850860          ...result , 
851-           futures : [ this . nextStreamItems ,  ...( result . futures  ??  [ ] ) ] , 
861+           incrementalDataRecords : [ 
862+             this . nextStreamItems , 
863+             ...( result . incrementalDataRecords  ??  [ ] ) , 
864+           ] , 
852865        } 
853866      : result ; 
854867  } 
855868} 
856869
857- export  type  Future  =  DeferredGroupedFieldSetRecord  |  StreamItemsRecord ; 
870+ export  type  IncrementalDataRecord  = 
871+   |  DeferredGroupedFieldSetRecord 
872+   |  StreamItemsRecord ; 
858873
859- export  type  FutureResult  =  DeferredGroupedFieldSetResult  |  StreamItemsResult ; 
874+ export  type  IncrementalDataRecordResult  = 
875+   |  DeferredGroupedFieldSetResult 
876+   |  StreamItemsResult ; 
860877
861878type  SubsequentResultRecord  =  DeferredFragmentRecord  |  StreamRecord ; 
0 commit comments