strawberry-graphql 0.244.0__py3-none-any.whl → 0.245.0__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.
@@ -54,7 +54,6 @@ class GraphQLView(
54
54
  ):
55
55
  allow_queries_via_get: bool = True
56
56
  request_adapter_class = ChaliceHTTPRequestAdapter
57
- _ide_subscription_enabled = False
58
57
 
59
58
  def __init__(
60
59
  self,
@@ -167,14 +167,11 @@ class BaseGraphQLHTTPConsumer(ChannelsConsumer, AsyncHttpConsumer):
167
167
  graphiql: Optional[bool] = None,
168
168
  graphql_ide: Optional[GraphQL_IDE] = "graphiql",
169
169
  allow_queries_via_get: bool = True,
170
- subscriptions_enabled: bool = True,
171
170
  multipart_uploads_enabled: bool = False,
172
171
  **kwargs: Any,
173
172
  ) -> None:
174
173
  self.schema = schema
175
174
  self.allow_queries_via_get = allow_queries_via_get
176
- self.subscriptions_enabled = subscriptions_enabled
177
- self._ide_subscriptions_enabled = subscriptions_enabled
178
175
  self.multipart_uploads_enabled = multipart_uploads_enabled
179
176
 
180
177
  if graphiql is not None:
@@ -645,20 +645,22 @@ class QueryCodegen:
645
645
  ) -> Tuple[
646
646
  Union[type, StrawberryType], Optional[Callable[[GraphQLType], GraphQLType]]
647
647
  ]:
648
- wrapper = None
648
+ wrapper: Optional[Callable[[GraphQLType], GraphQLType]] = None
649
649
 
650
650
  if isinstance(type_, StrawberryOptional):
651
- type_, wrapper = self._unwrap_type(type_.of_type)
651
+ type_, previous_wrapper = self._unwrap_type(type_.of_type)
652
652
  wrapper = (
653
653
  GraphQLOptional
654
- if wrapper is None
655
- else lambda t: GraphQLOptional(wrapper(t)) # type: ignore[misc]
654
+ if previous_wrapper is None
655
+ else lambda t: GraphQLOptional(previous_wrapper(t)) # type: ignore[misc]
656
656
  )
657
657
 
658
658
  elif isinstance(type_, StrawberryList):
659
- type_, wrapper = self._unwrap_type(type_.of_type)
659
+ type_, previous_wrapper = self._unwrap_type(type_.of_type)
660
660
  wrapper = (
661
- GraphQLList if wrapper is None else lambda t: GraphQLList(wrapper(t))
661
+ GraphQLList
662
+ if previous_wrapper is None
663
+ else lambda t: GraphQLList(previous_wrapper(t))
662
664
  )
663
665
 
664
666
  elif isinstance(type_, LazyType):
@@ -25,10 +25,8 @@ from django.http import (
25
25
  StreamingHttpResponse,
26
26
  )
27
27
  from django.http.response import HttpResponseBase
28
- from django.template import RequestContext, Template
29
28
  from django.template.exceptions import TemplateDoesNotExist
30
29
  from django.template.loader import render_to_string
31
- from django.template.response import TemplateResponse
32
30
  from django.utils.decorators import classonlymethod
33
31
  from django.views.generic import View
34
32
 
@@ -44,6 +42,8 @@ from strawberry.http.typevars import (
44
42
  from .context import StrawberryDjangoContext
45
43
 
46
44
  if TYPE_CHECKING:
45
+ from django.template.response import TemplateResponse
46
+
47
47
  from strawberry.http import GraphQLHTTPResponse
48
48
  from strawberry.http.ides import GraphQL_IDE
49
49
 
@@ -137,7 +137,6 @@ class AsyncDjangoHTTPRequestAdapter(AsyncHTTPRequestAdapter):
137
137
 
138
138
 
139
139
  class BaseView:
140
- _ide_replace_variables = False
141
140
  graphql_ide_html: str
142
141
 
143
142
  def __init__(
@@ -146,13 +145,11 @@ class BaseView:
146
145
  graphiql: Optional[str] = None,
147
146
  graphql_ide: Optional[GraphQL_IDE] = "graphiql",
148
147
  allow_queries_via_get: bool = True,
149
- subscriptions_enabled: bool = False,
150
148
  multipart_uploads_enabled: bool = False,
151
149
  **kwargs: Any,
152
150
  ) -> None:
153
151
  self.schema = schema
154
152
  self.allow_queries_via_get = allow_queries_via_get
155
- self.subscriptions_enabled = subscriptions_enabled
156
153
  self.multipart_uploads_enabled = multipart_uploads_enabled
157
154
 
158
155
  if graphiql is not None:
@@ -215,7 +212,6 @@ class GraphQLView(
215
212
  ],
216
213
  View,
217
214
  ):
