@@ -426,11 +426,6 @@ A Stream Record is a structure that always contains:
426426- {id}: an implementation-specific value uniquely identifying this record,
427427 created if not provided.
428428
429- Within the Execution context, records of this type also include:
430-
431- - {streamFieldGroup}: A Field Group record for completing stream items.
432- - {iterator}: The underlying iterator.
433-
434429Within the Incremental Publisher context, records of this type also include:
435430
436431- {label}: value derived from the corresponding ` @stream ` directive.
@@ -453,12 +448,6 @@ A Deferred Grouped Field Set Record is a structure that always contains:
453448- {id}: an implementation-specific value uniquely identifying this record,
454449 created if not provided.
455450
456- Within the Execution context, records of this type also include:
457-
458- - {groupedFieldSet}: a Grouped Field Set to execute.
459- - {shouldInitiateDefer}: a boolean value indicating whether implementation
460- specific deferral of execution should be initiated.
461-
462451Within the Incremental Publisher context, records of this type also include:
463452
464453- {path}: a list of field names and indices from root to the location of this
@@ -479,7 +468,7 @@ a unit of Incremental Data as well as an Incremental Result.
479468
480469#### New Deferred Fragment Event
481470
482- Required event details for New Deferred Fragment Events include:
471+ Required event details include:
483472
484473- {id}: string value identifying this Deferred Fragment.
485474- {label}: value derived from the corresponding ` @defer ` directive.
@@ -490,7 +479,7 @@ Required event details for New Deferred Fragment Events include:
490479
491480#### New Deferred Grouped Field Set Event
492481
493- Required event details for New Deferred Grouped Field Set Event include:
482+ Required event details include:
494483
495484- {id}: string value identifying this Deferred Grouped Field Set.
496485- {path}: a list of field names and indices from root to the location of this
@@ -500,7 +489,7 @@ Required event details for New Deferred Grouped Field Set Event include:
500489
501490#### Completed Deferred Grouped Field Set Event
502491
503- Required event details for Completed Deferred Grouped Field Set Events include:
492+ Required event details include:
504493
505494- {id}: string value identifying this Deferred Grouped Field Set.
506495- {data}: ordered map represented the completed data for this Deferred Grouped
@@ -509,15 +498,15 @@ Required event details for Completed Deferred Grouped Field Set Events include:
509498
510499#### Errored Deferred Grouped Field Set Event
511500
512- Required event details for Errored Deferred Grouped Field Set Event include:
501+ Required event details include:
513502
514503- {id}: string value identifying this Deferred Grouped Field Set.
515504- {errors}: The _ field error_ causing the entire Deferred Grouped Field Set to
516505 error.
517506
518507#### New Stream Event
519508
520- Required event details for New Stream Events include:
509+ Required event details include:
521510
522511- {id}: string value identifying this Stream.
523512- {label}: value derived from the corresponding ` @stream ` directive.
@@ -528,7 +517,7 @@ Required event details for New Stream Events include:
528517
529518#### New Stream Items Event
530519
531- Required event details for New Stream Items Event include:
520+ Required event details include:
532521
533522- {id}: string value identifying these Stream Items.
534523- {streamId}: string value identifying the Stream
@@ -537,34 +526,34 @@ Required event details for New Stream Items Event include:
537526
538527#### Completed Stream Items Event
539528
540- Required event details for Completed Stream Items Event include:
529+ Required event details include:
541530
542531- {id}: string value identifying these Stream Items.
543532- {items}: the list of items.
544533- {errors}: the list of _ field error_ for these items.
545534
546535#### Completed Empty Stream Items Event
547536
548- Required event details for Completed Empty Stream Items Events include:
537+ Required event details include:
549538
550539- {id}: string value identifying these Stream Items.
551540
552541#### Errored Stream Items Event
553542
554- Required event details for Errored Stream Items Events include:
543+ Required event details include:
555544
556545- {id}: string value identifying these Stream Items.
557546- {errors}: the _ field error_ causing these items to error.
558547
559548#### Completed Initial Result Event
560549
561- Required event details for Completed Initial Result Events include:
550+ Required event details include:
562551
563552- {id}: string value identifying this Initial Result.
564553
565554#### Field Error Event
566555
567- Required event details for Field Error Events include:
556+ Required event details include:
568557
569558- {id}: string value identifying the Initial Result, Deferred Grouped Field Set
570559 or Stream Items from which the _ field error_ originates.
@@ -706,7 +695,7 @@ CreateIncrementalPublisher():
706695 {earlyReturn}.
707696 - Set the entry for {id} on {streamMap} to {stream}.
708697
709- - Define the sub-procedure {HandleNewStreamItemsEvent(id, streamIds , parentIds)}
698+ - Define the sub-procedure {HandleNewStreamItemsEvent(id, streamId , parentIds)}
710699 as follows:
711700
712701 - Let {stream} be the entry in {streamMap} for {streamId}.
@@ -1031,31 +1020,31 @@ serial):
10311020
10321021- Let {fieldsByTarget}, {targetsByKey}, and {newDeferUsages} be the result of
10331022 calling {AnalyzeSelectionSet(objectType, selectionSet, variableValues)}.
1034- - Let {groupedFieldSet}, {newGroupedFieldSetDetails } be the result of calling
1023+ - Let {groupedFieldSet} and {groupDetailsMap } be the result of calling
10351024 {BuildGroupedFieldSets(fieldsByTarget, targetsByKey)}.
10361025- Let {incrementalPublisher} be the result of {CreateIncrementalPublisher()}.
1037- - Let {newDeferMap} be the result of {AddNewDeferFragments(incrementalPublisher,
1038- newDeferUsages, incrementalDataRecord)}.
1039- - Let {newDeferredGroupedFieldSets} be the result of
1040- {AddNewDeferredGroupedFieldSets(incrementalPublisher,
1041- newGroupedFieldSetDetails, newDeferMap)}.
10421026- Let {initialResultRecord} be a new Initial Result Record.
1027+ - Let {newDeferMap} be the result of {AddNewDeferFragments(incrementalPublisher,
1028+ newDeferUsages, initialResultRecord)}.
1029+ - Let {detailsList} be the result of
1030+ {AddNewDeferredGroupedFieldSets(incrementalPublisher, groupDetailsMap,
1031+ newDeferMap)}.
10431032- Let {data} be the result of running {ExecuteGroupedFieldSet(groupedFieldSet,
10441033 queryType, initialValue, variableValues, incrementalPublisher,
10451034 initialResultRecord)} _ serially_ if {serial} is {true}, _ normally_ (allowing
10461035 parallelization) otherwise.
10471036- In parallel, call {ExecuteDeferredGroupedFieldSets(queryType, initialValues,
1048- variableValues, incrementalPublisher, newDeferredGroupedFieldSets,
1049- newDeferMap)}.
1037+ variableValues, incrementalPublisher, detailsList, newDeferMap)}.
10501038- Let {id} be the corresponding entry on {initialResultRecord}.
10511039- Let {errors} be the list of all _ field error_ raised while executing the
10521040 {groupedFieldSet}.
10531041- Initialize {initialResult} to an empty unordered map.
10541042- If {errors} is not empty:
10551043 - Set the corresponding entry on {initialResult} to {errors}.
10561044- Set {data} on {initialResult} to {data}.
1045+ - Let {eventQueue} and {pending} be the corresponding entries on
1046+ {incrementalPublisher}.
10571047- Enqueue a Completed Initial Result Event on {eventQueue} with {id}.
1058- - Let {pending} be the corresponding entry on {incrementalPublisher}.
10591048- Wait for {pending} to be set.
10601049- If {pending} is empty, return {initialResult}.
10611050- Let {hasNext} be {true}.
@@ -1077,8 +1066,7 @@ incrementalDataRecord, deferMap, path):
10771066- Let {eventQueue} be the corresponding entry on {incrementalPublisher}.
10781067- For each {deferUsage} in {newDeferUsages}:
10791068 - Let {label} be the corresponding entry on {deferUsage}.
1080- - Let {parent} be (GetParentTarget(deferUsage, deferMap,
1081- incrementalDataRecord)).
1069+ - Let {parent} be (GetParent(deferUsage, deferMap, incrementalDataRecord)).
10821070 - Let {parentId} be the entry for {id} on {parent}.
10831071 - Let {deferredFragment} be a new Deferred Fragment Record.
10841072 - Let {id} be the corresponding entry on {deferredFragment}.
@@ -1087,37 +1075,39 @@ incrementalDataRecord, deferMap, path):
10871075 - Set the entry for {deferUsage} in {newDeferMap} to {deferredFragment}.
10881076 - Return {newDeferMap}.
10891077
1090- GetParentTarget (deferUsage, deferMap, incrementalDataRecord):
1078+ GetParent (deferUsage, deferMap, incrementalDataRecord):
10911079
10921080- Let {ancestors} be the corresponding entry on {deferUsage}.
10931081- Let {parentDeferUsage} be the first member of {ancestors}.
10941082- If {parentDeferUsage} is not defined, return {incrementalDataRecord}.
1095- - Let {parentRecord} be the corresponding entry in {deferMap} for
1096- {parentDeferUsage}.
1097- - Return {parentRecord}.
1083+ - Let {parent} be the corresponding entry in {deferMap} for {parentDeferUsage}.
1084+ - Return {parent}.
10981085
1099- AddNewDeferredGroupedFieldSets(incrementalPublisher, newGroupedFieldSetDetails ,
1100- deferMap, path):
1086+ AddNewDeferredGroupedFieldSets(incrementalPublisher, groupDetailsMap, deferMap ,
1087+ path):
11011088
1102- - Initialize {newDeferredGroupedFieldSets} to an empty list.
1103- - For each {deferUsageSet} and {groupedFieldSetDetails} in
1104- {newGroupedFieldSetDetails}:
1089+ - Initialize {detailsList} to an empty list.
1090+ - For each {deferUsageSet} and {details} in {groupDetailsMap}:
11051091 - Let {groupedFieldSet} and {shouldInitiateDefer} be the corresponding entries
1106- on {groupedFieldSetDetails}.
1107- - Let {deferredGroupedFieldSet} be a new Deferred Grouped Field Set Record
1108- created from {groupedFieldSet} and {shouldInitiateDefer}.
1092+ on {details}.
1093+ - Let {deferredGroupedFieldSetRecord} be a new Deferred Grouped Field Set
1094+ Record.
1095+ - Initialize {recordDetails} to an empty unordered map.
1096+ - Set the corresponding entries on {recordDetails} to
1097+ {deferredGroupedFieldSetRecord}, {groupedFieldSet}, and
1098+ {shouldInitiateDefer}.
11091099 - Let {deferredFragments} be the result of
11101100 {GetDeferredFragments(deferUsageSet, newDeferMap)}.
11111101 - Let {fragmentIds} be an empty list.
11121102 - For each {deferredFragment} in {deferredFragments}:
11131103 - Let {id} be the corresponding entry on {deferredFragment}.
11141104 - Append {id} to {fragmentIds}.
1115- - Let {id} be the corresponding entry on {deferredGroupedFieldSet }.
1105+ - Let {id} be the corresponding entry on {deferredGroupedFieldSetRecord }.
11161106 - Let {eventQueue} be the corresponding entry on {incrementalPublisher}.
11171107 - Enqueue a New Deferred Grouped Field Set Event on {eventQueue} with details
11181108 {id}, {path}, and {fragmentIds}.
1119- - Append {deferredGroupedFieldSet } to {newDeferredGroupedFieldSets }.
1120- - Return {newDeferredGroupedFieldSets }.
1109+ - Append {recordDetails } to {detailsList }.
1110+ - Return {detailsList }.
11211111
11221112GetDeferredFragments(deferUsageSet, deferMap):
11231113
@@ -1366,8 +1356,8 @@ A Field Details record is a structure containing:
13661356- {target}: the Defer Usage record corresponding to the deferred fragment
13671357 enclosing this field or the value {undefined} if the field was not deferred.
13681358
1369- Additional deferred grouped field sets are returned as Grouped Field Set Details
1370- records which are structures containing:
1359+ Information about additional deferred grouped field sets are returned as a list
1360+ of Grouped Field Set Details structures containing:
13711361
13721362- {groupedFieldSet}: the grouped field set itself.
13731363- {shouldInitiateDefer}: a boolean value indicating whether the executor should
@@ -1444,7 +1434,7 @@ parentTarget, newTarget):
14441434 - Append {target} to {newDeferUsages}.
14451435 - Otherwise:
14461436 - Let {target} be {newTarget}.
1447- - Let {fragmentTargetByKeys }, {fragmentFieldsByTarget},
1437+ - Let {fragmentTargetsByKey }, {fragmentFieldsByTarget},
14481438 {fragmentNewDeferUsages} be the result of calling
14491439 {AnalyzeSelectionSet(objectType, fragmentSelectionSet, variableValues,
14501440 visitedFragments, parentTarget, target)}.
@@ -1485,7 +1475,7 @@ parentTarget, newTarget):
14851475 - Append {target} to {newDeferUsages}.
14861476 - Otherwise:
14871477 - Let {target} be {newTarget}.
1488- - Let {fragmentTargetByKeys }, {fragmentFieldsByTarget},
1478+ - Let {fragmentTargetsByKey }, {fragmentFieldsByTarget},
14891479 {fragmentNewDeferUsages} be the result of calling
14901480 {AnalyzeSelectionSet(objectType, fragmentSelectionSet, variableValues,
14911481 visitedFragments, parentTarget, target)}.
@@ -1550,7 +1540,7 @@ BuildGroupedFieldSets(fieldsByTarget, targetsByKey, parentTargets)
15501540 - Let {fieldDetails} be a new Field Details record created from {node}
15511541 and {target}.
15521542 - Append {fieldDetails} to the {fields} entry on {fieldGroup}.
1553- - Initialize {newGroupedFieldSetDetails } to an empty unordered map.
1543+ - Initialize {groupDetailsMap } to an empty unordered map.
15541544- For each {maskingTargets} and {targetSetDetails} in {targetSetDetailsMap}:
15551545 - Initialize {newGroupedFieldSet} to an empty ordered map.
15561546 - Let {keys} be the corresponding entry on {targetSetDetails}.
@@ -1573,11 +1563,11 @@ BuildGroupedFieldSets(fieldsByTarget, targetsByKey, parentTargets)
15731563 and {target}.
15741564 - Append {fieldDetails} to the {fields} entry on {fieldGroup}.
15751565 - Let {shouldInitiateDefer} be the corresponding entry on {targetSetDetails}.
1576- - Let {details} be a new Grouped Field Set Details record created from
1577- {newGroupedFieldSet} and {shouldInitiateDefer }.
1578- - Set the entry for {maskingTargets} in {newGroupedFieldSetDetails} to
1579- {details}.
1580- - Return {groupedFieldSet} and {newGroupedFieldSetDetails }.
1566+ - Initialize {details} to an empty unordered map.
1567+ - Set the entry for {groupedFieldSet} in {details} to {newGroupedFieldSet }.
1568+ - Set the corresponding entry in {details} to {shouldInitiateDefer}.
1569+ - Set the entry for {maskingTargets} in {groupDetailsMap} to {details}.
1570+ - Return {groupedFieldSet} and {groupDetailsMap }.
15811571
15821572Note: entries are always added to Grouped Field Set records in the order in
15831573which they appear for the first target. Field order for deferred grouped field
@@ -1641,20 +1631,19 @@ IsSameSet(setA, setB):
16411631## Executing Deferred Grouped Field Sets
16421632
16431633ExecuteDeferredGroupedFieldSets(objectType, objectValue, variableValues,
1644- incrementalPublisher, path, newDeferredGroupedFieldSets , deferMap)
1634+ incrementalPublisher, path, detailsList , deferMap)
16451635
1646- - If {path} is not provided, initialize it to an empty list.
1647- - For each {deferredGroupedFieldSet} of {newDeferredGroupedFieldSets}:
1648- - Let {shouldInitiateDefer} and {groupedFieldSet} be the corresponding entries
1649- on {deferredGroupedFieldSet}.
1636+ - For each {recordDetails} in {detailsList}, allowing for parallelization:
1637+ - Let {deferredGroupedFieldSetRecord}, {groupedFieldSet}, and
1638+ {shouldInitiateDefer} be the corresponding entries on {recordDetails}.
16501639 - If {shouldInitiateDefer} is {true}:
16511640 - Initiate implementation specific deferral of further execution, resuming
16521641 execution as defined.
16531642 - Let {data} be the result of calling {ExecuteGroupedFieldSet(groupedFieldSet,
16541643 objectType, objectValue, variableValues, path, deferMap,
16551644 incrementalPublisher, deferredGroupedFieldSet)}.
16561645 - Let {eventQueue} be the corresponding entry on {incrementalPublisher}.
1657- - Let {id} be the corresponding entry on {deferredGroupedFieldSet }.
1646+ - Let {id} be the corresponding entry on {deferredGroupedFieldSetRecord }.
16581647 - If _ field error_ were raised, causing a {null} to be propagated to {data}:
16591648 - Let {incrementalErrors} be the list of such field errors.
16601649 - Enqueue an Errored Deferred Grouped Field Set event with details {id} and
@@ -1787,16 +1776,16 @@ yielded items satisfies `initialCount` specified on the `@stream` directive.
17871776
17881777#### Execute Stream Field
17891778
1790- ExecuteStreamField(stream, index, innerType, variableValues ,
1791- incrementalPublisher, parentIncrementalDataRecord):
1779+ ExecuteStreamField(stream, path, iterator, fieldGroup, index, innerType ,
1780+ variableValues, incrementalPublisher, parentIncrementalDataRecord):
17921781
1793- - Let {path} and {iterator} be the corresponding entries on {stream}.
17941782- Let {incrementalErrors} be an empty list of _ field error_ for the entire
17951783 stream, including all _ field error_ bubbling up to {path}.
17961784- Let {currentIndex} be {index}.
17971785- Let {currentParent} be {parentIncrementalDataRecord}.
17981786- Let {errored} be {false}.
17991787- Let {eventQueue} be the corresponding entry on {incrementalPublisher}.
1788+ - Let {streamFieldGroup} be the result of {GetStreamFieldGroup(fieldGroup)}.
18001789- Repeat the following steps:
18011790 - Let {itemPath} be {path} with {currentIndex} appended.
18021791 - Let {streamItems} be a new Stream Items Record.
@@ -1828,7 +1817,6 @@ incrementalPublisher, parentIncrementalDataRecord):
18281817 {id}.
18291818 - Return.
18301819 - Let {item} be the item retrieved from {iterator}.
1831- - Let {streamFieldGroup} be the corresponding entry on {stream}.
18321820 - Let {newDeferMap} be an empty unordered map.
18331821 - Let {data} be the result of calling {CompleteValue(innerType,
18341822 streamedFieldGroup, item, variableValues, itemPath, newDeferMap,
@@ -1880,20 +1868,19 @@ incrementalPublisher, incrementalDataRecord):
18801868 - Let {iterator} be an iterator for {result}.
18811869 - Let {items} be an empty list.
18821870 - Let {index} be zero.
1871+ - Let {eventQueue} be the corresponding entry on {incrementalPublisher}.
18831872 - While {result} is not closed:
18841873 - If {streamDirective} is defined and {index} is greater than or equal to
18851874 {initialCount}:
1886- - Let {streamFieldGroup} be the result of
1887- {GetStreamFieldGroup(fieldGroup)}.
1888- - Let {stream} be a new Stream Record created from {streamFieldGroup}, and
1889- {iterator}.
1875+ - Let {stream} be a new Stream Record.
18901876 - Let {id} be the corresponding entry on {stream}.
18911877 - Let {earlyReturn} be the implementation-specific value denoting how to
18921878 notify {iterator} that no additional items will be requested.
18931879 - Enqueue a New Stream Event on {eventQueue} with details {id}, {label},
18941880 {path}, and {earlyReturn}.
1895- - Call {ExecuteStreamField(stream, index, innerType, variableValues,
1896- incrementalPublisher, incrementalDataRecord)}.
1881+ - Call {ExecuteStreamField(stream, path, iterator, fieldGroup, index,
1882+ innerType, variableValues, incrementalPublisher,
1883+ incrementalDataRecord)}.
18971884 - Return {items}.
18981885 - Otherwise:
18991886 - Wait for the next item from {result} via the {iterator}.
@@ -1913,21 +1900,20 @@ incrementalPublisher, incrementalDataRecord):
19131900 - Let {objectType} be {fieldType}.
19141901 - Otherwise if {fieldType} is an Interface or Union type.
19151902 - Let {objectType} be {ResolveAbstractType(fieldType, result)}.
1916- - Let {groupedFieldSet}, {newGroupedFieldSetDetails }, and {deferUsages} be the
1917- result of {ProcessSubSelectionSets(objectType, fieldGroup, variableValues)}.
1903+ - Let {groupedFieldSet}, {groupDetailsMap }, and {deferUsages} be the result of
1904+ {ProcessSubSelectionSets(objectType, fieldGroup, variableValues)}.
19181905 - Let {newDeferMap} be the result of
19191906 {AddNewDeferFragments(incrementalPublisher, newDeferUsages,
19201907 incrementalDataRecord, deferMap, path)}.
1921- - Let {newDeferredGroupedFieldSets } be the result of
1922- {AddNewDeferredGroupedFieldSets(incrementalPublisher,
1923- newGroupedFieldSetDetails, newDeferMap, path)}.
1908+ - Let {detailsList } be the result of
1909+ {AddNewDeferredGroupedFieldSets(incrementalPublisher, groupDetailsMap,
1910+ newDeferMap, path)}.
19241911 - Let {completed} be the result of evaluating
19251912 {ExecuteGroupedFieldSet(groupedFieldSet, objectType, result, variableValues,
19261913 path, newDeferMap, incrementalPublisher, incrementalDataRecord)} _ normally_
19271914 (allowing for parallelization).
19281915 - In parallel, call {ExecuteDeferredGroupedFieldSets(objectType, result,
1929- variableValues, incrementalPublisher, newDeferredGroupedFieldSets,
1930- newDeferredFragments, newDeferMap)}.
1916+ variableValues, incrementalPublisher, detailsList, newDeferMap)}.
19311917 - Return {completed}.
19321918
19331919ProcessSubSelectionSets(objectType, fieldGroup, variableValues):
0 commit comments