strawberry-graphql 0.225.0__py3-none-any.whl → 0.226.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.
- strawberry/http/async_base_view.py +3 -3
- strawberry/http/sync_base_view.py +3 -3
- strawberry/schema/execute.py +150 -139
- {strawberry_graphql-0.225.0.dist-info → strawberry_graphql-0.226.0.dist-info}/METADATA +1 -1
- {strawberry_graphql-0.225.0.dist-info → strawberry_graphql-0.226.0.dist-info}/RECORD +8 -8
- {strawberry_graphql-0.225.0.dist-info → strawberry_graphql-0.226.0.dist-info}/LICENSE +0 -0
- {strawberry_graphql-0.225.0.dist-info → strawberry_graphql-0.226.0.dist-info}/WHEEL +0 -0
- {strawberry_graphql-0.225.0.dist-info → strawberry_graphql-0.226.0.dist-info}/entry_points.txt +0 -0
@@ -206,12 +206,12 @@ class AsyncBaseHTTPView(
|
|
206
206
|
) -> GraphQLRequestData:
|
207
207
|
content_type = request.content_type or ""
|
208
208
|
|
209
|
-
if "
|
209
|
+
if request.method == "GET":
|
210
|
+
data = self.parse_query_params(request.query_params)
|
211
|
+
elif "application/json" in content_type:
|
210
212
|
data = self.parse_json(await request.get_body())
|
211
213
|
elif content_type.startswith("multipart/form-data"):
|
212
214
|
data = await self.parse_multipart(request)
|
213
|
-
elif request.method == "GET":
|
214
|
-
data = self.parse_query_params(request.query_params)
|
215
215
|
else:
|
216
216
|
raise HTTPException(400, "Unsupported content type")
|
217
217
|
|
@@ -146,12 +146,12 @@ class SyncBaseHTTPView(
|
|
146
146
|
def parse_http_body(self, request: SyncHTTPRequestAdapter) -> GraphQLRequestData:
|
147
147
|
content_type = request.content_type or ""
|
148
148
|
|
149
|
-
if "
|
149
|
+
if request.method == "GET":
|
150
|
+
data = self.parse_query_params(request.query_params)
|
151
|
+
elif "application/json" in content_type:
|
150
152
|
data = self.parse_json(request.body)
|
151
153
|
elif content_type.startswith("multipart/form-data"):
|
152
154
|
data = self.parse_multipart(request)
|
153
|
-
elif request.method == "GET":
|
154
|
-
data = self.parse_query_params(request.query_params)
|
155
155
|
else:
|
156
156
|
raise HTTPException(400, "Unsupported content type")
|
157
157
|
|
strawberry/schema/execute.py
CHANGED
@@ -88,77 +88,82 @@ async def execute(
|
|
88
88
|
extensions=list(extensions),
|
89
89
|
)
|
90
90
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
execution_context.graphql_document
|
101
|
-
execution_context.
|
91
|
+
try:
|
92
|
+
async with extensions_runner.operation():
|
93
|
+
# Note: In graphql-core the schema would be validated here but in
|
94
|
+
# Strawberry we are validating it at initialisation time instead
|
95
|
+
if not execution_context.query:
|
96
|
+
raise MissingQueryError()
|
97
|
+
|
98
|
+
async with extensions_runner.parsing():
|
99
|
+
try:
|
100
|
+
if not execution_context.graphql_document:
|
101
|
+
execution_context.graphql_document = parse_document(
|
102
|
+
execution_context.query, **execution_context.parse_options
|
103
|
+
)
|
104
|
+
|
105
|
+
except GraphQLError as exc:
|
106
|
+
execution_context.errors = [exc]
|
107
|
+
process_errors([exc], execution_context)
|
108
|
+
return ExecutionResult(
|
109
|
+
data=None,
|
110
|
+
errors=[exc],
|
111
|
+
extensions=await extensions_runner.get_extensions_results(),
|
102
112
|
)
|
103
113
|
|
104
|
-
|
105
|
-
execution_context.
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
# Run the `Schema.process_errors` function here before
|
158
|
-
# extensions have a chance to modify them (see the MaskErrors
|
159
|
-
# extension). That way we can log the original errors but
|
160
|
-
# only return a sanitised version to the client.
|
161
|
-
process_errors(result.errors, execution_context)
|
114
|
+
if execution_context.operation_type not in allowed_operation_types:
|
115
|
+
raise InvalidOperationTypeError(execution_context.operation_type)
|
116
|
+
|
117
|
+
async with extensions_runner.validation():
|
118
|
+
_run_validation(execution_context)
|
119
|
+
if execution_context.errors:
|
120
|
+
process_errors(execution_context.errors, execution_context)
|
121
|
+
return ExecutionResult(data=None, errors=execution_context.errors)
|
122
|
+
|
123
|
+
async with extensions_runner.executing():
|
124
|
+
if not execution_context.result:
|
125
|
+
result = original_execute(
|
126
|
+
schema,
|
127
|
+
execution_context.graphql_document,
|
128
|
+
root_value=execution_context.root_value,
|
129
|
+
middleware=extensions_runner.as_middleware_manager(),
|
130
|
+
variable_values=execution_context.variables,
|
131
|
+
operation_name=execution_context.operation_name,
|
132
|
+
context_value=execution_context.context,
|
133
|
+
execution_context_class=execution_context_class,
|
134
|
+
)
|
135
|
+
|
136
|
+
if isawaitable(result):
|
137
|
+
result = await cast(Awaitable["GraphQLExecutionResult"], result)
|
138
|
+
|
139
|
+
result = cast("GraphQLExecutionResult", result)
|
140
|
+
execution_context.result = result
|
141
|
+
# Also set errors on the execution_context so that it's easier
|
142
|
+
# to access in extensions
|
143
|
+
if result.errors:
|
144
|
+
execution_context.errors = result.errors
|
145
|
+
|
146
|
+
# Run the `Schema.process_errors` function here before
|
147
|
+
# extensions have a chance to modify them (see the MaskErrors
|
148
|
+
# extension). That way we can log the original errors but
|
149
|
+
# only return a sanitised version to the client.
|
150
|
+
process_errors(result.errors, execution_context)
|
151
|
+
|
152
|
+
except (MissingQueryError, InvalidOperationTypeError) as e:
|
153
|
+
raise e
|
154
|
+
except Exception as exc:
|
155
|
+
error = (
|
156
|
+
exc
|
157
|
+
if isinstance(exc, GraphQLError)
|
158
|
+
else GraphQLError(str(exc), original_error=exc)
|
159
|
+
)
|
160
|
+
execution_context.errors = [error]
|
161
|
+
process_errors([error], execution_context)
|
162
|
+
return ExecutionResult(
|
163
|
+
data=None,
|
164
|
+
errors=[error],
|
165
|
+
extensions=await extensions_runner.get_extensions_results(),
|
166
|
+
)
|
162
167
|
|
163
168
|
return ExecutionResult(
|
164
169
|
data=execution_context.result.data,
|
@@ -181,80 +186,86 @@ def execute_sync(
|
|
181
186
|
extensions=list(extensions),
|
182
187
|
)
|
183
188
|
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
execution_context.graphql_document
|
194
|
-
execution_context.
|
189
|
+
try:
|
190
|
+
with extensions_runner.operation():
|
191
|
+
# Note: In graphql-core the schema would be validated here but in
|
192
|
+
# Strawberry we are validating it at initialisation time instead
|
193
|
+
if not execution_context.query:
|
194
|
+
raise MissingQueryError()
|
195
|
+
|
196
|
+
with extensions_runner.parsing():
|
197
|
+
try:
|
198
|
+
if not execution_context.graphql_document:
|
199
|
+
execution_context.graphql_document = parse_document(
|
200
|
+
execution_context.query, **execution_context.parse_options
|
201
|
+
)
|
202
|
+
|
203
|
+
except GraphQLError as exc:
|
204
|
+
execution_context.errors = [exc]
|
205
|
+
process_errors([exc], execution_context)
|
206
|
+
return ExecutionResult(
|
207
|
+
data=None,
|
208
|
+
errors=[exc],
|
209
|
+
extensions=extensions_runner.get_extensions_results_sync(),
|
195
210
|
)
|
196
211
|
|
197
|
-
|
198
|
-
execution_context.
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
if execution_context.operation_type not in allowed_operation_types:
|
218
|
-
raise InvalidOperationTypeError(execution_context.operation_type)
|
219
|
-
|
220
|
-
with extensions_runner.validation():
|
221
|
-
_run_validation(execution_context)
|
222
|
-
if execution_context.errors:
|
223
|
-
process_errors(execution_context.errors, execution_context)
|
224
|
-
return ExecutionResult(data=None, errors=execution_context.errors)
|
225
|
-
|
226
|
-
with extensions_runner.executing():
|
227
|
-
if not execution_context.result:
|
228
|
-
result = original_execute(
|
229
|
-
schema,
|
230
|
-
execution_context.graphql_document,
|
231
|
-
root_value=execution_context.root_value,
|
232
|
-
middleware=extensions_runner.as_middleware_manager(),
|
233
|
-
variable_values=execution_context.variables,
|
234
|
-
operation_name=execution_context.operation_name,
|
235
|
-
context_value=execution_context.context,
|
236
|
-
execution_context_class=execution_context_class,
|
237
|
-
)
|
238
|
-
|
239
|
-
if isawaitable(result):
|
240
|
-
result = cast(Awaitable["GraphQLExecutionResult"], result)
|
241
|
-
ensure_future(result).cancel()
|
242
|
-
raise RuntimeError(
|
243
|
-
"GraphQL execution failed to complete synchronously."
|
212
|
+
if execution_context.operation_type not in allowed_operation_types:
|
213
|
+
raise InvalidOperationTypeError(execution_context.operation_type)
|
214
|
+
|
215
|
+
with extensions_runner.validation():
|
216
|
+
_run_validation(execution_context)
|
217
|
+
if execution_context.errors:
|
218
|
+
process_errors(execution_context.errors, execution_context)
|
219
|
+
return ExecutionResult(data=None, errors=execution_context.errors)
|
220
|
+
|
221
|
+
with extensions_runner.executing():
|
222
|
+
if not execution_context.result:
|
223
|
+
result = original_execute(
|
224
|
+
schema,
|
225
|
+
execution_context.graphql_document,
|
226
|
+
root_value=execution_context.root_value,
|
227
|
+
middleware=extensions_runner.as_middleware_manager(),
|
228
|
+
variable_values=execution_context.variables,
|
229
|
+
operation_name=execution_context.operation_name,
|
230
|
+
context_value=execution_context.context,
|
231
|
+
execution_context_class=execution_context_class,
|
244
232
|
)
|
245
233
|
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
#
|
256
|
-
#
|
257
|
-
|
234
|
+
if isawaitable(result):
|
235
|
+
result = cast(Awaitable["GraphQLExecutionResult"], result)
|
236
|
+
ensure_future(result).cancel()
|
237
|
+
raise RuntimeError(
|
238
|
+
"GraphQL execution failed to complete synchronously."
|
239
|
+
)
|
240
|
+
|
241
|
+
result = cast("GraphQLExecutionResult", result)
|
242
|
+
execution_context.result = result
|
243
|
+
# Also set errors on the execution_context so that it's easier
|
244
|
+
# to access in extensions
|
245
|
+
if result.errors:
|
246
|
+
execution_context.errors = result.errors
|
247
|
+
|
248
|
+
# Run the `Schema.process_errors` function here before
|
249
|
+
# extensions have a chance to modify them (see the MaskErrors
|
250
|
+
# extension). That way we can log the original errors but
|
251
|
+
# only return a sanitised version to the client.
|
252
|
+
process_errors(result.errors, execution_context)
|
253
|
+
|
254
|
+
except (MissingQueryError, InvalidOperationTypeError) as e:
|
255
|
+
raise e
|
256
|
+
except Exception as exc:
|
257
|
+
error = (
|
258
|
+
exc
|
259
|
+
if isinstance(exc, GraphQLError)
|
260
|
+
else GraphQLError(str(exc), original_error=exc)
|
261
|
+
)
|
262
|
+
execution_context.errors = [error]
|
263
|
+
process_errors([error], execution_context)
|
264
|
+
return ExecutionResult(
|
265
|
+
data=None,
|
266
|
+
errors=[error],
|
267
|
+
extensions=extensions_runner.get_extensions_results_sync(),
|
268
|
+
)
|
258
269
|
|
259
270
|
return ExecutionResult(
|
260
271
|
data=execution_context.result.data,
|
@@ -146,11 +146,11 @@ strawberry/file_uploads/utils.py,sha256=U8gk1aHjWOBa_Opyvc47h6OpYToGq1QiSnEkI2kp
|
|
146
146
|
strawberry/flask/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
147
147
|
strawberry/flask/views.py,sha256=p4wuK_oY12bR7BC_Yntr0_Gee8sMohEdeF5aH-Yb-20,5608
|
148
148
|
strawberry/http/__init__.py,sha256=t-Inc7JHEr1Tr_Afu9uAb042ujpYx-jEbe_gqCfuOlc,1403
|
149
|
-
strawberry/http/async_base_view.py,sha256=
|
149
|
+
strawberry/http/async_base_view.py,sha256=eBrtWkIgapnwmzjssyrh4yu_1USvDMTjR9AVr563dk8,7233
|
150
150
|
strawberry/http/base.py,sha256=MqCCCMWASEI4UKV1oqxo-MRZkDGmIT9tpBLTpVr3lC0,2366
|
151
151
|
strawberry/http/exceptions.py,sha256=G1e86msTPQjl9bkLkX68SRrrdOn0VlP_ZdTetPLkX2E,163
|
152
152
|
strawberry/http/ides.py,sha256=f8sjynd4hCPJIaZaALRfJ2HM9_ghyymuCrBViAH2M34,822
|
153
|
-
strawberry/http/sync_base_view.py,sha256=
|
153
|
+
strawberry/http/sync_base_view.py,sha256=fedrXENW3vteRdtO4qkumNRbz-YVysf97riWKpAoR5s,6937
|
154
154
|
strawberry/http/temporal_response.py,sha256=6w_Nn3CNiU54jzEQP8pwzzHhGuh7eJw7S0wIneASJT8,187
|
155
155
|
strawberry/http/types.py,sha256=5alxKekKDASeQS0RkeJYo1CG5HKTXCSfclWPtbYOaPE,348
|
156
156
|
strawberry/http/typevars.py,sha256=Kc2xRx3Jic7AruCtv3FOuv2hqeQQzcCLP1E53Nwmpts,207
|
@@ -186,7 +186,7 @@ strawberry/schema/base.py,sha256=lQBJyzG2ZhKc544oLbXEbpYOPOjaXBop3lxp68h_lfI,297
|
|
186
186
|
strawberry/schema/compat.py,sha256=n0r3UPUcGemMqK8vklgtCkkuCA1p6tWAYbc6Vl4iNOw,1684
|
187
187
|
strawberry/schema/config.py,sha256=XkWwmxEsmecscH29o4qU0iSe-hgwJJ2X0DPBVlka2OE,640
|
188
188
|
strawberry/schema/exceptions.py,sha256=T-DsvBtjx9svkegIm1YrVPGPswpVEpMTFc0_7flLEkM,542
|
189
|
-
strawberry/schema/execute.py,sha256=
|
189
|
+
strawberry/schema/execute.py,sha256=6OE7_5v4G3t_wxp1_mfwu8TTiIkTJNBQaeGCVAljUYw,10982
|
190
190
|
strawberry/schema/name_converter.py,sha256=UdNyd-QtqF2HsDCQK-nsOcLGxDTj4hJwYFNvMtZnpq4,6533
|
191
191
|
strawberry/schema/schema.py,sha256=MOC8k6NHolFGrCyqrungv0ciCImLdXTlbmo7y7rLRas,13734
|
192
192
|
strawberry/schema/schema_converter.py,sha256=DT6HWJeTdaFuEoVzlVGeEIXeg_vdaiJ4YGSakXaRTlQ,34785
|
@@ -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=Qxz1LwyVsNGV7LQW1dFsaUbsswj5LHBOdKLMom5eyEA,13491
|
244
|
-
strawberry_graphql-0.
|
245
|
-
strawberry_graphql-0.
|
246
|
-
strawberry_graphql-0.
|
247
|
-
strawberry_graphql-0.
|
248
|
-
strawberry_graphql-0.
|
244
|
+
strawberry_graphql-0.226.0.dist-info/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
|
245
|
+
strawberry_graphql-0.226.0.dist-info/METADATA,sha256=IsdKlusyjcwHbGq9o1obCi9IjY0UXYtFJ3m0XSSEqV4,7740
|
246
|
+
strawberry_graphql-0.226.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
247
|
+
strawberry_graphql-0.226.0.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
|
248
|
+
strawberry_graphql-0.226.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
{strawberry_graphql-0.225.0.dist-info → strawberry_graphql-0.226.0.dist-info}/entry_points.txt
RENAMED
File without changes
|