@@ -382,16 +382,11 @@ or a Stream Items Record.
382
382
383
383
An Initial Result Record is a structure containing:
384
384
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.
387
386
388
387
A Deferred Fragment Record is a structure that always contains:
389
388
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.
395
390
- {label}: value derived from the corresponding ` @defer ` directive.
396
391
- {path}: a list of field names and indices from root to the location of the
397
392
corresponding ` @defer ` directive.
@@ -404,11 +399,7 @@ Within the Incremental Publisher context, records of this type also include:
404
399
405
400
A Stream Items Record is a structure that always contains:
406
401
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.
412
403
- {path}: a list of field names and indices from root to the location of the
413
404
corresponding list item contained by this Stream Items Record.
414
405
- {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:
423
414
424
415
A Stream Record is a structure that always contains:
425
416
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.
431
418
- {label}: value derived from the corresponding ` @stream ` directive.
432
419
- {path}: a list of field names and indices from root to the location of the
433
420
corresponding ` @stream ` directive.
@@ -445,11 +432,7 @@ Grouped Field Set Record or a Stream Items Record.
445
432
446
433
A Deferred Grouped Field Set Record is a structure that always contains:
447
434
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.
453
436
- {path}: a list of field names and indices from root to the location of this
454
437
deferred grouped field set.
455
438
- {deferredFragments}: a set of Deferred Fragment Records containing this
@@ -918,7 +901,7 @@ CreateIncrementalPublisher():
918
901
- Remove the event from the queue.
919
902
- Call {HandleExecutionEvent(eventType, eventDetails)}.
920
903
- 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.
922
905
- In parallel, set {subsequentResults} on {incrementalPublisher} to the result
923
906
of lazily executing {YieldSubsequentResults()}.
924
907
@@ -1023,19 +1006,19 @@ serial):
1023
1006
- Let {groupedFieldSet} and {groupDetailsMap} be the result of calling
1024
1007
{BuildGroupedFieldSets(fieldsByTarget, targetsByKey)}.
1025
1008
- 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 .
1027
1010
- Let {newDeferMap} be the result of {AddNewDeferFragments(incrementalPublisher,
1028
- newDeferUsages, initialResultRecord )}.
1011
+ newDeferUsages, initialResultId )}.
1029
1012
- Let {detailsList} be the result of
1030
1013
{AddNewDeferredGroupedFieldSets(incrementalPublisher, groupDetailsMap,
1031
1014
newDeferMap)}.
1032
1015
- Let {data} be the result of running {ExecuteGroupedFieldSet(groupedFieldSet,
1033
1016
queryType, initialValue, variableValues, incrementalPublisher,
1034
- initialResultRecord )} _ serially_ if {serial} is {true}, _ normally_ (allowing
1017
+ initialResultId )} _ serially_ if {serial} is {true}, _ normally_ (allowing
1035
1018
parallelization) otherwise.
1036
1019
- In parallel, call {ExecuteDeferredGroupedFieldSets(queryType, initialValues,
1037
1020
variableValues, incrementalPublisher, detailsList, newDeferMap)}.
1038
- - Let {id} be the corresponding entry on {initialResultRecord }.
1021
+ - Let {id} be the corresponding entry on {initialResultId }.
1039
1022
- Let {errors} be the list of all _ field error_ raised while executing the
1040
1023
{groupedFieldSet}.
1041
1024
- Initialize {initialResult} to an empty unordered map.
@@ -1052,8 +1035,8 @@ serial):
1052
1035
- Let {subsequentResults} be the corresponding entry on {incrementalPublisher}.
1053
1036
- Return {initialResult} and {subsequentResults}.
1054
1037
1055
- AddNewDeferFragments(incrementalPublisher, newDeferUsages,
1056
- incrementalDataRecord, deferMap, path):
1038
+ AddNewDeferFragments(incrementalPublisher, newDeferUsages, incrementalDataId,
1039
+ deferMap, path):
1057
1040
1058
1041
- Initialize {newDeferredGroupedFieldSets} to an empty list.
1059
1042
- If {newDeferUsages} is empty:
@@ -1065,36 +1048,33 @@ incrementalDataRecord, deferMap, path):
1065
1048
- Set the entry for {deferUsage} in {newDeferMap} to {deferredFragment}.
1066
1049
- Let {eventQueue} be the corresponding entry on {incrementalPublisher}.
1067
1050
- For each {deferUsage} in {newDeferUsages}:
1051
+ - Let {id} be a unique identifier for this execution.
1068
1052
- Let {label} be the corresponding entry on {deferUsage}.
1069
- - Let {parent} be (GetParent(deferUsage, deferMap, incrementalDataRecord )).
1053
+ - Let {parent} be (GetParent(deferUsage, deferMap, incrementalDataId )).
1070
1054
- 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}.
1076
1058
- Return {newDeferMap}.
1077
1059
1078
- GetParent(deferUsage, deferMap, incrementalDataRecord ):
1060
+ GetParent(deferUsage, deferMap, incrementalDataId ):
1079
1061
1080
1062
- Let {ancestors} be the corresponding entry on {deferUsage}.
1081
1063
- Let {parentDeferUsage} be the first member of {ancestors}.
1082
- - If {parentDeferUsage} is not defined, return {incrementalDataRecord }.
1064
+ - If {parentDeferUsage} is not defined, return {incrementalDataId }.
1083
1065
- Let {parent} be the corresponding entry in {deferMap} for {parentDeferUsage}.
1084
1066
- Return {parent}.
1085
1067
1086
1068
AddNewDeferredGroupedFieldSets(incrementalPublisher, groupDetailsMap, deferMap,
1087
1069
path):
1088
1070
1089
1071
- Initialize {detailsList} to an empty list.
1090
- - For each {deferUsageSet} and {details } in {groupDetailsMap}:
1072
+ - For each {deferUsageSet} and {groupDetails } in {groupDetailsMap}:
1091
1073
- 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
1098
1078
{shouldInitiateDefer}.
1099
1079
- Let {deferredFragments} be the result of
1100
1080
{GetDeferredFragments(deferUsageSet, newDeferMap)}.
@@ -1106,7 +1086,7 @@ path):
1106
1086
- Let {eventQueue} be the corresponding entry on {incrementalPublisher}.
1107
1087
- Enqueue a New Deferred Grouped Field Set Event on {eventQueue} with details
1108
1088
{id}, {path}, and {fragmentIds}.
1109
- - Append {recordDetails } to {detailsList}.
1089
+ - Append {details } to {detailsList}.
1110
1090
- Return {detailsList}.
1111
1091
1112
1092
GetDeferredFragments(deferUsageSet, deferMap):
@@ -1124,7 +1104,7 @@ type need to be known, as well as whether it must be executed serially, or may
1124
1104
be executed in parallel.
1125
1105
1126
1106
ExecuteGroupedFieldSet(groupedFieldSet, objectType, objectValue, variableValues,
1127
- path, deferMap, incrementalPublisher, incrementalDataRecord ):
1107
+ path, deferMap, incrementalPublisher, incrementalDataId ):
1128
1108
1129
1109
- If {path} is not provided, initialize it to an empty list.
1130
1110
- Initialize {resultMap} to an empty ordered map.
@@ -1138,7 +1118,7 @@ path, deferMap, incrementalPublisher, incrementalDataRecord):
1138
1118
- If {fieldType} is defined:
1139
1119
- Let {responseValue} be {ExecuteField(objectType, objectValue, fieldType,
1140
1120
fieldGroup, variableValues, path, incrementalPublisher,
1141
- incrementalDataRecord )}.
1121
+ incrementalDataId )}.
1142
1122
- Set {responseValue} as the value for {responseKey} in {resultMap}.
1143
1123
- Return {resultMap}.
1144
1124
@@ -1564,9 +1544,10 @@ BuildGroupedFieldSets(fieldsByTarget, targetsByKey, parentTargets)
1564
1544
- Append {fieldDetails} to the {fields} entry on {fieldGroup}.
1565
1545
- Let {shouldInitiateDefer} be the corresponding entry on {targetSetDetails}.
1566
1546
- 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}.
1570
1551
- Return {groupedFieldSet} and {groupDetailsMap}.
1571
1552
1572
1553
Note: entries are always added to Grouped Field Set records in the order in
@@ -1633,17 +1614,16 @@ IsSameSet(setA, setB):
1633
1614
ExecuteDeferredGroupedFieldSets(objectType, objectValue, variableValues,
1634
1615
incrementalPublisher, path, detailsList, deferMap)
1635
1616
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 }.
1639
1620
- If {shouldInitiateDefer} is {true}:
1640
1621
- Initiate implementation specific deferral of further execution, resuming
1641
1622
execution as defined.
1642
1623
- Let {data} be the result of calling {ExecuteGroupedFieldSet(groupedFieldSet,
1643
1624
objectType, objectValue, variableValues, path, deferMap,
1644
1625
incrementalPublisher, deferredGroupedFieldSet)}.
1645
1626
- Let {eventQueue} be the corresponding entry on {incrementalPublisher}.
1646
- - Let {id} be the corresponding entry on {deferredGroupedFieldSetRecord}.
1647
1627
- If _ field error_ were raised, causing a {null} to be propagated to {data}:
1648
1628
- Let {incrementalErrors} be the list of such field errors.
1649
1629
- 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
1663
1643
set or coercing a scalar value.
1664
1644
1665
1645
ExecuteField(objectType, objectValue, fieldType, fieldGroup, variableValues,
1666
- path, deferMap, incrementalPublisher, incrementalDataRecord ):
1646
+ path, deferMap, incrementalPublisher, incrementalDataId ):
1667
1647
1668
1648
- Let {fieldDetails} be the first entry in {fieldGroup}.
1669
1649
- Let {node} be the corresponding entry on {fieldDetails}.
@@ -1674,7 +1654,7 @@ path, deferMap, incrementalPublisher, incrementalDataRecord):
1674
1654
- Let {resolvedValue} be {ResolveFieldValue(objectType, objectValue, fieldName,
1675
1655
argumentValues)}.
1676
1656
- Return the result of {CompleteValue(fieldType, fields, resolvedValue,
1677
- variableValues, path, deferMap, incrementalPublisher, incrementalDataRecord )}.
1657
+ variableValues, path, deferMap, incrementalPublisher, incrementalDataId )}.
1678
1658
1679
1659
### Coercing Field Arguments
1680
1660
@@ -1788,8 +1768,7 @@ variableValues, incrementalPublisher, parentIncrementalDataRecord):
1788
1768
- Let {streamFieldGroup} be the result of {GetStreamFieldGroup(fieldGroup)}.
1789
1769
- Repeat the following steps:
1790
1770
- 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.
1793
1772
- Let {parentIds} be an empty list.
1794
1773
- If {currentParent} is a Deferred Grouped Field Set Record.
1795
1774
- Let {deferredFragments} be the corresponding entry on {currentParent}.
@@ -1812,7 +1791,6 @@ variableValues, incrementalPublisher, parentIncrementalDataRecord):
1812
1791
and {incrementalErrors}.
1813
1792
- Return.
1814
1793
- If an item is not retrieved because {iterator} has completed:
1815
- - Let {id} be the corresponding entry on {streamItems}
1816
1794
- Enqueue a Completed Empty Stream Items Event on {eventQueue} with details
1817
1795
{id}.
1818
1796
- Return.
@@ -1825,22 +1803,20 @@ variableValues, incrementalPublisher, parentIncrementalDataRecord):
1825
1803
{innerType} is a Non-Nullable type, let {incrementalErrors} be the list of
1826
1804
those errors:
1827
1805
- Set {errored} to {true}.
1828
- - Let {id} be the corresponding entry on {streamItems}
1829
1806
- Enqueue an Errored Stream Items Event on {eventQueue} with details {id}
1830
1807
and {incrementalErrors}.
1831
1808
- Return.
1832
1809
- Let {errors} be the list of all _ field error_ raised while completing this
1833
1810
item.
1834
1811
- Initialize {items} to an list containing the single item {data}.
1835
- - Let {id} be the corresponding entry on {streamItems}
1836
1812
- Enqueue a Completed Stream Items Event on {eventQueue} with details {id},
1837
1813
{items}, and {errors}.
1838
1814
- Increment {currentIndex}.
1839
1815
- Set {currentParent} to {streamItems}.
1840
1816
- Increment {index}.
1841
1817
1842
1818
CompleteValue(fieldType, fieldGroup, result, variableValues, path, deferMap,
1843
- incrementalPublisher, incrementalDataRecord ):
1819
+ incrementalPublisher, incrementalDataId ):
1844
1820
1845
1821
- If the {fieldType} is a Non-Null type:
1846
1822
- Let {innerType} be the inner type of {fieldType}.
@@ -1872,15 +1848,13 @@ incrementalPublisher, incrementalDataRecord):
1872
1848
- While {result} is not closed:
1873
1849
- If {streamDirective} is defined and {index} is greater than or equal to
1874
1850
{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.
1877
1852
- Let {earlyReturn} be the implementation-specific value denoting how to
1878
1853
notify {iterator} that no additional items will be requested.
1879
1854
- Enqueue a New Stream Event on {eventQueue} with details {id}, {label},
1880
1855
{path}, and {earlyReturn}.
1881
1856
- Call {ExecuteStreamField(stream, path, iterator, fieldGroup, index,
1882
- innerType, variableValues, incrementalPublisher,
1883
- incrementalDataRecord)}.
1857
+ innerType, variableValues, incrementalPublisher, incrementalDataId)}.
1884
1858
- Return {items}.
1885
1859
- Otherwise:
1886
1860
- Wait for the next item from {result} via the {iterator}.
@@ -1889,7 +1863,7 @@ incrementalPublisher, incrementalDataRecord):
1889
1863
- Let {itemPath} be {path} with {index} appended.
1890
1864
- Let {resolvedItem} be the result of calling {CompleteValue(innerType,
1891
1865
fields, resultItem, variableValues, itemPath, deferMap,
1892
- incrementalPublisher, incrementalDataRecord )}.
1866
+ incrementalPublisher, incrementalDataId )}.
1893
1867
- Append {resolvedItem} to {items}.
1894
1868
- Increment {index}.
1895
1869
- Return {items}.
@@ -1904,13 +1878,13 @@ incrementalPublisher, incrementalDataRecord):
1904
1878
{ProcessSubSelectionSets(objectType, fieldGroup, variableValues)}.
1905
1879
- Let {newDeferMap} be the result of
1906
1880
{AddNewDeferFragments(incrementalPublisher, newDeferUsages,
1907
- incrementalDataRecord , deferMap, path)}.
1881
+ incrementalDataId , deferMap, path)}.
1908
1882
- Let {detailsList} be the result of
1909
1883
{AddNewDeferredGroupedFieldSets(incrementalPublisher, groupDetailsMap,
1910
1884
newDeferMap, path)}.
1911
1885
- Let {completed} be the result of evaluating
1912
1886
{ExecuteGroupedFieldSet(groupedFieldSet, objectType, result, variableValues,
1913
- path, newDeferMap, incrementalPublisher, incrementalDataRecord )} _ normally_
1887
+ path, newDeferMap, incrementalPublisher, incrementalDataId )} _ normally_
1914
1888
(allowing for parallelization).
1915
1889
- In parallel, call {ExecuteDeferredGroupedFieldSets(objectType, result,
1916
1890
variableValues, incrementalPublisher, detailsList, newDeferMap)}.
0 commit comments