218
- subscriptions_enabled = False
219
215
  graphiql: Optional[bool] = None
220
216
  graphql_ide: Optional[GraphQL_IDE] = "graphiql"
221
217
  allow_queries_via_get = True
@@ -244,16 +240,11 @@ class GraphQLView(
244
240
 
245
241
  def render_graphql_ide(self, request: HttpRequest) -> HttpResponse:
246
242
  try:
247
- template = Template(render_to_string("graphql/graphiql.html"))
243
+ content = render_to_string("graphql/graphiql.html")
248
244
  except TemplateDoesNotExist:
249
- template = Template(self.graphql_ide_html)
250
-
251
- context = {"SUBSCRIPTION_ENABLED": json.dumps(self.subscriptions_enabled)}
245
+ content = self.graphql_ide_html
252
246
 
253
- response = TemplateResponse(request=request, template=None, context=context)
254
- response.content = template.render(RequestContext(request, context))
255
-
256
- return response
247
+ return HttpResponse(content)
257
248
 
258
249
 
259
250
  class AsyncGraphQLView(
@@ -269,7 +260,6 @@ class AsyncGraphQLView(
269
260
  ],
270
261
  View,
271
262
  ):
272
- subscriptions_enabled = False
273
263
  graphiql: Optional[bool] = None
274
264
  graphql_ide: Optional[GraphQL_IDE] = "graphiql"
275
265
  allow_queries_via_get = True
@@ -308,16 +298,11 @@ class AsyncGraphQLView(
308
298
 
309
299
  async def render_graphql_ide(self, request: HttpRequest) -> HttpResponse:
310
300
  try:
311
- template = Template(render_to_string("graphql/graphiql.html"))
301
+ content = render_to_string("graphql/graphiql.html")
312
302
  except TemplateDoesNotExist:
313
- template = Template(self.graphql_ide_html)
303
+ content = self.graphql_ide_html
314
304
 
315
- context = {"SUBSCRIPTION_ENABLED": json.dumps(self.subscriptions_enabled)}
316
-
317
- response = TemplateResponse(request=request, template=None, context=context)
318
- response.content = template.render(RequestContext(request, context))
319
-
320
- return response
305
+ return HttpResponse(content=content)
321
306
 
322
307
  def is_websocket_request(self, request: HttpRequest) -> TypeGuard[HttpRequest]:
323
308
  return False
strawberry/flask/views.py CHANGED
@@ -63,7 +63,6 @@ class FlaskHTTPRequestAdapter(SyncHTTPRequestAdapter):
63
63
 
64
64
 
65
65
  class BaseGraphQLView:
66
- _ide_subscription_enabled = False
67
66
  graphql_ide: Optional[GraphQL_IDE]
68
67
 
69
68
  def __init__(
strawberry/http/base.py CHANGED
@@ -25,10 +25,6 @@ class BaseView(Generic[Request]):
25
25
  graphql_ide: Optional[GraphQL_IDE]
26
26
  multipart_uploads_enabled: bool = False
27
27
 
28
- # TODO: we might remove this in future :)
29
- _ide_replace_variables: bool = True
30
- _ide_subscription_enabled: bool = True
31
-
32
28
  def should_render_graphql_ide(self, request: BaseRequestProtocol) -> bool:
33
29
  return (
34
30
  request.method == "GET"
@@ -64,11 +60,7 @@ class BaseView(Generic[Request]):
64
60
 
65
61
  @property
66
62
  def graphql_ide_html(self) -> str:
67
- return get_graphql_ide_html(
68
- subscription_enabled=self._ide_subscription_enabled,
69
- replace_variables=self._ide_replace_variables,
70
- graphql_ide=self.graphql_ide,
71
- )
63
+ return get_graphql_ide_html(graphql_ide=self.graphql_ide)
72
64
 
73
65
  def _is_multipart_subscriptions(
74
66
  self, content_type: str, params: Dict[str, str]
strawberry/http/ides.py CHANGED
@@ -1,4 +1,3 @@
1
- import json
2
1
  import pathlib
3
2
  from typing import Optional
4
3
  from typing_extensions import Literal
@@ -7,8 +6,6 @@ GraphQL_IDE = Literal["graphiql", "apollo-sandbox", "pathfinder"]
7
6
 
8
7
 
9
8
  def get_graphql_ide_html(
10
- subscription_enabled: bool = True,
11
- replace_variables: bool = True,
12
9
  graphql_ide: Optional[GraphQL_IDE] = "graphiql",
13
10
  ) -> str:
14
11
  here = pathlib.Path(__file__).parents[1]
@@ -22,11 +19,6 @@ def get_graphql_ide_html(
22
19
 
23
20
  template = path.read_text(encoding="utf-8")
24
21
 
25
- if replace_variables:
26
- template = template.replace(
27
- "{{ SUBSCRIPTION_ENABLED }}", json.dumps(subscription_enabled)
28
- )
29
-
30
22
  return template
31
23
 
32
24
 
strawberry/quart/views.py CHANGED
@@ -52,8 +52,6 @@ class GraphQLView(
52
52
  ],
53
53
  View,
54
54
  ):
55
- _ide_subscription_enabled = False
56
-
57
55
  methods = ["GET", "POST"]
58
56
  allow_queries_via_get: bool = True
59
57
  request_adapter_class = QuartHTTPRequestAdapter
@@ -131,10 +131,7 @@
131
131
  headers["x-csrftoken"] = csrfToken;
132
132
  }
133
133
 
134
- const subscriptionsEnabled = JSON.parse("{{ SUBSCRIPTION_ENABLED }}");
135
- const subscriptionUrl = subscriptionsEnabled
136
- ? httpUrlToWebSockeUrl(fetchURL)
137
- : null;
134
+ const subscriptionUrl = httpUrlToWebSockeUrl(fetchURL);
138
135
 
139
136
  const fetcher = GraphiQL.createFetcher({
140
137
  url: fetchURL,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: strawberry-graphql
3
- Version: 0.244.0
3
+ Version: 0.245.0
4
4
  Summary: A library for creating GraphQL APIs
5
5
  Home-page: https://strawberry.rocks/
6
6
  License: MIT
@@ -9,11 +9,11 @@ strawberry/asgi/__init__.py,sha256=aFM74LpXxTruW5a00Ry9rIi3vz7hgnELJvZqPwJnhcY,7
9
9
  strawberry/asgi/test/__init__.py,sha256=4xxdUZtIISSOwjrcnmox7AvT4WWjowCm5bUuPdQneMg,71
10
10
  strawberry/asgi/test/client.py,sha256=VolupxMna9ktF1lYgV_dUQAIN53DNzVyWTeWTbwsxqE,1448
11
11
  strawberry/chalice/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
- strawberry/chalice/views.py,sha256=VXXOfR3JIEf5CsPMZe0sXBnsH097uPyPe_CdqwESVv4,4770
12
+ strawberry/chalice/views.py,sha256=lpj8e2mhCmmRVCRYfdlsgdiovfuwamSXlefbM-XmF50,4732
13
13
  strawberry/channels/__init__.py,sha256=-9ENTIu1AILbqffJ663qH6AwpZgLrJx_kaokS7RrCnA,433
14
14
  strawberry/channels/handlers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
15
  strawberry/channels/handlers/base.py,sha256=KV4KA0eF5NRtikV9m4ssoPI5pmCZvDuRkfoTxwh42qI,7853
16
- strawberry/channels/handlers/http_handler.py,sha256=HPxAddsVPaPS293CTvgYaxS8ot32B2t_BqSJPtywVjQ,11744
16
+ strawberry/channels/handlers/http_handler.py,sha256=fnQcPwdUz2CboVlnI3s1urQ_ZnZyNZvRx7SM_xPLLEA,11577
17
17
  strawberry/channels/handlers/ws_handler.py,sha256=mkfYKtGQO7So4BVBcUHQqG0vUVWIx55vHbJq-D5kz5Y,5924
18
18
  strawberry/channels/router.py,sha256=DKIbl4zuRBhfvViUVpyu0Rf_WRT41E6uZC-Yic9Ltvo,2024
19
19
  strawberry/channels/testing.py,sha256=GZqYu_rhrT1gLHmdI219L1fctVDmrv7AMHs0bwhXitc,6166
@@ -37,7 +37,7 @@ strawberry/codegen/plugins/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
37
37
  strawberry/codegen/plugins/print_operation.py,sha256=aw2o-41nZSZ2eOHPyp58-45QsAgUs1MmnHDIQzQRg9M,6805
38
38
  strawberry/codegen/plugins/python.py,sha256=aellTnJAZOfTZqFXH4fEGYFjnnCucyroeOXo9D0QkrA,6924
39
39
  strawberry/codegen/plugins/typescript.py,sha256=f3JJ0FGuhycu-bxOkW7KxAyYdfmcbej-lueOJZx3V7Y,3783
40
- strawberry/codegen/query_codegen.py,sha256=Fc9oDprjXPV1OlIPmHUgI7iW6R_dhUj7QBTFM0cTsqc,30363
40
+ strawberry/codegen/query_codegen.py,sha256=rKxseU-XiAUnQDX3V8ZAiWtyigVF_CBi2Pvvkomnqtk,30497
41
41
  strawberry/codegen/types.py,sha256=TBVjaKHBvr9QwELRdZUVlWS01wIEVXXTWs5etjqHVhk,4162
42
42
  strawberry/codemods/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
43
43
  strawberry/codemods/annotated_unions.py,sha256=TStU8ye5J1---P5mNWXBGeQa8m_J7FyPU_MYjzDZ-RU,5910
@@ -49,7 +49,7 @@ strawberry/django/apps.py,sha256=ZWw3Mzv1Cgy0T9xT8Jr2_dkCTZjT5WQABb34iqnu5pc,135
49
49
  strawberry/django/context.py,sha256=XL85jDGAVnb2pwgm5uRUvIXwlGia3i-8ZVfKihf0T24,655
50
50
  strawberry/django/test/__init__.py,sha256=4xxdUZtIISSOwjrcnmox7AvT4WWjowCm5bUuPdQneMg,71
51
51
  strawberry/django/test/client.py,sha256=6dorWECd0wdn8fu3dabE-dfGK3uza58mGrdJ-xPct-w,626
52
- strawberry/django/views.py,sha256=OMjjUFdlQeDUsF89cqmxU-k1e5kYp0omVoFgu96KjBE,10332
52
+ strawberry/django/views.py,sha256=b0DgNAKqKlM0CTOipDLUPm9liS_02wLJaZuxIaIR1Xk,9573
53
53
  strawberry/exceptions/__init__.py,sha256=DgdOJUs2xXHWcakr4tN6iIogltPi0MNnpu6MM6K0p5k,6347
54
54
  strawberry/exceptions/conflicting_arguments.py,sha256=68f6kMSXdjuEjZkoe8o2I9PSIjwTS1kXsSGaQBPk_hI,1587
55
55
  strawberry/exceptions/duplicated_type_name.py,sha256=-FG5qG_Mvkd7ROdOxCB9bijf8QR6Olryf07mbAFC0-U,2210
@@ -131,12 +131,12 @@ strawberry/file_uploads/__init__.py,sha256=v2-6FGBqnTnMPSUTFOiXpIutDMl-ga0PFtw5t
131
131
  strawberry/file_uploads/scalars.py,sha256=NRDeB7j8aotqIkz9r62ISTf4DrxQxEZYUuHsX5K16aU,161
132
132
  strawberry/file_uploads/utils.py,sha256=2zsXg3QsKgGLD7of2dW-vgQn_Naf7I3Men9PhEAFYwM,1160
133
133
  strawberry/flask/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
134
- strawberry/flask/views.py,sha256=dbYDuZKOiC7fFKLtU1x32utgfi6SLqJtAqPtDvUxcq4,6215
134
+ strawberry/flask/views.py,sha256=LwZeWK1reups2ijSWUl_YzpsdPbCLf7br6jIPoPwqeg,6177
135
135
  strawberry/http/__init__.py,sha256=GSvHUDXl1cHfLnb37PXOAnxfoXhvz0f467P1O8uDatM,1620
136
136
  strawberry/http/async_base_view.py,sha256=ZWxxLNCISinp9nc7878_0FjRt8y-giQbtJgSF-Q4ZF0,15688
137
- strawberry/http/base.py,sha256=swbBPIl1SYwX7gPq25ad4SyXg2Nl7ccM-0CrLFGT_FI,2613
137
+ strawberry/http/base.py,sha256=DFGBb6UhHR1EOmZkLn5V-2IKXzjYasg6yv06PQnm9Ds,2336
138
138
  strawberry/http/exceptions.py,sha256=-mRC6RALAj3XCaKeYvHNDiIRAMbE_GbVd7TEAgqRocA,245
139
- strawberry/http/ides.py,sha256=3dqFRY8_9ZqyIYR_EyRdPZ1zhL3lxRYT2MPk84O_Tk8,874
139
+ strawberry/http/ides.py,sha256=njYI2b5R0PnY27ll1ePdIvgPQU3m6Aod_JTBrcZYs0U,638
140
140
  strawberry/http/parse_content_type.py,sha256=sgtcOO_ZOFg7WWWibYyLc4SU58K-SErcW56kQczQmKU,412
141
141
  strawberry/http/sync_base_view.py,sha256=qA9o-Ic4ZcTXiKF02lBsrN7ET6VeXGYWf9m9mjhlfWU,7199
142
142
  strawberry/http/temporal_response.py,sha256=QrGYSg7Apu7Mh-X_uPKDZby-UicXw2J_ywxaqhS8a_4,220
@@ -151,7 +151,7 @@ strawberry/printer/ast_from_value.py,sha256=LgM5g2qvBOnAIf9znbiMEcRX0PGSQohR3Vr3
151
151
  strawberry/printer/printer.py,sha256=GntTBivg3fb_zPM41Q8DtWMiRmkmM9xwTF-aFWvnqTg,17524
152
152
  strawberry/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
153
153
  strawberry/quart/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
154
- strawberry/quart/views.py,sha256=-yjbFlXN1CLJqPrAgynGK_WwATTqsfBF-Kh_bJQ4JYs,4445
154
+ strawberry/quart/views.py,sha256=b6J-ZjTBklP_tE5Zzh3v9SHq0U7ZUf2t9bF8kPTfWxk,4406
155
155
  strawberry/relay/__init__.py,sha256=Vi4btvA_g6Cj9Tk_F9GCSegapIf2WqkOWV8y3P0cTCs,553
156
156
  strawberry/relay/exceptions.py,sha256=KZSRJYlfutrAQALtBPnzJHRIMK6GZSnKAT_H4wIzGcI,4035
157
157
  strawberry/relay/fields.py,sha256=qrpDxDQ_bdzDUKtd8gxo9P3Oermxbux3yjFvHvHC1Ho,16927
@@ -183,7 +183,7 @@ strawberry/schema_codegen/__init__.py,sha256=mhOfvC-h6ksmckXE2TC8WWlMgayNa2xwlbN
183
183
  strawberry/schema_directive.py,sha256=xFHoKOAWgVzDWt_N0ZdON3DBRByJkvMHt5TIvFLjUUU,2005
184
184
  strawberry/schema_directives.py,sha256=KGKFWCODjm1Ah9qNV_bBwbic7Mld4qLWnWQkev-PG8A,175
185
185
  strawberry/static/apollo-sandbox.html,sha256=2XzkbE0dqsFHqehE-jul9_J9TFOpwA6Ylrlo0Kdx_9w,973
186
- strawberry/static/graphiql.html,sha256=r1JCF4vpptjISOAHaCrgck2b3qf0oaCEzljECWQ7aCE,4380
186
+ strawberry/static/graphiql.html,sha256=BkiqZlC63f1sHBDs_UpMzcibcNrHKh7K41Sp23yttfo,4257
187
187
  strawberry/static/pathfinder.html,sha256=0DPx9AmJ2C_sJstFXnWOz9k5tVQHeHaK7qdVY4lAlmk,1547
188
188
  strawberry/subscriptions/__init__.py,sha256=1VGmiCzFepqRFyCikagkUoHHdoTG3XYlFu9GafoQMws,170
189
189
  strawberry/subscriptions/protocols/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -231,8 +231,8 @@ strawberry/utils/logging.py,sha256=U1cseHGquN09YFhFmRkiphfASKCyK0HUZREImPgVb0c,7
231
231
  strawberry/utils/operation.py,sha256=SSXxN-vMqdHO6W2OZtip-1z7y4_A-eTVFdhDvhKeLCk,1193
232
232
  strawberry/utils/str_converters.py,sha256=KGd7QH90RevaJjH6SQEkiVVsb8KuhJr_wv5AsI7UzQk,897
233
233
  strawberry/utils/typing.py,sha256=3xws5kxSQGsp8BnYyUwClvxXNzZakMAuOPoq1rjHRuk,14252
234
- strawberry_graphql-0.244.0.dist-info/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
235
- strawberry_graphql-0.244.0.dist-info/METADATA,sha256=_wi272Ggv0fWFmLb4bUKPgxvJKoF2bzk4f4NKWCw43E,7707
236
- strawberry_graphql-0.244.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
237
- strawberry_graphql-0.244.0.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
238
- strawberry_graphql-0.244.0.dist-info/RECORD,,
234
+ strawberry_graphql-0.245.0.dist-info/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
235
+ strawberry_graphql-0.245.0.dist-info/METADATA,sha256=8mvtyQQnC5lVbvaC5qVhpUXF0q2McBlm39inhtj3F18,7707
236
+ strawberry_graphql-0.245.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
237
+ strawberry_graphql-0.245.0.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
238
+ strawberry_graphql-0.245.0.dist-info/RECORD,,