@@ -382,16 +382,11 @@ or a Stream Items Record.
382382
383383An Initial Result Record is a structure containing:
384384
385- - {id}: an implementation-specific value uniquely identifying this record,
386- created if not provided.
385+ - {id}: an implementation-specific value uniquely identifying this record.
387386
388387A Deferred Fragment Record is a structure that always contains:
389388
390- - {id}: an implementation-specific value uniquely identifying this record,
391- created if not provided.
392-
393- Within the Incremental Publisher context, records of this type also include:
394-
389+ - {id}: an implementation-specific value uniquely identifying this record.
395390- {label}: value derived from the corresponding ` @defer ` directive.
396391- {path}: a list of field names and indices from root to the location of the
397392 corresponding ` @defer ` directive.
@@ -404,11 +399,7 @@ Within the Incremental Publisher context, records of this type also include:
404399
405400A Stream Items Record is a structure that always contains:
406401
407- - {id}: an implementation-specific value uniquely identifying this record,
408- created if not provided.
409-
410- Within the Incremental Publisher context, records of this type also include:
411-
402+ - {id}: an implementation-specific value uniquely identifying this record.
412403- {path}: a list of field names and indices from root to the location of the
413404 corresponding list item contained by this Stream Items Record.
414405- {stream}: the Stream Record which this Stream Items Record partially fulfills.
@@ -423,11 +414,7 @@ Within the Incremental Publisher context, records of this type also include:
423414
424415A Stream Record is a structure that always contains:
425416
426- - {id}: an implementation-specific value uniquely identifying this record,
427- created if not provided.
428-
429- Within the Incremental Publisher context, records of this type also include:
430-
417+ - {id}: an implementation-specific value uniquely identifying this record.
431418- {label}: value derived from the corresponding ` @stream ` directive.
432419- {path}: a list of field names and indices from root to the location of the
433420 corresponding ` @stream ` directive.
@@ -445,11 +432,7 @@ Grouped Field Set Record or a Stream Items Record.
445432
446433A Deferred Grouped Field Set Record is a structure that always contains:
447434
448- - {id}: an implementation-specific value uniquely identifying this record,
449- created if not provided.
450-
451- Within the Incremental Publisher context, records of this type also include:
452-
435+ - {id}: an implementation-specific value uniquely identifying this record.
453436- {path}: a list of field names and indices from root to the location of this
454437 deferred grouped field set.
455438- {deferredFragments}: a set of Deferred Fragment Records containing this
@@ -918,7 +901,7 @@ CreateIncrementalPublisher():
918901 - Remove the event from the queue.
919902 - Call {HandleExecutionEvent(eventType, eventDetails)}.
920903 - Wait for the next event or for {allResultsCompleted} to be set to {true}.
921- - If {allResultsCompleted} is {true}, return.
904+ - If {allResultsCompleted} is {true}, return.
922905 - In parallel, set {subsequentResults} on {incrementalPublisher} to the result
923906 of lazily executing {YieldSubsequentResults()}.
924907
@@ -1023,19 +1006,19 @@ serial):
10231006- Let {groupedFieldSet} and {groupDetailsMap} be the result of calling
10241007 {BuildGroupedFieldSets(fieldsByTarget, targetsByKey)}.
10251008- Let {incrementalPublisher} be the result of {CreateIncrementalPublisher()}.
1026- - Let {initialResultRecord} be a new Initial Result Record .
1009+ - Initialize {initialResultId} to an identifier unique to this execution .
10271010- Let {newDeferMap} be the result of {AddNewDeferFragments(incrementalPublisher,
1028- newDeferUsages, initialResultRecord )}.
1011+ newDeferUsages, initialResultId )}.
10291012- Let {detailsList} be the result of
10301013 {AddNewDeferredGroupedFieldSets(incrementalPublisher, groupDetailsMap,
10311014 newDeferMap)}.
10321015- Let {data} be the result of running {ExecuteGroupedFieldSet(groupedFieldSet,
10331016 queryType, initialValue, variableValues, incrementalPublisher,
1034- initialResultRecord )} _ serially_ if {serial} is {true}, _ normally_ (allowing
1017+ initialResultId )} _ serially_ if {serial} is {true}, _ normally_ (allowing
10351018 parallelization) otherwise.
10361019- In parallel, call {ExecuteDeferredGroupedFieldSets(queryType, initialValues,
10371020 variableValues, incrementalPublisher, detailsList, newDeferMap)}.
1038- - Let {id} be the corresponding entry on {initialResultRecord }.
1021+ - Let {id} be the corresponding entry on {initialResultId }.
10391022- Let {errors} be the list of all _ field error_ raised while executing the
10401023 {groupedFieldSet}.
10411024- Initialize {initialResult} to an empty unordered map.
@@ -1052,8 +1035,8 @@ serial):
10521035- Let {subsequentResults} be the corresponding entry on {incrementalPublisher}.
10531036- Return {initialResult} and {subsequentResults}.
10541037
1055- AddNewDeferFragments(incrementalPublisher, newDeferUsages,
1056- incrementalDataRecord, deferMap, path):
1038+ AddNewDeferFragments(incrementalPublisher, newDeferUsages, incrementalDataId,
1039+ deferMap, path):
10571040
10581041- Initialize {newDeferredGroupedFieldSets} to an empty list.
10591042- If {newDeferUsages} is empty:
@@ -1065,36 +1048,33 @@ incrementalDataRecord, deferMap, path):
10651048 - Set the entry for {deferUsage} in {newDeferMap} to {deferredFragment}.
10661049- Let {eventQueue} be the corresponding entry on {incrementalPublisher}.
10671050- For each {deferUsage} in {newDeferUsages}:
1051+ - Let {id} be a unique identifier for this execution.
10681052 - Let {label} be the corresponding entry on {deferUsage}.
1069- - Let {parent} be (GetParent(deferUsage, deferMap, incrementalDataRecord )).
1053+ - Let {parent} be (GetParent(deferUsage, deferMap, incrementalDataId )).
10701054 - Let {parentId} be the entry for {id} on {parent}.
1071- - Let {deferredFragment} be a new Deferred Fragment Record.
1072- - Let {id} be the corresponding entry on {deferredFragment}.
1073- - Enqueue a New Deferred Fragment Event on {eventQueue} with details {label},
1074- {path}, and {parentId}.
1075- - Set the entry for {deferUsage} in {newDeferMap} to {deferredFragment}.
1055+ - Enqueue a New Deferred Fragment Event on {eventQueue} with details {id},
1056+ {label}, {path}, and {parentId}.
1057+ - Set the entry for {deferUsage} in {newDeferMap} to {id}.
10761058 - Return {newDeferMap}.
10771059
1078- GetParent(deferUsage, deferMap, incrementalDataRecord ):
1060+ GetParent(deferUsage, deferMap, incrementalDataId ):
10791061
10801062- Let {ancestors} be the corresponding entry on {deferUsage}.
10811063- Let {parentDeferUsage} be the first member of {ancestors}.
1082- - If {parentDeferUsage} is not defined, return {incrementalDataRecord }.
1064+ - If {parentDeferUsage} is not defined, return {incrementalDataId }.
10831065- Let {parent} be the corresponding entry in {deferMap} for {parentDeferUsage}.
10841066- Return {parent}.
10851067
10861068AddNewDeferredGroupedFieldSets(incrementalPublisher, groupDetailsMap, deferMap,
10871069path):
10881070
10891071- Initialize {detailsList} to an empty list.
1090- - For each {deferUsageSet} and {details } in {groupDetailsMap}:
1072+ - For each {deferUsageSet} and {groupDetails } in {groupDetailsMap}:
10911073 - Let {groupedFieldSet} and {shouldInitiateDefer} be the corresponding entries
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
1074+ on {groupDetails}.
1075+ - Let {id} be an identifier unique to this execution.
1076+ - Initialize {details} to an empty unordered map.
1077+ - Set the corresponding entries on {details} to {id}, {groupedFieldSet}, and
10981078 {shouldInitiateDefer}.
10991079 - Let {deferredFragments} be the result of
11001080 {GetDeferredFragments(deferUsageSet, newDeferMap)}.
@@ -1106,7 +1086,7 @@ path):
11061086 - Let {eventQueue} be the corresponding entry on {incrementalPublisher}.
11071087 - Enqueue a New Deferred Grouped Field Set Event on {eventQueue} with details
11081088 {id}, {path}, and {fragmentIds}.
1109- - Append {recordDetails } to {detailsList}.
1089+ - Append {details } to {detailsList}.
11101090- Return {detailsList}.
11111091
11121092GetDeferredFragments(deferUsageSet, deferMap):
@@ -1124,7 +1104,7 @@ type need to be known, as well as whether it must be executed serially, or may
11241104be executed in parallel.
11251105
11261106ExecuteGroupedFieldSet(groupedFieldSet, objectType, objectValue, variableValues,
1127- path, deferMap, incrementalPublisher, incrementalDataRecord ):
1107+ path, deferMap, incrementalPublisher, incrementalDataId ):
11281108
11291109- If {path} is not provided, initialize it to an empty list.
11301110- Initialize {resultMap} to an empty ordered map.
@@ -1138,7 +1118,7 @@ path, deferMap, incrementalPublisher, incrementalDataRecord):
11381118 - If {fieldType} is defined:
11391119 - Let {responseValue} be {ExecuteField(objectType, objectValue, fieldType,
11401120 fieldGroup, variableValues, path, incrementalPublisher,
1141- incrementalDataRecord )}.
1121+ incrementalDataId )}.
11421122 - Set {responseValue} as the value for {responseKey} in {resultMap}.
11431123- Return {resultMap}.
11441124
@@ -1564,9 +1544,10 @@ BuildGroupedFieldSets(fieldsByTarget, targetsByKey, parentTargets)
15641544 - Append {fieldDetails} to the {fields} entry on {fieldGroup}.
15651545 - Let {shouldInitiateDefer} be the corresponding entry on {targetSetDetails}.
15661546 - 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}.
1547+ - Set the entry for {groupedFieldSet} in {groupDetails} to
1548+ {newGroupedFieldSet}.
1549+ - Set the corresponding entry in {groupDetails} to {shouldInitiateDefer}.
1550+ - Set the entry for {maskingTargets} in {groupDetailsMap} to {groupDetails}.
15701551- Return {groupedFieldSet} and {groupDetailsMap}.
15711552
15721553Note: entries are always added to Grouped Field Set records in the order in
@@ -1633,17 +1614,16 @@ IsSameSet(setA, setB):
16331614ExecuteDeferredGroupedFieldSets(objectType, objectValue, variableValues,
16341615incrementalPublisher, path, detailsList, deferMap)
16351616
1636- - For each {recordDetails } in {detailsList}, allowing for parallelization:
1637- - Let {deferredGroupedFieldSetRecord }, {groupedFieldSet}, and
1638- {shouldInitiateDefer} be the corresponding entries on {recordDetails }.
1617+ - For each {details } in {detailsList}, allowing for parallelization:
1618+ - Let {id }, {groupedFieldSet}, and {shouldInitiateDefer} be the corresponding
1619+ entries on {details }.
16391620 - If {shouldInitiateDefer} is {true}:
16401621 - Initiate implementation specific deferral of further execution, resuming
16411622 execution as defined.
16421623 - Let {data} be the result of calling {ExecuteGroupedFieldSet(groupedFieldSet,
16431624 objectType, objectValue, variableValues, path, deferMap,
16441625 incrementalPublisher, deferredGroupedFieldSet)}.
16451626 - Let {eventQueue} be the corresponding entry on {incrementalPublisher}.
1646- - Let {id} be the corresponding entry on {deferredGroupedFieldSetRecord}.
16471627 - If _ field error_ were raised, causing a {null} to be propagated to {data}:
16481628 - Let {incrementalErrors} be the list of such field errors.
16491629 - Enqueue an Errored Deferred Grouped Field Set event with details {id} and
@@ -1663,7 +1643,7 @@ finally completes that value either by recursively executing another selection
16631643set or coercing a scalar value.
16641644
16651645ExecuteField(objectType, objectValue, fieldType, fieldGroup, variableValues,
1666- path, deferMap, incrementalPublisher, incrementalDataRecord ):
1646+ path, deferMap, incrementalPublisher, incrementalDataId ):
16671647
16681648- Let {fieldDetails} be the first entry in {fieldGroup}.
16691649- Let {node} be the corresponding entry on {fieldDetails}.
@@ -1674,7 +1654,7 @@ path, deferMap, incrementalPublisher, incrementalDataRecord):
16741654- Let {resolvedValue} be {ResolveFieldValue(objectType, objectValue, fieldName,
16751655 argumentValues)}.
16761656- Return the result of {CompleteValue(fieldType, fields, resolvedValue,
1677- variableValues, path, deferMap, incrementalPublisher, incrementalDataRecord )}.
1657+ variableValues, path, deferMap, incrementalPublisher, incrementalDataId )}.
16781658
16791659### Coercing Field Arguments
16801660
@@ -1788,8 +1768,7 @@ variableValues, incrementalPublisher, parentIncrementalDataRecord):
17881768- Let {streamFieldGroup} be the result of {GetStreamFieldGroup(fieldGroup)}.
17891769- Repeat the following steps:
17901770 - Let {itemPath} be {path} with {currentIndex} appended.
1791- - Let {streamItems} be a new Stream Items Record.
1792- - Let {id} be the corresponding entry on {streamItems}.
1771+ - Let {id} be an identifier unique to this execution.
17931772 - Let {parentIds} be an empty list.
17941773 - If {currentParent} is a Deferred Grouped Field Set Record.
17951774 - Let {deferredFragments} be the corresponding entry on {currentParent}.
@@ -1812,7 +1791,6 @@ variableValues, incrementalPublisher, parentIncrementalDataRecord):
18121791 and {incrementalErrors}.
18131792 - Return.
18141793 - If an item is not retrieved because {iterator} has completed:
1815- - Let {id} be the corresponding entry on {streamItems}
18161794 - Enqueue a Completed Empty Stream Items Event on {eventQueue} with details
18171795 {id}.
18181796 - Return.
@@ -1825,22 +1803,20 @@ variableValues, incrementalPublisher, parentIncrementalDataRecord):
18251803 {innerType} is a Non-Nullable type, let {incrementalErrors} be the list of
18261804 those errors:
18271805 - Set {errored} to {true}.
1828- - Let {id} be the corresponding entry on {streamItems}
18291806 - Enqueue an Errored Stream Items Event on {eventQueue} with details {id}
18301807 and {incrementalErrors}.
18311808 - Return.
18321809 - Let {errors} be the list of all _ field error_ raised while completing this
18331810 item.
18341811 - Initialize {items} to an list containing the single item {data}.
1835- - Let {id} be the corresponding entry on {streamItems}
18361812 - Enqueue a Completed Stream Items Event on {eventQueue} with details {id},
18371813 {items}, and {errors}.
18381814 - Increment {currentIndex}.
18391815 - Set {currentParent} to {streamItems}.
18401816 - Increment {index}.
18411817
18421818CompleteValue(fieldType, fieldGroup, result, variableValues, path, deferMap,
1843- incrementalPublisher, incrementalDataRecord ):
1819+ incrementalPublisher, incrementalDataId ):
18441820
18451821- If the {fieldType} is a Non-Null type:
18461822 - Let {innerType} be the inner type of {fieldType}.
@@ -1872,15 +1848,13 @@ incrementalPublisher, incrementalDataRecord):
18721848 - While {result} is not closed:
18731849 - If {streamDirective} is defined and {index} is greater than or equal to
18741850 {initialCount}:
1875- - Let {stream} be a new Stream Record.
1876- - Let {id} be the corresponding entry on {stream}.
1851+ - Let {id} be an identifier unique to this execution.
18771852 - Let {earlyReturn} be the implementation-specific value denoting how to
18781853 notify {iterator} that no additional items will be requested.
18791854 - Enqueue a New Stream Event on {eventQueue} with details {id}, {label},
18801855 {path}, and {earlyReturn}.
18811856 - Call {ExecuteStreamField(stream, path, iterator, fieldGroup, index,
1882- innerType, variableValues, incrementalPublisher,
1883- incrementalDataRecord)}.
1857+ innerType, variableValues, incrementalPublisher, incrementalDataId)}.
18841858 - Return {items}.
18851859 - Otherwise:
18861860 - Wait for the next item from {result} via the {iterator}.
@@ -1889,7 +1863,7 @@ incrementalPublisher, incrementalDataRecord):
18891863 - Let {itemPath} be {path} with {index} appended.
18901864 - Let {resolvedItem} be the result of calling {CompleteValue(innerType,
18911865 fields, resultItem, variableValues, itemPath, deferMap,
1892- incrementalPublisher, incrementalDataRecord )}.
1866+ incrementalPublisher, incrementalDataId )}.
18931867 - Append {resolvedItem} to {items}.
18941868 - Increment {index}.
18951869 - Return {items}.
@@ -1904,13 +1878,13 @@ incrementalPublisher, incrementalDataRecord):
19041878 {ProcessSubSelectionSets(objectType, fieldGroup, variableValues)}.
19051879 - Let {newDeferMap} be the result of
19061880 {AddNewDeferFragments(incrementalPublisher, newDeferUsages,
1907- incrementalDataRecord , deferMap, path)}.
1881+ incrementalDataId , deferMap, path)}.
19081882 - Let {detailsList} be the result of
19091883 {AddNewDeferredGroupedFieldSets(incrementalPublisher, groupDetailsMap,
19101884 newDeferMap, path)}.
19111885 - Let {completed} be the result of evaluating
19121886 {ExecuteGroupedFieldSet(groupedFieldSet, objectType, result, variableValues,
1913- path, newDeferMap, incrementalPublisher, incrementalDataRecord )} _ normally_
1887+ path, newDeferMap, incrementalPublisher, incrementalDataId )} _ normally_
19141888 (allowing for parallelization).
19151889 - In parallel, call {ExecuteDeferredGroupedFieldSets(objectType, result,
19161890 variableValues, incrementalPublisher, detailsList, newDeferMap)}.
0 commit comments