strawberry-graphql 0.227.2__py3-none-any.whl → 0.227.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- strawberry/relay/types.py +12 -1
- strawberry/relay/utils.py +24 -0
- {strawberry_graphql-0.227.2.dist-info → strawberry_graphql-0.227.3.dist-info}/METADATA +1 -1
- {strawberry_graphql-0.227.2.dist-info → strawberry_graphql-0.227.3.dist-info}/RECORD +7 -7
- {strawberry_graphql-0.227.2.dist-info → strawberry_graphql-0.227.3.dist-info}/LICENSE +0 -0
- {strawberry_graphql-0.227.2.dist-info → strawberry_graphql-0.227.3.dist-info}/WHEEL +0 -0
- {strawberry_graphql-0.227.2.dist-info → strawberry_graphql-0.227.3.dist-info}/entry_points.txt +0 -0
strawberry/relay/types.py
CHANGED
@@ -38,7 +38,7 @@ from strawberry.utils.aio import aenumerate, aislice, resolve_awaitable
|
|
38
38
|
from strawberry.utils.inspect import in_async_context
|
39
39
|
from strawberry.utils.typing import eval_type, is_classvar
|
40
40
|
|
41
|
-
from .utils import from_base64, to_base64
|
41
|
+
from .utils import from_base64, should_resolve_list_connection_edges, to_base64
|
42
42
|
|
43
43
|
if TYPE_CHECKING:
|
44
44
|
from strawberry.scalars import ID
|
@@ -933,6 +933,17 @@ class ListConnection(Connection[NodeType]):
|
|
933
933
|
overfetch,
|
934
934
|
)
|
935
935
|
|
936
|
+
if not should_resolve_list_connection_edges(info):
|
937
|
+
return cls(
|
938
|
+
edges=[],
|
939
|
+
page_info=PageInfo(
|
940
|
+
start_cursor=None,
|
941
|
+
end_cursor=None,
|
942
|
+
has_previous_page=False,
|
943
|
+
has_next_page=False,
|
944
|
+
),
|
945
|
+
)
|
946
|
+
|
936
947
|
edges = [
|
937
948
|
edge_class.resolve_edge(
|
938
949
|
cls.resolve_node(v, info=info, **kwargs),
|
strawberry/relay/utils.py
CHANGED
@@ -2,6 +2,8 @@ import base64
|
|
2
2
|
from typing import Any, Tuple, Union
|
3
3
|
from typing_extensions import assert_never
|
4
4
|
|
5
|
+
from strawberry.types.info import Info
|
6
|
+
from strawberry.types.nodes import InlineFragment
|
5
7
|
from strawberry.types.types import StrawberryObjectDefinition
|
6
8
|
|
7
9
|
|
@@ -61,3 +63,25 @@ def to_base64(type_: Union[str, type, StrawberryObjectDefinition], node_id: Any)
|
|
61
63
|
raise ValueError(f"{type_} is not a valid GraphQL type or name") from e
|
62
64
|
|
63
65
|
return base64.b64encode(f"{type_name}:{node_id}".encode()).decode()
|
66
|
+
|
67
|
+
|
68
|
+
def should_resolve_list_connection_edges(info: Info) -> bool:
|
69
|
+
"""Check if the user requested to resolve the `edges` field of a connection.
|
70
|
+
|
71
|
+
Args:
|
72
|
+
info:
|
73
|
+
The strawberry execution info resolve the type name from
|
74
|
+
|
75
|
+
Returns:
|
76
|
+
True if the user requested to resolve the `edges` field of a connection, False otherwise.
|
77
|
+
|
78
|
+
"""
|
79
|
+
resolve_for_field_names = {"edges", "pageInfo"}
|
80
|
+
for selection_field in info.selected_fields:
|
81
|
+
for selection in selection_field.selections:
|
82
|
+
if (
|
83
|
+
not isinstance(selection, InlineFragment)
|
84
|
+
and selection.name in resolve_for_field_names
|
85
|
+
):
|
86
|
+
return True
|
87
|
+
return False
|
@@ -173,8 +173,8 @@ strawberry/quart/views.py,sha256=SDUaDX7bPKsv8PziMPb0C3nH6vre-Q3bhzSQp4uPjbY,340
|
|
173
173
|
strawberry/relay/__init__.py,sha256=Vi4btvA_g6Cj9Tk_F9GCSegapIf2WqkOWV8y3P0cTCs,553
|
174
174
|
strawberry/relay/exceptions.py,sha256=b7sU2MhHVWJOfq27lvqdFcqBZ5P_JWk41JWRjtP-AOI,3916
|
175
175
|
strawberry/relay/fields.py,sha256=0A96V4mQzFJwP9g68tM3zKmbPxnfU2Ix6kbMI-x11LQ,15550
|
176
|
-
strawberry/relay/types.py,sha256=
|
177
|
-
strawberry/relay/utils.py,sha256=
|
176
|
+
strawberry/relay/types.py,sha256=pCFD0UXXofmdTS2wBURjg8KwIfdioMt2j4qNYfk6GqQ,30710
|
177
|
+
strawberry/relay/utils.py,sha256=CaNgiNXD8bRA5oSgIFgBGb9OeEtKvrJS1eCLzNQKAgg,2548
|
178
178
|
strawberry/resolvers.py,sha256=g7_g3jmXszziGydY1UG6IItf9s6B1lGLUCnwW1kb8U0,224
|
179
179
|
strawberry/sanic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
180
180
|
strawberry/sanic/context.py,sha256=qfoj8QMaAiWbCQFAdm2KPPJGNc7ilXeKAl5z0XJ2nzo,805
|
@@ -241,8 +241,8 @@ strawberry/utils/logging.py,sha256=flS7hV0JiIOEdXcrIjda4WyIWix86cpHHFNJL8gl1y4,7
|
|
241
241
|
strawberry/utils/operation.py,sha256=Um-tBCPl3_bVFN2Ph7o1mnrxfxBes4HFCj6T0x4kZxE,1135
|
242
242
|
strawberry/utils/str_converters.py,sha256=avIgPVLg98vZH9mA2lhzVdyyjqzLsK2NdBw9mJQ02Xk,813
|
243
243
|
strawberry/utils/typing.py,sha256=SQVOw1nuFZk2Pe3iz0o8ebzpoyvBVoGSQZVZj6-8k7I,13483
|
244
|
-
strawberry_graphql-0.227.
|
245
|
-
strawberry_graphql-0.227.
|
246
|
-
strawberry_graphql-0.227.
|
247
|
-
strawberry_graphql-0.227.
|
248
|
-
strawberry_graphql-0.227.
|
244
|
+
strawberry_graphql-0.227.3.dist-info/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
|
245
|
+
strawberry_graphql-0.227.3.dist-info/METADATA,sha256=tJc-Ps5pIPYsvALYUXKSIVQuZxXjolNhNPnExDSqSoU,7821
|
246
|
+
strawberry_graphql-0.227.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
247
|
+
strawberry_graphql-0.227.3.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
|
248
|
+
strawberry_graphql-0.227.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|
{strawberry_graphql-0.227.2.dist-info → strawberry_graphql-0.227.3.dist-info}/entry_points.txt
RENAMED
File without changes
|