strawberry-graphql 0.237.0__py3-none-any.whl → 0.237.2__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/asgi/__init__.py +1 -1
- strawberry/fastapi/router.py +5 -40
- strawberry/schema/schema.py +10 -7
- strawberry/subscriptions/protocols/graphql_ws/handlers.py +2 -1
- {strawberry_graphql-0.237.0.dist-info → strawberry_graphql-0.237.2.dist-info}/METADATA +2 -2
- {strawberry_graphql-0.237.0.dist-info → strawberry_graphql-0.237.2.dist-info}/RECORD +9 -9
- {strawberry_graphql-0.237.0.dist-info → strawberry_graphql-0.237.2.dist-info}/LICENSE +0 -0
- {strawberry_graphql-0.237.0.dist-info → strawberry_graphql-0.237.2.dist-info}/WHEEL +0 -0
- {strawberry_graphql-0.237.0.dist-info → strawberry_graphql-0.237.2.dist-info}/entry_points.txt +0 -0
strawberry/asgi/__init__.py
CHANGED
strawberry/fastapi/router.py
CHANGED
@@ -10,7 +10,6 @@ from typing import (
|
|
10
10
|
Callable,
|
11
11
|
Dict,
|
12
12
|
List,
|
13
|
-
Mapping,
|
14
13
|
Optional,
|
15
14
|
Sequence,
|
16
15
|
Type,
|
@@ -33,19 +32,14 @@ from fastapi import APIRouter, Depends, params
|
|
33
32
|
from fastapi.datastructures import Default
|
34
33
|
from fastapi.routing import APIRoute
|
35
34
|
from fastapi.utils import generate_unique_id
|
35
|
+
from strawberry.asgi import ASGIRequestAdapter
|
36
36
|
from strawberry.exceptions import InvalidCustomContext
|
37
37
|
from strawberry.fastapi.context import BaseContext, CustomContext
|
38
38
|
from strawberry.fastapi.handlers import GraphQLTransportWSHandler, GraphQLWSHandler
|
39
|
-
from strawberry.http import
|
40
|
-
|
41
|
-
)
|
42
|
-
from strawberry.http.async_base_view import AsyncBaseHTTPView, AsyncHTTPRequestAdapter
|
39
|
+
from strawberry.http import process_result
|
40
|
+
from strawberry.http.async_base_view import AsyncBaseHTTPView
|
43
41
|
from strawberry.http.exceptions import HTTPException
|
44
|
-
from strawberry.http.
|
45
|
-
from strawberry.http.typevars import (
|
46
|
-
Context,
|
47
|
-
RootValue,
|
48
|
-
)
|
42
|
+
from strawberry.http.typevars import Context, RootValue
|
49
43
|
from strawberry.subscriptions import GRAPHQL_TRANSPORT_WS_PROTOCOL, GRAPHQL_WS_PROTOCOL
|
50
44
|
|
51
45
|
if TYPE_CHECKING:
|
@@ -61,42 +55,13 @@ if TYPE_CHECKING:
|
|
61
55
|
from strawberry.types import ExecutionResult
|
62
56
|
|
63
57
|
|
64
|
-
class FastAPIRequestAdapter(AsyncHTTPRequestAdapter):
|
65
|
-
def __init__(self, request: Request) -> None:
|
66
|
-
self.request = request
|
67
|
-
|
68
|
-
@property
|
69
|
-
def query_params(self) -> QueryParams:
|
70
|
-
return dict(self.request.query_params)
|
71
|
-
|
72
|
-
@property
|
73
|
-
def method(self) -> HTTPMethod:
|
74
|
-
return cast(HTTPMethod, self.request.method.upper())
|
75
|
-
|
76
|
-
@property
|
77
|
-
def headers(self) -> Mapping[str, str]:
|
78
|
-
return self.request.headers
|
79
|
-
|
80
|
-
@property
|
81
|
-
def content_type(self) -> Optional[str]:
|
82
|
-
return self.request.headers.get("Content-Type", None)
|
83
|
-
|
84
|
-
async def get_body(self) -> bytes:
|
85
|
-
return await self.request.body()
|
86
|
-
|
87
|
-
async def get_form_data(self) -> FormData:
|
88
|
-
multipart_data = await self.request.form()
|
89
|
-
|
90
|
-
return FormData(files=multipart_data, form=multipart_data)
|
91
|
-
|
92
|
-
|
93
58
|
class GraphQLRouter(
|
94
59
|
AsyncBaseHTTPView[Request, Response, Response, Context, RootValue], APIRouter
|
95
60
|
):
|
96
61
|
graphql_ws_handler_class = GraphQLWSHandler
|
97
62
|
graphql_transport_ws_handler_class = GraphQLTransportWSHandler
|
98
63
|
allow_queries_via_get = True
|
99
|
-
request_adapter_class =
|
64
|
+
request_adapter_class = ASGIRequestAdapter
|
100
65
|
|
101
66
|
@staticmethod
|
102
67
|
async def __get_root_value() -> None:
|
strawberry/schema/schema.py
CHANGED
@@ -41,6 +41,7 @@ from strawberry.types.base import StrawberryObjectDefinition, has_object_definit
|
|
41
41
|
from strawberry.types.graphql import OperationType
|
42
42
|
|
43
43
|
from ..printer import print_schema
|
44
|
+
from ..utils.await_maybe import await_maybe
|
44
45
|
from . import compat
|
45
46
|
from .base import BaseSchema
|
46
47
|
from .config import StrawberryConfig
|
@@ -349,13 +350,15 @@ class Schema(BaseSchema):
|
|
349
350
|
root_value: Optional[Any] = None,
|
350
351
|
operation_name: Optional[str] = None,
|
351
352
|
) -> Union[AsyncIterator[GraphQLExecutionResult], GraphQLExecutionResult]:
|
352
|
-
return await
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
353
|
+
return await await_maybe(
|
354
|
+
subscribe(
|
355
|
+
self._schema,
|
356
|
+
parse(query),
|
357
|
+
root_value=root_value,
|
358
|
+
context_value=context_value,
|
359
|
+
variable_values=variable_values,
|
360
|
+
operation_name=operation_name,
|
361
|
+
)
|
359
362
|
)
|
360
363
|
|
361
364
|
def _resolve_node_ids(self) -> None:
|
@@ -190,7 +190,8 @@ class BaseGraphQLWSHandler(ABC):
|
|
190
190
|
await self.send_message(GQL_COMPLETE, operation_id, None)
|
191
191
|
|
192
192
|
async def cleanup_operation(self, operation_id: str) -> None:
|
193
|
-
|
193
|
+
with suppress(RuntimeError):
|
194
|
+
await self.subscriptions[operation_id].aclose()
|
194
195
|
del self.subscriptions[operation_id]
|
195
196
|
|
196
197
|
self.tasks[operation_id].cancel()
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: strawberry-graphql
|
3
|
-
Version: 0.237.
|
3
|
+
Version: 0.237.2
|
4
4
|
Summary: A library for creating GraphQL APIs
|
5
5
|
Home-page: https://strawberry.rocks/
|
6
6
|
License: MIT
|
@@ -45,7 +45,7 @@ Requires-Dist: channels (>=3.0.5) ; extra == "channels"
|
|
45
45
|
Requires-Dist: fastapi (>=0.65.2) ; extra == "fastapi"
|
46
46
|
Requires-Dist: flask (>=1.1) ; extra == "flask"
|
47
47
|
Requires-Dist: graphlib_backport ; (python_version < "3.9") and (extra == "cli")
|
48
|
-
Requires-Dist: graphql-core (>=3.2.0,<3.
|
48
|
+
Requires-Dist: graphql-core (>=3.2.0,<3.4.0)
|
49
49
|
Requires-Dist: libcst (>=0.4.7) ; extra == "debug" or extra == "debug-server" or extra == "cli"
|
50
50
|
Requires-Dist: litestar (>=2) ; (python_version >= "3.8") and (extra == "litestar")
|
51
51
|
Requires-Dist: opentelemetry-api (<2) ; extra == "opentelemetry"
|
@@ -8,7 +8,7 @@ strawberry/aiohttp/test/__init__.py,sha256=4xxdUZtIISSOwjrcnmox7AvT4WWjowCm5bUuP
|
|
8
8
|
strawberry/aiohttp/test/client.py,sha256=4vjTDxtNVfpa74GfUUO7efPI6Ssh1vzfCYp3tPA-SLk,1357
|
9
9
|
strawberry/aiohttp/views.py,sha256=3Imc-kP01zhDYmWQRFcQyZsObqdELQ84d-3zFrpHNxA,6091
|
10
10
|
strawberry/annotation.py,sha256=ftSxGZQUk4C5_5YRM_wNJFVVnZi0XOp71kD7zv4oxbU,13077
|
11
|
-
strawberry/asgi/__init__.py,sha256=
|
11
|
+
strawberry/asgi/__init__.py,sha256=H3CT6wRrnNv7BulbnHocLqjo2EKhGwQgBj33lOeIF80,7007
|
12
12
|
strawberry/asgi/handlers/__init__.py,sha256=rz5Gth2eJUn7tDq2--99KSNFeMdDPpLFCkfA7vge0cI,235
|
13
13
|
strawberry/asgi/handlers/graphql_transport_ws_handler.py,sha256=_5N58XdtCZndU81ky1f5cwG9E4NhysxP4uHlqqZNzn4,2147
|
14
14
|
strawberry/asgi/handlers/graphql_ws_handler.py,sha256=KQXmbk7uDwiG1yOadz65GsSzjAPUjKrpEQYAA94nGRM,2379
|
@@ -123,7 +123,7 @@ strawberry/fastapi/context.py,sha256=07991DShQoYMBVyQl9Mh5xvXQSNQI2RXT2ZQ5fWiga4
|
|
123
123
|
strawberry/fastapi/handlers/__init__.py,sha256=TziBHyibYBOGiidjpCkjNThYbVY7K_nt0hnRLVHVh3I,241
|
124
124
|
strawberry/fastapi/handlers/graphql_transport_ws_handler.py,sha256=5ivH7DJup0ZyGawAcj-n9VE_exBTje9Hou0_GIZCyD4,591
|
125
125
|
strawberry/fastapi/handlers/graphql_ws_handler.py,sha256=OTloVUvEgXDpqjOlBAT1FnaNWRAglQgAt613YH06roc,537
|
126
|
-
strawberry/fastapi/router.py,sha256=
|
126
|
+
strawberry/fastapi/router.py,sha256=BCPQxLJb6439-KqOD6wj5dDkcY2RaUo7u8pLI1EuSkU,12438
|
127
127
|
strawberry/federation/__init__.py,sha256=FeUxLiBVuk9TKBmJJi51SeUaI8c80rS8hbl9No-hjII,535
|
128
128
|
strawberry/federation/argument.py,sha256=2m_wgp7uFQDimTDDCBBqSoWeTop4MD1-KjjYrumEJIw,833
|
129
129
|
strawberry/federation/enum.py,sha256=1rx50FiSMS-NjEFErhRSYB5no8TPsGMA_cH7hVbxAFI,3015
|
@@ -183,7 +183,7 @@ strawberry/schema/config.py,sha256=Aa01oqnHb0ZPlw8Ti_O840LxlT827LNio15BQrc37A0,7
|
|
183
183
|
strawberry/schema/exceptions.py,sha256=rqVNb_oYrKM0dHPgvAemqCG6Um282LPPu4zwQ5cZqs4,584
|
184
184
|
strawberry/schema/execute.py,sha256=74eGjXrptVO_EP-luZmSHUeXtt3Lk5BbEoZv9v7w0jo,10840
|
185
185
|
strawberry/schema/name_converter.py,sha256=tpqw2XCSFvJI-H844iWhE2Z1sKic7DrjIZxt11eJN5Y,6574
|
186
|
-
strawberry/schema/schema.py,sha256=
|
186
|
+
strawberry/schema/schema.py,sha256=ySwPFbUWhoo8G6GLZjsF9kxvQ9jGmw8ibYZFOTtwZRU,15896
|
187
187
|
strawberry/schema/schema_converter.py,sha256=lckL2LoxAb6mNfJIVcerht2buzBG573ly3BHyl7wra4,36859
|
188
188
|
strawberry/schema/types/__init__.py,sha256=oHO3COWhL3L1KLYCJNY1XFf5xt2GGtHiMC-UaYbFfnA,68
|
189
189
|
strawberry/schema/types/base_scalars.py,sha256=NTj_tYqWLQLEOPDhBhSE1My4JXoieyg0jO8B6RNK-xA,1913
|
@@ -208,7 +208,7 @@ strawberry/subscriptions/protocols/graphql_transport_ws/__init__.py,sha256=wN6dk
|
|
208
208
|
strawberry/subscriptions/protocols/graphql_transport_ws/handlers.py,sha256=P56QgUkiDuwoRHl8WKbtssDShQbgKuMY0FXYAPY6VgE,15133
|
209
209
|
strawberry/subscriptions/protocols/graphql_transport_ws/types.py,sha256=rJQWeNcsHevAuxYYocz4F6DO3PR-IgWF_KYsx5VWN4s,2420
|
210
210
|
strawberry/subscriptions/protocols/graphql_ws/__init__.py,sha256=ijn1A1O0Fzv5p9n-jw3T5H7M3oxbN4gbxRaepN7HyJk,553
|
211
|
-
strawberry/subscriptions/protocols/graphql_ws/handlers.py,sha256=
|
211
|
+
strawberry/subscriptions/protocols/graphql_ws/handlers.py,sha256=zptIxudunKCf-5FEB51n7t7KN0nRzSko6_-ya0gpYD4,7623
|
212
212
|
strawberry/subscriptions/protocols/graphql_ws/types.py,sha256=gYFCHMoRr7ko5lrE7dRITwoRvDmF6w8fFnw04sh-XEI,1009
|
213
213
|
strawberry/test/__init__.py,sha256=U3B5Ng7C_H8GpCpfvgZZcfADMw6cor5hm78gS3nDdMI,115
|
214
214
|
strawberry/test/client.py,sha256=-V_5DakR0NJ_Kd5ww4leIhMnIJ-Pf274HkNqYtGVfl8,6044
|
@@ -248,8 +248,8 @@ strawberry/utils/logging.py,sha256=U1cseHGquN09YFhFmRkiphfASKCyK0HUZREImPgVb0c,7
|
|
248
248
|
strawberry/utils/operation.py,sha256=SSXxN-vMqdHO6W2OZtip-1z7y4_A-eTVFdhDvhKeLCk,1193
|
249
249
|
strawberry/utils/str_converters.py,sha256=KGd7QH90RevaJjH6SQEkiVVsb8KuhJr_wv5AsI7UzQk,897
|
250
250
|
strawberry/utils/typing.py,sha256=tUHHX2YTGX417EEQHB6j0B8-p-fg31ZI8csc9SUoq2I,14260
|
251
|
-
strawberry_graphql-0.237.
|
252
|
-
strawberry_graphql-0.237.
|
253
|
-
strawberry_graphql-0.237.
|
254
|
-
strawberry_graphql-0.237.
|
255
|
-
strawberry_graphql-0.237.
|
251
|
+
strawberry_graphql-0.237.2.dist-info/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
|
252
|
+
strawberry_graphql-0.237.2.dist-info/METADATA,sha256=5PymBcxghEa1kolprc9HA75kJ63NPCBI6d_MXnqQisY,7821
|
253
|
+
strawberry_graphql-0.237.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
254
|
+
strawberry_graphql-0.237.2.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
|
255
|
+
strawberry_graphql-0.237.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
{strawberry_graphql-0.237.0.dist-info → strawberry_graphql-0.237.2.dist-info}/entry_points.txt
RENAMED
File without changes
|