@@ -211,7 +211,9 @@ def _execute(self, document: DocumentNode, *args, **kwargs) -> ExecutionResult:
211
211
212
212
return self .transport .execute (document , * args , ** kwargs )
213
213
214
- def execute (self , document : DocumentNode , * args , ** kwargs ) -> Dict :
214
+ def execute (
215
+ self , document : DocumentNode , * args , ** kwargs
216
+ ) -> Optional [Dict [str , Any ]]:
215
217
216
218
# Validate and execute on the transport
217
219
result = self ._execute (document , * args , ** kwargs )
@@ -225,7 +227,9 @@ def execute(self, document: DocumentNode, *args, **kwargs) -> Dict:
225
227
), "Transport returned an ExecutionResult without data or errors"
226
228
227
229
if self .client .type_adapter :
228
- result .data = self .client .type_adapter .convert_scalars (result .data )
230
+ result = result ._replace (
231
+ data = self .client .type_adapter .convert_scalars (result .data )
232
+ )
229
233
230
234
return result .data
231
235
@@ -289,7 +293,7 @@ async def _subscribe(
289
293
290
294
async def subscribe (
291
295
self , document : DocumentNode , * args , ** kwargs
292
- ) -> AsyncGenerator [Dict , None ]:
296
+ ) -> AsyncGenerator [Optional [ Dict [ str , Any ]] , None ]:
293
297
294
298
# Validate and subscribe on the transport
295
299
async for result in self ._subscribe (document , * args , ** kwargs ):
@@ -300,7 +304,9 @@ async def subscribe(
300
304
301
305
elif result .data is not None :
302
306
if self .client .type_adapter :
303
- result .data = self .client .type_adapter .convert_scalars (result .data )
307
+ result = result ._replace (
308
+ data = self .client .type_adapter .convert_scalars (result .data )
309
+ )
304
310
yield result .data
305
311
306
312
async def _execute (
@@ -316,7 +322,9 @@ async def _execute(
316
322
self .client .execute_timeout ,
317
323
)
318
324
319
- async def execute (self , document : DocumentNode , * args , ** kwargs ) -> Dict :
325
+ async def execute (
326
+ self , document : DocumentNode , * args , ** kwargs
327
+ ) -> Optional [Dict [str , Any ]]:
320
328
321
329
# Validate and execute on the transport
322
330
result = await self ._execute (document , * args , ** kwargs )
@@ -330,7 +338,9 @@ async def execute(self, document: DocumentNode, *args, **kwargs) -> Dict:
330
338
), "Transport returned an ExecutionResult without data or errors"
331
339
332
340
if self .client .type_adapter :
333
- result .data = self .client .type_adapter .convert_scalars (result .data )
341
+ result = result ._replace (
342
+ data = self .client .type_adapter .convert_scalars (result .data )
343
+ )
334
344
335
345
return result .data
336
346
0 commit comments