strawberry-graphql 0.258.1__tar.gz → 0.259.0__tar.gz

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.
Files changed (236) hide show
  1. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/PKG-INFO +1 -1
  2. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/pyproject.toml +17 -7
  3. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/extensions/parser_cache.py +3 -2
  4. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/extensions/validation_cache.py +2 -1
  5. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/schema/schema.py +379 -23
  6. strawberry_graphql-0.258.1/strawberry/schema/execute.py +0 -303
  7. strawberry_graphql-0.258.1/strawberry/schema/subscribe.py +0 -155
  8. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/LICENSE +0 -0
  9. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/README.md +0 -0
  10. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/__init__.py +0 -0
  11. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/__main__.py +0 -0
  12. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/aiohttp/__init__.py +0 -0
  13. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/aiohttp/test/__init__.py +0 -0
  14. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/aiohttp/test/client.py +0 -0
  15. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/aiohttp/views.py +0 -0
  16. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/annotation.py +0 -0
  17. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/asgi/__init__.py +0 -0
  18. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/asgi/test/__init__.py +0 -0
  19. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/asgi/test/client.py +0 -0
  20. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/chalice/__init__.py +0 -0
  21. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/chalice/views.py +0 -0
  22. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/channels/__init__.py +0 -0
  23. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/channels/handlers/__init__.py +0 -0
  24. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/channels/handlers/base.py +0 -0
  25. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/channels/handlers/http_handler.py +0 -0
  26. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/channels/handlers/ws_handler.py +0 -0
  27. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/channels/router.py +0 -0
  28. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/channels/testing.py +0 -0
  29. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/cli/__init__.py +0 -0
  30. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/cli/app.py +0 -0
  31. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/cli/commands/__init__.py +0 -0
  32. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/cli/commands/codegen.py +0 -0
  33. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/cli/commands/export_schema.py +0 -0
  34. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/cli/commands/schema_codegen.py +0 -0
  35. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/cli/commands/server.py +0 -0
  36. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/cli/commands/upgrade/__init__.py +0 -0
  37. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/cli/commands/upgrade/_fake_progress.py +0 -0
  38. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/cli/commands/upgrade/_run_codemod.py +0 -0
  39. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/cli/constants.py +0 -0
  40. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/cli/debug_server.py +0 -0
  41. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/cli/utils/__init__.py +0 -0
  42. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/cli/utils/load_schema.py +0 -0
  43. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/codegen/__init__.py +0 -0
  44. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/codegen/exceptions.py +0 -0
  45. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/codegen/plugins/__init__.py +0 -0
  46. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/codegen/plugins/print_operation.py +0 -0
  47. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/codegen/plugins/python.py +0 -0
  48. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/codegen/plugins/typescript.py +0 -0
  49. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/codegen/query_codegen.py +0 -0
  50. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/codegen/types.py +0 -0
  51. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/codemods/__init__.py +0 -0
  52. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/codemods/annotated_unions.py +0 -0
  53. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/codemods/update_imports.py +0 -0
  54. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/dataloader.py +0 -0
  55. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/directive.py +0 -0
  56. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/django/__init__.py +0 -0
  57. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/django/apps.py +0 -0
  58. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/django/context.py +0 -0
  59. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/django/test/__init__.py +0 -0
  60. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/django/test/client.py +0 -0
  61. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/django/views.py +0 -0
  62. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/exceptions/__init__.py +0 -0
  63. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/exceptions/conflicting_arguments.py +0 -0
  64. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/exceptions/duplicated_type_name.py +0 -0
  65. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/exceptions/exception.py +0 -0
  66. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/exceptions/exception_source.py +0 -0
  67. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/exceptions/handler.py +0 -0
  68. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/exceptions/invalid_argument_type.py +0 -0
  69. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/exceptions/invalid_union_type.py +0 -0
  70. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/exceptions/missing_arguments_annotations.py +0 -0
  71. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/exceptions/missing_dependencies.py +0 -0
  72. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/exceptions/missing_field_annotation.py +0 -0
  73. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/exceptions/missing_return_annotation.py +0 -0
  74. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/exceptions/object_is_not_a_class.py +0 -0
  75. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/exceptions/object_is_not_an_enum.py +0 -0
  76. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/exceptions/permission_fail_silently_requires_optional.py +0 -0
  77. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/exceptions/private_strawberry_field.py +0 -0
  78. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/exceptions/scalar_already_registered.py +0 -0
  79. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/exceptions/syntax.py +0 -0
  80. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/exceptions/unresolved_field_type.py +0 -0
  81. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/exceptions/utils/__init__.py +0 -0
  82. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/exceptions/utils/source_finder.py +0 -0
  83. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/experimental/__init__.py +0 -0
  84. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/experimental/pydantic/__init__.py +0 -0
  85. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/experimental/pydantic/_compat.py +0 -0
  86. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/experimental/pydantic/conversion.py +0 -0
  87. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/experimental/pydantic/conversion_types.py +0 -0
  88. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/experimental/pydantic/error_type.py +0 -0
  89. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/experimental/pydantic/exceptions.py +0 -0
  90. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/experimental/pydantic/fields.py +0 -0
  91. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/experimental/pydantic/object_type.py +0 -0
  92. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/experimental/pydantic/utils.py +0 -0
  93. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/ext/LICENSE +0 -0
  94. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/ext/__init__.py +0 -0
  95. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/ext/dataclasses/LICENSE +0 -0
  96. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/ext/dataclasses/__init__.py +0 -0
  97. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/ext/dataclasses/dataclasses.py +0 -0
  98. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/ext/mypy_plugin.py +0 -0
  99. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/extensions/__init__.py +0 -0
  100. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/extensions/add_validation_rules.py +0 -0
  101. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/extensions/base_extension.py +0 -0
  102. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/extensions/context.py +0 -0
  103. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/extensions/directives.py +0 -0
  104. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/extensions/disable_validation.py +0 -0
  105. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/extensions/field_extension.py +0 -0
  106. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/extensions/mask_errors.py +0 -0
  107. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/extensions/max_aliases.py +0 -0
  108. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/extensions/max_tokens.py +0 -0
  109. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/extensions/pyinstrument.py +0 -0
  110. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/extensions/query_depth_limiter.py +0 -0
  111. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/extensions/runner.py +0 -0
  112. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/extensions/tracing/__init__.py +0 -0
  113. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/extensions/tracing/apollo.py +0 -0
  114. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/extensions/tracing/datadog.py +0 -0
  115. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/extensions/tracing/opentelemetry.py +0 -0
  116. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/extensions/tracing/utils.py +0 -0
  117. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/extensions/utils.py +0 -0
  118. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/fastapi/__init__.py +0 -0
  119. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/fastapi/context.py +0 -0
  120. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/fastapi/router.py +0 -0
  121. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/federation/__init__.py +0 -0
  122. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/federation/argument.py +0 -0
  123. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/federation/enum.py +0 -0
  124. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/federation/field.py +0 -0
  125. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/federation/mutation.py +0 -0
  126. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/federation/object_type.py +0 -0
  127. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/federation/scalar.py +0 -0
  128. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/federation/schema.py +0 -0
  129. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/federation/schema_directive.py +0 -0
  130. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/federation/schema_directives.py +0 -0
  131. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/federation/types.py +0 -0
  132. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/federation/union.py +0 -0
  133. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/field_extensions/__init__.py +0 -0
  134. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/field_extensions/input_mutation.py +0 -0
  135. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/file_uploads/__init__.py +0 -0
  136. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/file_uploads/scalars.py +0 -0
  137. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/file_uploads/utils.py +0 -0
  138. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/flask/__init__.py +0 -0
  139. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/flask/views.py +0 -0
  140. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/http/__init__.py +0 -0
  141. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/http/async_base_view.py +0 -0
  142. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/http/base.py +0 -0
  143. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/http/exceptions.py +0 -0
  144. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/http/ides.py +0 -0
  145. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/http/parse_content_type.py +0 -0
  146. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/http/sync_base_view.py +0 -0
  147. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/http/temporal_response.py +0 -0
  148. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/http/types.py +0 -0
  149. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/http/typevars.py +0 -0
  150. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/litestar/__init__.py +0 -0
  151. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/litestar/controller.py +0 -0
  152. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/parent.py +0 -0
  153. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/permission.py +0 -0
  154. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/printer/__init__.py +0 -0
  155. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/printer/ast_from_value.py +0 -0
  156. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/printer/printer.py +0 -0
  157. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/py.typed +0 -0
  158. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/quart/__init__.py +0 -0
  159. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/quart/views.py +0 -0
  160. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/relay/__init__.py +0 -0
  161. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/relay/exceptions.py +0 -0
  162. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/relay/fields.py +0 -0
  163. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/relay/types.py +0 -0
  164. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/relay/utils.py +0 -0
  165. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/resolvers.py +0 -0
  166. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/sanic/__init__.py +0 -0
  167. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/sanic/context.py +0 -0
  168. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/sanic/utils.py +0 -0
  169. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/sanic/views.py +0 -0
  170. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/scalars.py +0 -0
  171. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/schema/__init__.py +0 -0
  172. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/schema/base.py +0 -0
  173. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/schema/compat.py +0 -0
  174. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/schema/config.py +0 -0
  175. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/schema/exceptions.py +0 -0
  176. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/schema/name_converter.py +0 -0
  177. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/schema/schema_converter.py +0 -0
  178. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/schema/types/__init__.py +0 -0
  179. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/schema/types/base_scalars.py +0 -0
  180. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/schema/types/concrete_type.py +0 -0
  181. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/schema/types/scalar.py +0 -0
  182. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/schema/validation_rules/__init__.py +0 -0
  183. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/schema/validation_rules/one_of.py +0 -0
  184. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/schema_codegen/__init__.py +0 -0
  185. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/schema_directive.py +0 -0
  186. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/schema_directives.py +0 -0
  187. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/static/apollo-sandbox.html +0 -0
  188. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/static/graphiql.html +0 -0
  189. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/static/pathfinder.html +0 -0
  190. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/subscriptions/__init__.py +0 -0
  191. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/subscriptions/protocols/__init__.py +0 -0
  192. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/subscriptions/protocols/graphql_transport_ws/__init__.py +0 -0
  193. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/subscriptions/protocols/graphql_transport_ws/handlers.py +0 -0
  194. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/subscriptions/protocols/graphql_transport_ws/types.py +0 -0
  195. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/subscriptions/protocols/graphql_ws/__init__.py +0 -0
  196. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/subscriptions/protocols/graphql_ws/handlers.py +0 -0
  197. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/subscriptions/protocols/graphql_ws/types.py +0 -0
  198. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/test/__init__.py +0 -0
  199. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/test/client.py +0 -0
  200. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/tools/__init__.py +0 -0
  201. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/tools/create_type.py +0 -0
  202. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/tools/merge_types.py +0 -0
  203. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/types/__init__.py +0 -0
  204. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/types/arguments.py +0 -0
  205. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/types/auto.py +0 -0
  206. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/types/base.py +0 -0
  207. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/types/cast.py +0 -0
  208. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/types/enum.py +0 -0
  209. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/types/execution.py +0 -0
  210. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/types/field.py +0 -0
  211. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/types/fields/__init__.py +0 -0
  212. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/types/fields/resolver.py +0 -0
  213. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/types/graphql.py +0 -0
  214. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/types/info.py +0 -0
  215. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/types/lazy_type.py +0 -0
  216. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/types/mutation.py +0 -0
  217. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/types/nodes.py +0 -0
  218. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/types/object_type.py +0 -0
  219. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/types/private.py +0 -0
  220. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/types/scalar.py +0 -0
  221. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/types/type_resolver.py +0 -0
  222. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/types/union.py +0 -0
  223. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/types/unset.py +0 -0
  224. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/utils/__init__.py +0 -0
  225. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/utils/aio.py +0 -0
  226. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/utils/await_maybe.py +0 -0
  227. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/utils/dataclasses.py +0 -0
  228. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/utils/debug.py +0 -0
  229. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/utils/deprecations.py +0 -0
  230. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/utils/graphql_lexer.py +0 -0
  231. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/utils/importer.py +0 -0
  232. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/utils/inspect.py +0 -0
  233. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/utils/logging.py +0 -0
  234. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/utils/operation.py +0 -0
  235. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/utils/str_converters.py +0 -0
  236. {strawberry_graphql-0.258.1 → strawberry_graphql-0.259.0}/strawberry/utils/typing.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: strawberry-graphql
