41
41
from ..error import GraphQLError , GraphQLFormattedError , located_error
42
42
from ..language import (
43
43
DocumentNode ,
44
- FieldNode ,
45
44
FragmentDefinitionNode ,
46
45
OperationDefinitionNode ,
47
46
OperationType ,
75
74
is_object_type ,
76
75
)
77
76
from .async_iterables import map_async_iterable
78
- from .collect_fields import FieldsAndPatches , collect_fields , collect_subfields
77
+ from .collect_fields import (
78
+ FieldGroup ,
79
+ FieldsAndPatches ,
80
+ collect_fields ,
81
+ collect_subfields ,
82
+ )
79
83
from .middleware import MiddlewareManager
80
84
from .values import get_argument_values , get_directive_values , get_variable_values
81
85
@@ -837,7 +841,7 @@ def execute_fields_serially(
837
841
parent_type : GraphQLObjectType ,
838
842
source_value : Any ,
839
843
path : Path | None ,
840
- fields : dict [str , list [ FieldNode ] ],
844
+ fields : dict [str , FieldGroup ],
841
845
) -> AwaitableOrValue [dict [str , Any ]]:
842
846
"""Execute the given fields serially.
843
847
@@ -847,7 +851,7 @@ def execute_fields_serially(
847
851
is_awaitable = self .is_awaitable
848
852
849
853
def reducer (
850
- results : dict [str , Any ], field_item : tuple [str , list [ FieldNode ] ]
854
+ results : dict [str , Any ], field_item : tuple [str , FieldGroup ]
851
855
) -> AwaitableOrValue [dict [str , Any ]]:
852
856
response_name , field_nodes = field_item
853
857
field_path = Path (path , response_name , parent_type .name )
@@ -877,7 +881,7 @@ def execute_fields(
877
881
parent_type : GraphQLObjectType ,
878
882
source_value : Any ,
879
883
path : Path | None ,
880
- fields : dict [str , list [ FieldNode ] ],
884
+ fields : dict [str , FieldGroup ],
881
885
async_payload_record : AsyncPayloadRecord | None = None ,
882
886
) -> AwaitableOrValue [dict [str , Any ]]:
883
887
"""Execute the given fields concurrently.
@@ -927,7 +931,7 @@ def execute_field(
927
931
self ,
928
932
parent_type : GraphQLObjectType ,
929
933
source : Any ,
930
- field_nodes : list [ FieldNode ] ,
934
+ field_nodes : FieldGroup ,
931
935
path : Path ,
932
936
async_payload_record : AsyncPayloadRecord | None = None ,
933
937
) -> AwaitableOrValue [Any ]:
@@ -996,7 +1000,7 @@ async def await_completed() -> Any:
996
1000
def build_resolve_info (
997
1001
self ,
998
1002
field_def : GraphQLField ,
999
- field_nodes : list [ FieldNode ] ,
1003
+ field_nodes : FieldGroup ,
1000
1004
parent_type : GraphQLObjectType ,
1001
1005
path : Path ,
1002
1006
) -> GraphQLResolveInfo :
@@ -1024,7 +1028,7 @@ def build_resolve_info(
1024
1028
def complete_value (
1025
1029
self ,
1026
1030
return_type : GraphQLOutputType ,
1027
- field_nodes : list [ FieldNode ] ,
1031
+ field_nodes : FieldGroup ,
1028
1032
info : GraphQLResolveInfo ,
1029
1033
path : Path ,
1030
1034
result : Any ,
@@ -1113,7 +1117,7 @@ def complete_value(
1113
1117
async def complete_awaitable_value (
1114
1118
self ,
1115
1119
return_type : GraphQLOutputType ,
1116
- field_nodes : list [ FieldNode ] ,
1120
+ field_nodes : FieldGroup ,
1117
1121
info : GraphQLResolveInfo ,
1118
1122
path : Path ,
1119
1123
result : Any ,
@@ -1143,7 +1147,7 @@ async def complete_awaitable_value(
1143
1147
return completed
1144
1148
1145
1149
def get_stream_values (
1146
- self , field_nodes : list [ FieldNode ] , path : Path
1150
+ self , field_nodes : FieldGroup , path : Path
1147
1151
) -> StreamArguments | None :
1148
1152
"""Get stream values.
1149
1153
@@ -1182,7 +1186,7 @@ def get_stream_values(
1182
1186
async def complete_async_iterator_value (
1183
1187
self ,
1184
1188
item_type : GraphQLOutputType ,
1185
- field_nodes : list [ FieldNode ] ,
1189
+ field_nodes : FieldGroup ,
1186
1190
info : GraphQLResolveInfo ,
1187
1191
path : Path ,
1188
1192
iterator : AsyncIterator [Any ],
@@ -1269,7 +1273,7 @@ async def complete_async_iterator_value(
1269
1273
def complete_list_value (
1270
1274
self ,
1271
1275
return_type : GraphQLList [GraphQLOutputType ],
1272
- field_nodes : list [ FieldNode ] ,
1276
+ field_nodes : FieldGroup ,
1273
1277
info : GraphQLResolveInfo ,
1274
1278
path : Path ,
1275
1279
result : AsyncIterable [Any ] | Iterable [Any ],
@@ -1367,7 +1371,7 @@ def complete_list_item_value(
1367
1371
complete_results : list [Any ],
1368
1372
errors : list [GraphQLError ],
1369
1373
item_type : GraphQLOutputType ,
1370
- field_nodes : list [ FieldNode ] ,
1374
+ field_nodes : FieldGroup ,
1371
1375
info : GraphQLResolveInfo ,
1372
1376
item_path : Path ,
1373
1377
async_payload_record : AsyncPayloadRecord | None ,
@@ -1442,7 +1446,7 @@ def complete_leaf_value(return_type: GraphQLLeafType, result: Any) -> Any:
1442
1446
def complete_abstract_value (
1443
1447
self ,
1444
1448
return_type : GraphQLAbstractType ,
1445
- field_nodes : list [ FieldNode ] ,
1449
+ field_nodes : FieldGroup ,
1446
1450
info : GraphQLResolveInfo ,
1447
1451
path : Path ,
1448
1452
result : Any ,
@@ -1496,7 +1500,7 @@ def ensure_valid_runtime_type(
1496
1500
self ,
1497
1501
runtime_type_name : Any ,
1498
1502
return_type : GraphQLAbstractType ,
1499
- field_nodes : list [ FieldNode ] ,
1503
+ field_nodes : FieldGroup ,
1500
1504
info : GraphQLResolveInfo ,
1501
1505
result : Any ,
1502
1506
) -> GraphQLObjectType :
@@ -1557,7 +1561,7 @@ def ensure_valid_runtime_type(
1557
1561
def complete_object_value (
1558
1562
self ,
1559
1563
return_type : GraphQLObjectType ,
1560
- field_nodes : list [ FieldNode ] ,
1564
+ field_nodes : FieldGroup ,
1561
1565
info : GraphQLResolveInfo ,
1562
1566
path : Path ,
1563
1567
result : Any ,
@@ -1593,7 +1597,7 @@ async def execute_subfields_async() -> dict[str, Any]:
1593
1597
def collect_and_execute_subfields (
1594
1598
self ,
1595
1599
return_type : GraphQLObjectType ,
1596
- field_nodes : list [ FieldNode ] ,
1600
+ field_nodes : FieldGroup ,
1597
1601
path : Path ,
1598
1602
result : Any ,
1599
1603
async_payload_record : AsyncPayloadRecord | None ,
@@ -1619,7 +1623,7 @@ def collect_and_execute_subfields(
1619
1623
return sub_fields
1620
1624
1621
1625
def collect_subfields (
1622
- self , return_type : GraphQLObjectType , field_nodes : list [ FieldNode ]
1626
+ self , return_type : GraphQLObjectType , field_nodes : FieldGroup
1623
1627
) -> FieldsAndPatches :
1624
1628
"""Collect subfields.
1625
1629
@@ -1688,7 +1692,7 @@ def execute_deferred_fragment(
1688
1692
self ,
1689
1693
parent_type : GraphQLObjectType ,
1690
1694
source_value : Any ,
1691
- fields : dict [str , list [ FieldNode ] ],
1695
+ fields : dict [str , FieldGroup ],
1692
1696
label : str | None = None ,
1693
1697
path : Path | None = None ,
1694
1698
parent_context : AsyncPayloadRecord | None = None ,
@@ -1724,7 +1728,7 @@ def execute_stream_field(
1724
1728
path : Path ,
1725
1729
item_path : Path ,
1726
1730
item : AwaitableOrValue [Any ],
1727
- field_nodes : list [ FieldNode ] ,
1731
+ field_nodes : FieldGroup ,
1728
1732
info : GraphQLResolveInfo ,
1729
1733
item_type : GraphQLOutputType ,
1730
1734
label : str | None = None ,
@@ -1817,7 +1821,7 @@ async def await_completed_items() -> list[Any] | None:
1817
1821
async def execute_stream_iterator_item (
1818
1822
self ,
1819
1823
iterator : AsyncIterator [Any ],
1820
- field_nodes : list [ FieldNode ] ,
1824
+ field_nodes : FieldGroup ,
1821
1825
info : GraphQLResolveInfo ,
1822
1826
item_type : GraphQLOutputType ,
1823
1827
async_payload_record : StreamRecord ,
@@ -1851,7 +1855,7 @@ async def execute_stream_iterator(
1851
1855
self ,
1852
1856
initial_index : int ,
1853
1857
iterator : AsyncIterator [Any ],
1854
- field_modes : list [ FieldNode ] ,
1858
+ field_modes : FieldGroup ,
1855
1859
info : GraphQLResolveInfo ,
1856
1860
item_type : GraphQLOutputType ,
1857
1861
path : Path ,
@@ -2238,7 +2242,7 @@ def handle_field_error(
2238
2242
2239
2243
2240
2244
def invalid_return_type_error (
2241
- return_type : GraphQLObjectType , result : Any , field_nodes : list [ FieldNode ]
2245
+ return_type : GraphQLObjectType , result : Any , field_nodes : FieldGroup
2242
2246
) -> GraphQLError :
2243
2247
"""Create a GraphQLError for an invalid return type."""
2244
2248
return GraphQLError (
0 commit comments