3
- Version: 0.258.1
3
+ Version: 0.259.0
4
4
  Summary: A library for creating GraphQL APIs
5
5
  License: MIT
6
6
  Keywords: graphql,api,rest,starlette,async
@@ -1,17 +1,15 @@
1
1
  [tool.poetry]
2
2
  name = "strawberry-graphql"
3
3
  packages = [ { include = "strawberry" } ]
4
- version = "0.258.1"
4
+ version = "0.259.0"
5
5
  description = "A library for creating GraphQL APIs"
6
6
  authors = ["Patrick Arminio <patrick.arminio@gmail.com>"]
7
7
  license = "MIT"
8
8
  readme = "README.md"
9
9
  keywords = ["graphql", "api", "rest", "starlette", "async"]
10
-
11
10
  homepage = "https://strawberry.rocks/"
12
11
  repository = "https://github.com/strawberry-graphql/strawberry"
13
12
  documentation = "https://strawberry.rocks/"
14
-
15
13
  classifiers = [
16
14
  "Development Status :: 5 - Production/Stable",
17
15
  "Intended Audience :: Developers",
@@ -29,10 +27,6 @@ include = ["strawberry/py.typed"]
29
27
  "Sponsor on GitHub" = "https://github.com/sponsors/strawberry-graphql"
30
28
  "Sponsor on Open Collective" = "https://opencollective.com/strawberry-graphql"
31
29
 
32
- [build-system]
33
- requires = ["poetry-core>=1.6"]
34
- build-backend = "poetry.core.masonry.api"
35
-
36
30
  [tool.poetry.dependencies]
37
31
  python = "^3.9"
38
32
  graphql-core = ">=3.2.0,<3.4.0"
@@ -102,6 +96,7 @@ types-deprecated = "^1.2.15.20241117"
102
96
  types-six = "^1.17.0.20241205"
103
97
  types-pyyaml = "^6.0.12.20240917"
104
98
  mypy = "^1.13.0"
99
+ codeflash = "^0.9.2"
105
100
 
106
101
  [tool.poetry.group.integrations]
107
102
  optional = true
@@ -123,6 +118,7 @@ litestar = {version = ">=2", optional = false}
123
118
  uvicorn = ">=0.11.6"
124
119
  daphne = "^4.0.0"
125
120
 
121
+
126
122
  [tool.poetry.extras]
127
123
  aiohttp = ["aiohttp"]
128
124
  asgi = ["starlette", "python-multipart"]
@@ -144,6 +140,7 @@ pyinstrument = ["pyinstrument"]
144
140
  [tool.poetry.scripts]
145
141
  strawberry = "strawberry.cli:run"
146
142
 
143
+
147
144
  [tool.pytest.ini_options]
148
145
  addopts = "--emoji"
149
146
  DJANGO_SETTINGS_MODULE = "tests.django.django_settings"
@@ -182,6 +179,7 @@ filterwarnings = [
182
179
  "ignore::DeprecationWarning:pkg_resources.*",
183
180
  ]
184
181
 
182
+
185
183
  [tool.autopub]
186
184
  git-username = "Botberry"
187
185
  git-email = "bot@strawberry.rocks"
@@ -384,3 +382,15 @@ exclude =[
384
382
 
385
383
  [tool.ruff.lint.pydocstyle]
386
384
  convention = "google"
385
+
386
+ [tool.codeflash]
387
+ # All paths are relative to this pyproject.toml's directory.
388
+ module-root = "strawberry"
389
+ tests-root = "tests"
390
+ test-framework = "pytest"
391
+ ignore-paths = []
392
+ formatter-cmds = ["ruff check --exit-zero --fix $file", "ruff format $file"]
393
+
394
+ [build-system]
395
+ requires = ["poetry-core>=1.6"]
396
+ build-backend = "poetry.core.masonry.api"
@@ -2,8 +2,9 @@ from collections.abc import Iterator
2
2
  from functools import lru_cache
3
3
  from typing import Optional
4
4
 
5
+ from graphql.language.parser import parse
6
+
5
7
  from strawberry.extensions.base_extension import SchemaExtension
6
- from strawberry.schema.execute import parse_document
7
8
 
8
9
 
9
10
  class ParserCache(SchemaExtension):
@@ -32,7 +33,7 @@ class ParserCache(SchemaExtension):
32
33
  cache will grow without bound.
33
34
  More info: https://docs.python.org/3/library/functools.html#functools.lru_cache
34
35
  """
35
- self.cached_parse_document = lru_cache(maxsize=maxsize)(parse_document)
36
+ self.cached_parse_document = lru_cache(maxsize=maxsize)(parse)
36
37
 
37
38
  def on_parse(self) -> Iterator[None]:
38
39
  execution_context = self.execution_context
@@ -3,7 +3,6 @@ from functools import lru_cache
3
3
  from typing import Optional
4
4
 
5
5
  from strawberry.extensions.base_extension import SchemaExtension
6
- from strawberry.schema.execute import validate_document
7
6
 
8
7
 
9
8
  class ValidationCache(SchemaExtension):
@@ -32,6 +31,8 @@ class ValidationCache(SchemaExtension):
32
31
 
33
32
  More info: https://docs.python.org/3/library/functools.html#functools.lru_cache
34
33
  """
34
+ from strawberry.schema.schema import validate_document
35
+
35
36
  self.cached_validate_document = lru_cache(maxsize=maxsize)(validate_document)
36
37
 
37
38
  def on_validate(self) -> Iterator[None]:
@@ -1,29 +1,43 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import warnings
4
+ from asyncio import ensure_future
5
+ from collections.abc import AsyncGenerator, AsyncIterator, Awaitable, Iterable
4
6
  from functools import cached_property, lru_cache
7
+ from inspect import isawaitable
5
8
  from typing import (
6
9
  TYPE_CHECKING,
7
10
  Any,
11
+ Callable,
8
12
  Optional,
9
13
  Union,
10
14
  cast,
11
15
  )
12
16
 
17
+ from graphql import ExecutionResult as GraphQLExecutionResult
18
+ from graphql import (
19
+ ExecutionResult as OriginalExecutionResult,
20
+ )
13
21
  from graphql import (
14
22
  GraphQLBoolean,
23
+ GraphQLError,
15
24
  GraphQLField,
16
25
  GraphQLNamedType,
17
26
  GraphQLNonNull,
18
27
  GraphQLSchema,
19
28
  get_introspection_query,
29
+ parse,
20
30
  validate_schema,
21
31
  )
32
+ from graphql.execution import ExecutionContext as GraphQLExecutionContext
33
+ from graphql.execution import execute, subscribe
22
34
  from graphql.execution.middleware import MiddlewareManager
23
35
  from graphql.type.directives import specified_directives
36
+ from graphql.validation import validate
24
37
 
25
38
  from strawberry import relay
26
39
  from strawberry.annotation import StrawberryAnnotation
40
+ from strawberry.exceptions import MissingQueryError
27
41
  from strawberry.extensions import SchemaExtension
28
42
  from strawberry.extensions.directives import (
29
43
  DirectivesExtension,
@@ -33,38 +47,93 @@ from strawberry.extensions.runner import SchemaExtensionsRunner
33
47
  from strawberry.printer import print_schema
34
48
  from strawberry.schema.schema_converter import GraphQLCoreConverter
35
49
  from strawberry.schema.types.scalar import DEFAULT_SCALAR_REGISTRY
36
- from strawberry.types import ExecutionContext
50
+ from strawberry.schema.validation_rules.one_of import OneOfInputValidationRule
37
51
  from strawberry.types.base import (
38
52
  StrawberryObjectDefinition,
39
53
  WithStrawberryObjectDefinition,
40
54
  has_object_definition,
41
55
  )
56
+ from strawberry.types.execution import (
57
+ ExecutionContext,
58
+ ExecutionResult,
59
+ PreExecutionError,
60
+ )
42
61
  from strawberry.types.graphql import OperationType
62
+ from strawberry.utils import IS_GQL_32
63
+ from strawberry.utils.await_maybe import await_maybe
43
64
 
44
65
  from . import compat
45
66
  from .base import BaseSchema
46
67
  from .config import StrawberryConfig
47
- from .execute import execute, execute_sync
48
- from .subscribe import SubscriptionResult, subscribe
68
+ from .exceptions import InvalidOperationTypeError
49
69
 
50
70
  if TYPE_CHECKING:
51
71
  from collections.abc import Iterable
72
+ from typing_extensions import TypeAlias
52
73
 
53
74
  from graphql import ExecutionContext as GraphQLExecutionContext
75
+ from graphql.language import DocumentNode
76
+ from graphql.validation import ASTValidationRule
54
77
 
55
78
  from strawberry.directive import StrawberryDirective
56
- from strawberry.types import ExecutionResult
57
79
  from strawberry.types.base import StrawberryType
58
80
  from strawberry.types.enum import EnumDefinition
59
81
  from strawberry.types.field import StrawberryField
60
82
  from strawberry.types.scalar import ScalarDefinition, ScalarWrapper
61
83
  from strawberry.types.union import StrawberryUnion
62
84
 
85
+ SubscriptionResult: TypeAlias = Union[
86
+ PreExecutionError, AsyncGenerator[ExecutionResult, None]
87
+ ]
88
+
89
+ OriginSubscriptionResult = Union[
90
+ OriginalExecutionResult,
91
+ AsyncIterator[OriginalExecutionResult],
92
+ ]
93
+
63
94
  DEFAULT_ALLOWED_OPERATION_TYPES = {
64
95
  OperationType.QUERY,
65
96
  OperationType.MUTATION,
66
97
  OperationType.SUBSCRIPTION,
67
98
  }
99
+ ProcessErrors: TypeAlias = (
100
+ "Callable[[list[GraphQLError], Optional[ExecutionContext]], None]"
101
+ )
102
+
103
+
104
+ # TODO: merge with below
105
+ def validate_document(
106
+ schema: GraphQLSchema,
107
+ document: DocumentNode,
108
+ validation_rules: tuple[type[ASTValidationRule], ...],
109
+ ) -> list[GraphQLError]:
110
+ validation_rules = (
111
+ *validation_rules,
112
+ OneOfInputValidationRule,
113
+ )
114
+ return validate(
115
+ schema,
116
+ document,
117
+ validation_rules,
118
+ )
119
+
120
+
121
+ def _run_validation(execution_context: ExecutionContext) -> None:
122
+ # Check if there are any validation rules or if validation has
123
+ # already been run by an extension
124
+ if len(execution_context.validation_rules) > 0 and execution_context.errors is None:
125
+ assert execution_context.graphql_document
126
+ execution_context.errors = validate_document(
127
+ execution_context.schema._schema,
128
+ execution_context.graphql_document,
129
+ execution_context.validation_rules,
130
+ )
131
+
132
+
133
+ def _coerce_error(error: Union[GraphQLError, Exception]) -> GraphQLError:
134
+ if isinstance(error, GraphQLError):
135
+ return error
136
+ return GraphQLError(str(error), original_error=error)
68
137
 
69
138
 
70
139
  class Schema(BaseSchema):
@@ -337,6 +406,60 @@ class Schema(BaseSchema):
337
406
  ) -> list[StrawberryField]:
338
407
  return type_definition.fields
339
408
 
409
+ async def _parse_and_validate_async(
410
+ self, context: ExecutionContext, extensions_runner: SchemaExtensionsRunner
411
+ ) -> Optional[PreExecutionError]:
412
+ if not context.query:
413
+ raise MissingQueryError
414
+
415
+ async with extensions_runner.parsing():
416
+ try:
417
+ if not context.graphql_document:
418
+ context.graphql_document = parse(context.query)
419
+
420
+ except GraphQLError as error:
421
+ context.errors = [error]
422
+ return PreExecutionError(data=None, errors=[error])
423
+
424
+ except Exception as error: # noqa: BLE001
425
+ error = GraphQLError(str(error), original_error=error)
426
+ context.errors = [error]
427
+ return PreExecutionError(data=None, errors=[error])
428
+
429
+ if context.operation_type not in context.allowed_operations:
430
+ raise InvalidOperationTypeError(context.operation_type)
431
+
432
+ async with extensions_runner.validation():
433
+ _run_validation(context)
434
+ if context.errors:
435
+ return PreExecutionError(
436
+ data=None,
437
+ errors=context.errors,
438
+ )
439
+
440
+ return None
441
+
442
+ async def _handle_execution_result(
443
+ self,
444
+ context: ExecutionContext,
445
+ result: Union[GraphQLExecutionResult, ExecutionResult],
446
+ extensions_runner: SchemaExtensionsRunner,
447
+ *,
448
+ # TODO: can we remove this somehow, see comment in execute
449
+ skip_process_errors: bool = False,
450
+ ) -> ExecutionResult:
451
+ # Set errors on the context so that it's easier
452
+ # to access in extensions
453
+ if result.errors:
454
+ context.errors = result.errors
455
+ if not skip_process_errors:
456
+ self._process_errors(result.errors, context)
457
+ if isinstance(result, GraphQLExecutionResult):
458
+ result = ExecutionResult(data=result.data, errors=result.errors)
459
+ result.extensions = await extensions_runner.get_extensions_results(context)
460
+ context.result = result # type: ignore # mypy failed to deduce correct type.
461
+ return result
462
+
340
463
  async def execute(
341
464
  self,
342
465
  query: Optional[str],
@@ -361,15 +484,64 @@ class Schema(BaseSchema):
361
484
  # TODO (#3571): remove this when we implement execution context as parameter.
362
485
  for extension in extensions:
363
486
  extension.execution_context = execution_context
364
- return await execute(
365
- self._schema,
366
- execution_context=execution_context,
367
- extensions_runner=self.create_extensions_runner(
368
- execution_context, extensions
369
- ),
370
- process_errors=self._process_errors,
371
- middleware_manager=self._get_middleware_manager(extensions),
372
- execution_context_class=self.execution_context_class,
487
+
488
+ extensions_runner = self.create_extensions_runner(execution_context, extensions)
489
+ middleware_manager = self._get_middleware_manager(extensions)
490
+
491
+ try:
492
+ async with extensions_runner.operation():
493
+ # Note: In graphql-core the schema would be validated here but in
494
+ # Strawberry we are validating it at initialisation time instead
495
+
496
+ if errors := await self._parse_and_validate_async(
497
+ execution_context, extensions_runner
498
+ ):
499
+ return await self._handle_execution_result(
500
+ execution_context,
501
+ errors,
502
+ extensions_runner,
503
+ )
504
+
505
+ assert execution_context.graphql_document
506
+ async with extensions_runner.executing():
507
+ if not execution_context.result:
508
+ result = await await_maybe(
509
+ execute(
510
+ self._schema,
511
+ execution_context.graphql_document,
512
+ root_value=execution_context.root_value,
513
+ middleware=middleware_manager,
514
+ variable_values=execution_context.variables,
515
+ operation_name=execution_context.operation_name,
516
+ context_value=execution_context.context,
517
+ execution_context_class=self.execution_context_class,
518
+ )
519
+ )
520
+ execution_context.result = result
521
+ else:
522
+ result = execution_context.result
523
+ # Also set errors on the execution_context so that it's easier
524
+ # to access in extensions
525
+ if result.errors:
526
+ execution_context.errors = result.errors
527
+
528
+ # Run the `Schema.process_errors` function here before
529
+ # extensions have a chance to modify them (see the MaskErrors
530
+ # extension). That way we can log the original errors but
531
+ # only return a sanitised version to the client.
532
+ self._process_errors(result.errors, execution_context)
533
+
534
+ except (MissingQueryError, InvalidOperationTypeError):
535
+ raise
536
+ except Exception as exc: # noqa: BLE001
537
+ return await self._handle_execution_result(
538
+ execution_context,
539
+ PreExecutionError(data=None, errors=[_coerce_error(exc)]),
540
+ extensions_runner,
541
+ )
542
+ # return results after all the operation completed.
543
+ return await self._handle_execution_result(
544
+ execution_context, result, extensions_runner, skip_process_errors=True
373
545
  )
374
546
 
375
547
  def execute_sync(
@@ -396,18 +568,178 @@ class Schema(BaseSchema):
396
568
  # TODO (#3571): remove this when we implement execution context as parameter.
397
569
  for extension in extensions:
398
570
  extension.execution_context = execution_context
399
- return execute_sync(
400
- self._schema,
401
- execution_context=execution_context,
402
- extensions_runner=self.create_extensions_runner(
403
- execution_context, extensions
404
- ),
405
- execution_context_class=self.execution_context_class,
406
- allowed_operation_types=allowed_operation_types,
407
- process_errors=self._process_errors,
408
- middleware_manager=self._get_middleware_manager(extensions),
571
+
572
+ extensions_runner = self.create_extensions_runner(execution_context, extensions)
573
+ middleware_manager = self._get_middleware_manager(extensions)
574
+
575
+ try:
576
+ with extensions_runner.operation():
577
+ # Note: In graphql-core the schema would be validated here but in
578
+ # Strawberry we are validating it at initialisation time instead
579
+ if not execution_context.query:
580
+ raise MissingQueryError # noqa: TRY301
581
+
582
+ with extensions_runner.parsing():
583
+ try:
584
+ if not execution_context.graphql_document:
585
+ execution_context.graphql_document = parse(
586
+ execution_context.query,
587
+ **execution_context.parse_options,
588
+ )
589
+
590
+ except GraphQLError as error:
591
+ execution_context.errors = [error]
592
+ self._process_errors([error], execution_context)
593
+ return ExecutionResult(
594
+ data=None,
595
+ errors=[error],
596
+ extensions=extensions_runner.get_extensions_results_sync(),
597
+ )
598
+
599
+ if execution_context.operation_type not in allowed_operation_types:
600
+ raise InvalidOperationTypeError(execution_context.operation_type) # noqa: TRY301
601
+
602
+ with extensions_runner.validation():
603
+ _run_validation(execution_context)
604
+ if execution_context.errors:
605
+ self._process_errors(
606
+ execution_context.errors, execution_context
607
+ )
608
+ return ExecutionResult(
609
+ data=None,
610
+ errors=execution_context.errors,
611
+ extensions=extensions_runner.get_extensions_results_sync(),
612
+ )
613
+
614
+ with extensions_runner.executing():
615
+ if not execution_context.result:
616
+ result = execute(
617
+ self._schema,
618
+ execution_context.graphql_document,
619
+ root_value=execution_context.root_value,
620
+ middleware=middleware_manager,
621
+ variable_values=execution_context.variables,
622
+ operation_name=execution_context.operation_name,
623
+ context_value=execution_context.context,
624
+ execution_context_class=self.execution_context_class,
625
+ )
626
+
627
+ if isawaitable(result):
628
+ result = cast(Awaitable[GraphQLExecutionResult], result) # type: ignore[redundant-cast]
629
+ ensure_future(result).cancel()
630
+ raise RuntimeError( # noqa: TRY301
631
+ "GraphQL execution failed to complete synchronously."
632
+ )
633
+
634
+ result = cast(GraphQLExecutionResult, result) # type: ignore[redundant-cast]
635
+ execution_context.result = result
636
+ # Also set errors on the context so that it's easier
637
+ # to access in extensions
638
+ if result.errors:
639
+ execution_context.errors = result.errors
640
+
641
+ # Run the `Schema.process_errors` function here before
642
+ # extensions have a chance to modify them (see the MaskErrors
643
+ # extension). That way we can log the original errors but
644
+ # only return a sanitised version to the client.
645
+ self._process_errors(result.errors, execution_context)
646
+ except (MissingQueryError, InvalidOperationTypeError):
647
+ raise
648
+ except Exception as exc: # noqa: BLE001
649
+ errors = [_coerce_error(exc)]
650
+ execution_context.errors = errors
651
+ self._process_errors(errors, execution_context)
652
+ return ExecutionResult(
653
+ data=None,
654
+ errors=errors,
655
+ extensions=extensions_runner.get_extensions_results_sync(),
656
+ )
657
+ return ExecutionResult(
658
+ data=execution_context.result.data,
659
+ errors=execution_context.result.errors,
660
+ extensions=extensions_runner.get_extensions_results_sync(),
409
661
  )
410
662
 
663
+ async def _subscribe(
664
+ self,
665
+ execution_context: ExecutionContext,
666
+ extensions_runner: SchemaExtensionsRunner,
667
+ middleware_manager: MiddlewareManager,
668
+ execution_context_class: type[GraphQLExecutionContext] | None = None,
669
+ ) -> AsyncGenerator[ExecutionResult, None]:
670
+ async with extensions_runner.operation():
671
+ if initial_error := await self._parse_and_validate_async(
672
+ context=execution_context,
673
+ extensions_runner=extensions_runner,
674
+ ):
675
+ initial_error.extensions = (
676
+ await extensions_runner.get_extensions_results(execution_context)
677
+ )
678
+ yield await self._handle_execution_result(
679
+ execution_context, initial_error, extensions_runner
680
+ )
681
+ try:
682
+ async with extensions_runner.executing():
683
+ assert execution_context.graphql_document is not None
684
+ gql_33_kwargs = {
685
+ "middleware": middleware_manager,
686
+ "execution_context_class": execution_context_class,
687
+ }
688
+ try:
689
+ # Might not be awaitable for pre-execution errors.
690
+ aiter_or_result: OriginSubscriptionResult = await await_maybe(
691
+ subscribe(
692
+ self._schema,
693
+ execution_context.graphql_document,
694
+ root_value=execution_context.root_value,
695
+ variable_values=execution_context.variables,
696
+ operation_name=execution_context.operation_name,
697
+ context_value=execution_context.context,
698
+ **{} if IS_GQL_32 else gql_33_kwargs, # type: ignore[arg-type]
699
+ )
700
+ )
701
+ # graphql-core 3.2 doesn't handle some of the pre-execution errors.
702
+ # see `test_subscription_immediate_error`
703
+ except Exception as exc: # noqa: BLE001
704
+ aiter_or_result = OriginalExecutionResult(
705
+ data=None, errors=[_coerce_error(exc)]
706
+ )
707
+
708
+ # Handle pre-execution errors.
709
+ if isinstance(aiter_or_result, OriginalExecutionResult):
710
+ yield await self._handle_execution_result(
711
+ execution_context,
712
+ PreExecutionError(data=None, errors=aiter_or_result.errors),
713
+ extensions_runner,
714
+ )
715
+ else:
716
+ try:
717
+ async for result in aiter_or_result:
718
+ yield await self._handle_execution_result(
719
+ execution_context,
720
+ result,
721
+ extensions_runner,
722
+ )
723
+ # graphql-core doesn't handle exceptions raised while executing.
724
+ except Exception as exc: # noqa: BLE001
725
+ yield await self._handle_execution_result(
726
+ execution_context,
727
+ OriginalExecutionResult(
728
+ data=None, errors=[_coerce_error(exc)]
729
+ ),
730
+ extensions_runner,
731
+ )
732
+ # catch exceptions raised in `on_execute` hook.
733
+ except Exception as exc: # noqa: BLE001
734
+ origin_result = OriginalExecutionResult(
735
+ data=None, errors=[_coerce_error(exc)]
736
+ )
737
+ yield await self._handle_execution_result(
738
+ execution_context,
739
+ origin_result,
740
+ extensions_runner,
741
+ )
742
+
411
743
  async def subscribe(
412
744
  self,
413
745
  query: Optional[str],
@@ -428,6 +760,30 @@ class Schema(BaseSchema):
428
760
  # TODO (#3571): remove this when we implement execution context as parameter.
429
761
  for extension in extensions:
430
762
  extension.execution_context = execution_context
763
+
764
+ asyncgen = self._subscribe(
765
+ execution_context,
766
+ extensions_runner=self.create_extensions_runner(
767
+ execution_context, extensions
768
+ ),
769
+ middleware_manager=self._get_middleware_manager(extensions),
770
+ execution_context_class=self.execution_context_class,
771
+ )
772
+ # GraphQL-core might return an initial error result instead of an async iterator.
773
+ # This happens when "there was an immediate error" i.e resolver is not an async iterator.
774
+ # To overcome this while maintaining the extension contexts we do this trick.
775
+ first = await asyncgen.__anext__()
776
+ if isinstance(first, PreExecutionError):
777
+ await asyncgen.aclose()
778
+ return first
779
+
780
+ async def _wrapper() -> AsyncGenerator[ExecutionResult, None]:
781
+ yield first
782
+ async for result in asyncgen:
783
+ yield result
784
+
785
+ return _wrapper()
786
+
431
787
  return await subscribe(
432
788
  self._schema,
433
789
  execution_context=execution_context,