strawberry-graphql 0.247.1__tar.gz → 0.248.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 (238) hide show
  1. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/PKG-INFO +1 -1
  2. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/pyproject.toml +1 -1
  3. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/channels/testing.py +28 -17
  4. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/subscriptions/protocols/graphql_transport_ws/handlers.py +39 -23
  5. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/subscriptions/protocols/graphql_ws/handlers.py +64 -63
  6. strawberry_graphql-0.248.0/strawberry/subscriptions/protocols/graphql_ws/types.py +96 -0
  7. strawberry_graphql-0.248.0/strawberry/types/fields/__init__.py +0 -0
  8. strawberry_graphql-0.247.1/strawberry/subscriptions/protocols/graphql_ws/__init__.py +0 -24
  9. strawberry_graphql-0.247.1/strawberry/subscriptions/protocols/graphql_ws/types.py +0 -52
  10. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/LICENSE +0 -0
  11. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/README.md +0 -0
  12. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/__init__.py +0 -0
  13. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/__main__.py +0 -0
  14. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/aiohttp/__init__.py +0 -0
  15. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/aiohttp/test/__init__.py +0 -0
  16. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/aiohttp/test/client.py +0 -0
  17. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/aiohttp/views.py +0 -0
  18. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/annotation.py +0 -0
  19. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/asgi/__init__.py +0 -0
  20. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/asgi/test/__init__.py +0 -0
  21. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/asgi/test/client.py +0 -0
  22. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/chalice/__init__.py +0 -0
  23. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/chalice/views.py +0 -0
  24. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/channels/__init__.py +0 -0
  25. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/channels/handlers/__init__.py +0 -0
  26. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/channels/handlers/base.py +0 -0
  27. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/channels/handlers/http_handler.py +0 -0
  28. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/channels/handlers/ws_handler.py +0 -0
  29. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/channels/router.py +0 -0
  30. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/cli/__init__.py +0 -0
  31. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/cli/app.py +0 -0
  32. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/cli/commands/__init__.py +0 -0
  33. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/cli/commands/codegen.py +0 -0
  34. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/cli/commands/export_schema.py +0 -0
  35. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/cli/commands/schema_codegen.py +0 -0
  36. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/cli/commands/server.py +0 -0
  37. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/cli/commands/upgrade/__init__.py +0 -0
  38. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/cli/commands/upgrade/_fake_progress.py +0 -0
  39. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/cli/commands/upgrade/_run_codemod.py +0 -0
  40. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/cli/constants.py +0 -0
  41. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/cli/debug_server.py +0 -0
  42. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/cli/utils/__init__.py +0 -0
  43. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/cli/utils/load_schema.py +0 -0
  44. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/codegen/__init__.py +0 -0
  45. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/codegen/exceptions.py +0 -0
  46. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/codegen/plugins/__init__.py +0 -0
  47. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/codegen/plugins/print_operation.py +0 -0
  48. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/codegen/plugins/python.py +0 -0
  49. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/codegen/plugins/typescript.py +0 -0
  50. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/codegen/query_codegen.py +0 -0
  51. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/codegen/types.py +0 -0
  52. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/codemods/__init__.py +0 -0
  53. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/codemods/annotated_unions.py +0 -0
  54. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/codemods/update_imports.py +0 -0
  55. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/dataloader.py +0 -0
  56. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/directive.py +0 -0
  57. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/django/__init__.py +0 -0
  58. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/django/apps.py +0 -0
  59. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/django/context.py +0 -0
  60. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/django/test/__init__.py +0 -0
  61. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/django/test/client.py +0 -0
  62. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/django/views.py +0 -0
  63. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/exceptions/__init__.py +0 -0
  64. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/exceptions/conflicting_arguments.py +0 -0
  65. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/exceptions/duplicated_type_name.py +0 -0
  66. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/exceptions/exception.py +0 -0
  67. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/exceptions/exception_source.py +0 -0
  68. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/exceptions/handler.py +0 -0
  69. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/exceptions/invalid_argument_type.py +0 -0
  70. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/exceptions/invalid_union_type.py +0 -0
  71. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/exceptions/missing_arguments_annotations.py +0 -0
  72. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/exceptions/missing_dependencies.py +0 -0
  73. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/exceptions/missing_field_annotation.py +0 -0
  74. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/exceptions/missing_return_annotation.py +0 -0
  75. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/exceptions/object_is_not_a_class.py +0 -0
  76. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/exceptions/object_is_not_an_enum.py +0 -0
  77. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/exceptions/permission_fail_silently_requires_optional.py +0 -0
  78. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/exceptions/private_strawberry_field.py +0 -0
  79. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/exceptions/scalar_already_registered.py +0 -0
  80. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/exceptions/syntax.py +0 -0
  81. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/exceptions/unresolved_field_type.py +0 -0
  82. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/exceptions/utils/__init__.py +0 -0
  83. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/exceptions/utils/source_finder.py +0 -0
  84. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/experimental/__init__.py +0 -0
  85. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/experimental/pydantic/__init__.py +0 -0
  86. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/experimental/pydantic/_compat.py +0 -0
  87. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/experimental/pydantic/conversion.py +0 -0
  88. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/experimental/pydantic/conversion_types.py +0 -0
  89. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/experimental/pydantic/error_type.py +0 -0
  90. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/experimental/pydantic/exceptions.py +0 -0
  91. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/experimental/pydantic/fields.py +0 -0
  92. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/experimental/pydantic/object_type.py +0 -0
  93. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/experimental/pydantic/utils.py +0 -0
  94. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/ext/LICENSE +0 -0
  95. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/ext/__init__.py +0 -0
  96. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/ext/dataclasses/LICENSE +0 -0
  97. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/ext/dataclasses/__init__.py +0 -0
  98. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/ext/dataclasses/dataclasses.py +0 -0
  99. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/ext/mypy_plugin.py +0 -0
  100. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/extensions/__init__.py +0 -0
  101. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/extensions/add_validation_rules.py +0 -0
  102. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/extensions/base_extension.py +0 -0
  103. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/extensions/context.py +0 -0
  104. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/extensions/directives.py +0 -0
  105. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/extensions/disable_validation.py +0 -0
  106. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/extensions/field_extension.py +0 -0
  107. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/extensions/mask_errors.py +0 -0
  108. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/extensions/max_aliases.py +0 -0
  109. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/extensions/max_tokens.py +0 -0
  110. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/extensions/parser_cache.py +0 -0
  111. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/extensions/pyinstrument.py +0 -0
  112. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/extensions/query_depth_limiter.py +0 -0
  113. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/extensions/runner.py +0 -0
  114. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/extensions/tracing/__init__.py +0 -0
  115. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/extensions/tracing/apollo.py +0 -0
  116. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/extensions/tracing/datadog.py +0 -0
  117. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/extensions/tracing/opentelemetry.py +0 -0
  118. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/extensions/tracing/sentry.py +0 -0
  119. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/extensions/tracing/utils.py +0 -0
  120. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/extensions/utils.py +0 -0
  121. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/extensions/validation_cache.py +0 -0
  122. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/fastapi/__init__.py +0 -0
  123. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/fastapi/context.py +0 -0
  124. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/fastapi/router.py +0 -0
  125. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/federation/__init__.py +0 -0
  126. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/federation/argument.py +0 -0
  127. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/federation/enum.py +0 -0
  128. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/federation/field.py +0 -0
  129. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/federation/mutation.py +0 -0
  130. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/federation/object_type.py +0 -0
  131. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/federation/scalar.py +0 -0
  132. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/federation/schema.py +0 -0
  133. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/federation/schema_directive.py +0 -0
  134. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/federation/schema_directives.py +0 -0
  135. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/federation/types.py +0 -0
  136. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/federation/union.py +0 -0
  137. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/field_extensions/__init__.py +0 -0
  138. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/field_extensions/input_mutation.py +0 -0
  139. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/file_uploads/__init__.py +0 -0
  140. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/file_uploads/scalars.py +0 -0
  141. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/file_uploads/utils.py +0 -0
  142. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/flask/__init__.py +0 -0
  143. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/flask/views.py +0 -0
  144. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/http/__init__.py +0 -0
  145. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/http/async_base_view.py +0 -0
  146. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/http/base.py +0 -0
  147. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/http/exceptions.py +0 -0
  148. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/http/ides.py +0 -0
  149. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/http/parse_content_type.py +0 -0
  150. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/http/sync_base_view.py +0 -0
  151. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/http/temporal_response.py +0 -0
  152. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/http/types.py +0 -0
  153. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/http/typevars.py +0 -0
  154. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/litestar/__init__.py +0 -0
  155. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/litestar/controller.py +0 -0
  156. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/parent.py +0 -0
  157. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/permission.py +0 -0
  158. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/printer/__init__.py +0 -0
  159. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/printer/ast_from_value.py +0 -0
  160. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/printer/printer.py +0 -0
  161. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/py.typed +0 -0
  162. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/quart/__init__.py +0 -0
  163. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/quart/views.py +0 -0
  164. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/relay/__init__.py +0 -0
  165. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/relay/exceptions.py +0 -0
  166. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/relay/fields.py +0 -0
  167. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/relay/types.py +0 -0
  168. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/relay/utils.py +0 -0
  169. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/resolvers.py +0 -0
  170. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/sanic/__init__.py +0 -0
  171. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/sanic/context.py +0 -0
  172. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/sanic/utils.py +0 -0
  173. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/sanic/views.py +0 -0
  174. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/scalars.py +0 -0
  175. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/schema/__init__.py +0 -0
  176. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/schema/base.py +0 -0
  177. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/schema/compat.py +0 -0
  178. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/schema/config.py +0 -0
  179. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/schema/exceptions.py +0 -0
  180. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/schema/execute.py +0 -0
  181. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/schema/name_converter.py +0 -0
  182. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/schema/schema.py +0 -0
  183. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/schema/schema_converter.py +0 -0
  184. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/schema/subscribe.py +0 -0
  185. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/schema/types/__init__.py +0 -0
  186. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/schema/types/base_scalars.py +0 -0
  187. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/schema/types/concrete_type.py +0 -0
  188. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/schema/types/scalar.py +0 -0
  189. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/schema/validation_rules/__init__.py +0 -0
  190. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/schema/validation_rules/one_of.py +0 -0
  191. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/schema_codegen/__init__.py +0 -0
  192. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/schema_directive.py +0 -0
  193. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/schema_directives.py +0 -0
  194. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/static/apollo-sandbox.html +0 -0
  195. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/static/graphiql.html +0 -0
  196. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/static/pathfinder.html +0 -0
  197. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/subscriptions/__init__.py +0 -0
  198. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/subscriptions/protocols/__init__.py +0 -0
  199. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/subscriptions/protocols/graphql_transport_ws/__init__.py +0 -0
  200. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/subscriptions/protocols/graphql_transport_ws/types.py +0 -0
  201. {strawberry_graphql-0.247.1/strawberry/types/fields → strawberry_graphql-0.248.0/strawberry/subscriptions/protocols/graphql_ws}/__init__.py +0 -0
  202. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/test/__init__.py +0 -0
  203. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/test/client.py +0 -0
  204. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/tools/__init__.py +0 -0
  205. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/tools/create_type.py +0 -0
  206. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/tools/merge_types.py +0 -0
  207. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/types/__init__.py +0 -0
  208. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/types/arguments.py +0 -0
  209. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/types/auto.py +0 -0
  210. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/types/base.py +0 -0
  211. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/types/enum.py +0 -0
  212. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/types/execution.py +0 -0
  213. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/types/field.py +0 -0
  214. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/types/fields/resolver.py +0 -0
  215. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/types/graphql.py +0 -0
  216. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/types/info.py +0 -0
  217. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/types/lazy_type.py +0 -0
  218. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/types/mutation.py +0 -0
  219. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/types/nodes.py +0 -0
  220. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/types/object_type.py +0 -0
  221. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/types/private.py +0 -0
  222. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/types/scalar.py +0 -0
  223. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/types/type_resolver.py +0 -0
  224. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/types/union.py +0 -0
  225. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/types/unset.py +0 -0
  226. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/utils/__init__.py +0 -0
  227. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/utils/aio.py +0 -0
  228. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/utils/await_maybe.py +0 -0
  229. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/utils/dataclasses.py +0 -0
  230. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/utils/debug.py +0 -0
  231. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/utils/deprecations.py +0 -0
  232. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/utils/graphql_lexer.py +0 -0
  233. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/utils/importer.py +0 -0
  234. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/utils/inspect.py +0 -0
  235. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/utils/logging.py +0 -0
  236. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/utils/operation.py +0 -0
  237. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/utils/str_converters.py +0 -0
  238. {strawberry_graphql-0.247.1 → strawberry_graphql-0.248.0}/strawberry/utils/typing.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: strawberry-graphql
3
- Version: 0.247.1
3
+ Version: 0.248.0
4
4
  Summary: A library for creating GraphQL APIs
5
5
  Home-page: https://strawberry.rocks/
6
6
  License: MIT
@@ -1,7 +1,7 @@
1
1
  [tool.poetry]
2
2
  name = "strawberry-graphql"
3
3
  packages = [ { include = "strawberry" } ]
4
- version = "0.247.1"
4
+ version = "0.248.0"
5
5
  description = "A library for creating GraphQL APIs"
6
6
  authors = ["Patrick Arminio <patrick.arminio@gmail.com>"]
7
7
  license = "MIT"
@@ -1,6 +1,5 @@
1
1
  from __future__ import annotations
2
2
 
3
- import dataclasses
4
3
  import uuid
5
4
  from typing import (
6
5
  TYPE_CHECKING,
@@ -26,10 +25,14 @@ from strawberry.subscriptions.protocols.graphql_transport_ws.types import (
26
25
  SubscribeMessage,
27
26
  SubscribeMessagePayload,
28
27
  )
29
- from strawberry.subscriptions.protocols.graphql_ws import (
30
- GQL_CONNECTION_ACK,
31
- GQL_CONNECTION_INIT,
32
- GQL_START,
28
+ from strawberry.subscriptions.protocols.graphql_ws.types import (
29
+ ConnectionAckMessage as GraphQLWSConnectionAckMessage,
30
+ )
31
+ from strawberry.subscriptions.protocols.graphql_ws.types import (
32
+ ConnectionInitMessage as GraphQLWSConnectionInitMessage,
33
+ )
34
+ from strawberry.subscriptions.protocols.graphql_ws.types import (
35
+ StartMessage as GraphQLWSStartMessage,
33
36
  )
34
37
  from strawberry.types import ExecutionResult
35
38
 
@@ -112,9 +115,11 @@ class GraphQLWebsocketCommunicator(WebsocketCommunicator):
112
115
  assert response == ConnectionAckMessage().as_dict()
113
116
  else:
114
117
  assert res == (True, GRAPHQL_WS_PROTOCOL)
115
- await self.send_json_to({"type": GQL_CONNECTION_INIT})
116
- response = await self.receive_json_from()
117
- assert response["type"] == GQL_CONNECTION_ACK
118
+ await self.send_json_to(
119
+ GraphQLWSConnectionInitMessage({"type": "connection_init"})
120
+ )
121
+ response: GraphQLWSConnectionAckMessage = await self.receive_json_from()
122
+ assert response["type"] == "connection_ack"
118
123
 
119
124
  # Actual `ExecutionResult`` objects are not available client-side, since they
120
125
  # get transformed into `FormattedExecutionResult` on the wire, but we attempt
@@ -123,22 +128,28 @@ class GraphQLWebsocketCommunicator(WebsocketCommunicator):
123
128
  self, query: str, variables: Optional[Dict] = None
124
129
  ) -> Union[ExecutionResult, AsyncIterator[ExecutionResult]]:
125
130
  id_ = uuid.uuid4().hex
126
- sub_payload = SubscribeMessagePayload(query=query, variables=variables)
131
+
127
132
  if self.protocol == GRAPHQL_TRANSPORT_WS_PROTOCOL:
128
133
  await self.send_json_to(
129
134
  SubscribeMessage(
130
135
  id=id_,
131
- payload=sub_payload,
136
+ payload=SubscribeMessagePayload(query=query, variables=variables),
132
137
  ).as_dict()
133
138
  )
134
139
  else:
135
- await self.send_json_to(
136
- {
137
- "type": GQL_START,
138
- "id": id_,
139
- "payload": dataclasses.asdict(sub_payload),
140
- }
141
- )
140
+ start_message: GraphQLWSStartMessage = {
141
+ "type": "start",
142
+ "id": id_,
143
+ "payload": {
144
+ "query": query,
145
+ },
146
+ }
147
+
148
+ if variables is not None:
149
+ start_message["payload"]["variables"] = variables
150
+
151
+ await self.send_json_to(start_message)
152
+
142
153
  while True:
143
154
  response = await self.receive_json_from(timeout=5)
144
155
  message_type = response["type"]
@@ -245,41 +245,42 @@ class BaseGraphQLTransportWSHandler:
245
245
  elif hasattr(self.context, "connection_params"):
246
246
  self.context.connection_params = self.connection_params
247
247
 
248
+ operation = Operation(
249
+ self,
250
+ message.id,
251
+ operation_type,
252
+ message.payload.query,
253
+ message.payload.variables,
254
+ message.payload.operationName,
255
+ )
256
+
257
+ operation.task = asyncio.create_task(self.run_operation(operation))
258
+ self.operations[message.id] = operation
259
+
260
+ async def run_operation(self, operation: Operation) -> None:
261
+ """The operation task's top level method. Cleans-up and de-registers the operation once it is done."""
262
+ # TODO: Handle errors in this method using self.handle_task_exception()
263
+
248
264
  result_source: Awaitable[ExecutionResult] | Awaitable[SubscriptionResult]
249
265
 
250
266
  # Get an AsyncGenerator yielding the results
251
- if operation_type == OperationType.SUBSCRIPTION:
267
+ if operation.operation_type == OperationType.SUBSCRIPTION:
252
268
  result_source = self.schema.subscribe(
253
- query=message.payload.query,
254
- variable_values=message.payload.variables,
255
- operation_name=message.payload.operationName,
269
+ query=operation.query,
270
+ variable_values=operation.variables,
271
+ operation_name=operation.operation_name,
256
272
  context_value=self.context,
257
273
  root_value=self.root_value,
258
274
  )
259
275
  else:
260
276
  result_source = self.schema.execute(
261
- query=message.payload.query,
262
- variable_values=message.payload.variables,
277
+ query=operation.query,
278
+ variable_values=operation.variables,
263
279
  context_value=self.context,
264
280
  root_value=self.root_value,
265
- operation_name=message.payload.operationName,
281
+ operation_name=operation.operation_name,
266
282
  )
267
283
 
268
- operation = Operation(self, message.id, operation_type)
269
-
270
- # Create task to handle this subscription, reserve the operation ID
271
- operation.task = asyncio.create_task(
272
- self.operation_task(result_source, operation)
273
- )
274
- self.operations[message.id] = operation
275
-
276
- async def operation_task(
277
- self,
278
- result_source: Awaitable[ExecutionResult] | Awaitable[SubscriptionResult],
279
- operation: Operation,
280
- ) -> None:
281
- """The operation task's top level method. Cleans-up and de-registers the operation once it is done."""
282
- # TODO: Handle errors in this method using self.handle_task_exception()
283
284
  try:
284
285
  first_res_or_agen = await result_source
285
286
  # that's an immediate error we should end the operation
@@ -340,17 +341,32 @@ class BaseGraphQLTransportWSHandler:
340
341
  class Operation:
341
342
  """A class encapsulating a single operation with its id. Helps enforce protocol state transition."""
342
343
 
343
- __slots__ = ["handler", "id", "operation_type", "completed", "task"]
344
+ __slots__ = [
345
+ "handler",
346
+ "id",
347
+ "operation_type",
348
+ "query",
349
+ "variables",
350
+ "operation_name",
351
+ "completed",
352
+ "task",
353
+ ]
344
354
 
345
355
  def __init__(
346
356
  self,
347
357
  handler: BaseGraphQLTransportWSHandler,
348
358
  id: str,
349
359
  operation_type: OperationType,
360
+ query: str,
361
+ variables: Optional[Dict[str, Any]],
362
+ operation_name: Optional[str],
350
363
  ) -> None:
351
364
  self.handler = handler
352
365
  self.id = id
353
366
  self.operation_type = operation_type
367
+ self.query = query
368
+ self.variables = variables
369
+ self.operation_name = operation_name
354
370
  self.completed = False
355
371
  self.task: Optional[asyncio.Task] = None
356
372
 
@@ -5,31 +5,24 @@ from contextlib import suppress
5
5
  from typing import (
6
6
  TYPE_CHECKING,
7
7
  AsyncGenerator,
8
- Awaitable,
9
8
  Dict,
10
9
  Optional,
11
10
  cast,
12
11
  )
13
12
 
14
13
  from strawberry.http.exceptions import NonTextMessageReceived, WebSocketDisconnected
15
- from strawberry.subscriptions.protocols.graphql_ws import (
16
- GQL_COMPLETE,
17
- GQL_CONNECTION_ACK,
18
- GQL_CONNECTION_ERROR,
19
- GQL_CONNECTION_INIT,
20
- GQL_CONNECTION_KEEP_ALIVE,
21
- GQL_CONNECTION_TERMINATE,
22
- GQL_DATA,
23
- GQL_ERROR,
24
- GQL_START,
25
- GQL_STOP,
26
- )
27
14
  from strawberry.subscriptions.protocols.graphql_ws.types import (
28
- ConnectionInitPayload,
29
- DataPayload,
15
+ CompleteMessage,
16
+ ConnectionAckMessage,
17
+ ConnectionErrorMessage,
18
+ ConnectionInitMessage,
19
+ ConnectionKeepAliveMessage,
20
+ ConnectionTerminateMessage,
21
+ DataMessage,
22
+ ErrorMessage,
30
23
  OperationMessage,
31
- OperationMessagePayload,
32
- StartPayload,
24
+ StartMessage,
25
+ StopMessage,
33
26
  )
34
27
  from strawberry.types.execution import ExecutionResult, PreExecutionError
35
28
  from strawberry.utils.debug import pretty_print_graphql_operation
@@ -37,7 +30,6 @@ from strawberry.utils.debug import pretty_print_graphql_operation
37
30
  if TYPE_CHECKING:
38
31
  from strawberry.http.async_base_view import AsyncWebSocketAdapter
39
32
  from strawberry.schema import BaseSchema
40
- from strawberry.schema.subscribe import SubscriptionResult
41
33
 
42
34
 
43
35
  class BaseGraphQLWSHandler:
@@ -61,7 +53,7 @@ class BaseGraphQLWSHandler:
61
53
  self.keep_alive_task: Optional[asyncio.Task] = None
62
54
  self.subscriptions: Dict[str, AsyncGenerator] = {}
63
55
  self.tasks: Dict[str, asyncio.Task] = {}
64
- self.connection_params: Optional[ConnectionInitPayload] = None
56
+ self.connection_params: Optional[Dict[str, object]] = None
65
57
 
66
58
  async def handle(self) -> None:
67
59
  try:
@@ -89,41 +81,40 @@ class BaseGraphQLWSHandler:
89
81
  self,
90
82
  message: OperationMessage,
91
83
  ) -> None:
92
- message_type = message["type"]
93
-
94
- if message_type == GQL_CONNECTION_INIT:
84
+ if message["type"] == "connection_init":
95
85
  await self.handle_connection_init(message)
96
- elif message_type == GQL_CONNECTION_TERMINATE:
86
+ elif message["type"] == "connection_terminate":
97
87
  await self.handle_connection_terminate(message)
98
- elif message_type == GQL_START:
88
+ elif message["type"] == "start":
99
89
  await self.handle_start(message)
100
- elif message_type == GQL_STOP:
90
+ elif message["type"] == "stop":
101
91
  await self.handle_stop(message)
102
92
 
103
- async def handle_connection_init(self, message: OperationMessage) -> None:
93
+ async def handle_connection_init(self, message: ConnectionInitMessage) -> None:
104
94
  payload = message.get("payload")
105
95
  if payload is not None and not isinstance(payload, dict):
106
- error_message: OperationMessage = {"type": GQL_CONNECTION_ERROR}
96
+ error_message: ConnectionErrorMessage = {"type": "connection_error"}
107
97
  await self.websocket.send_json(error_message)
108
98
  await self.websocket.close(code=1000, reason="")
109
99
  return
110
100
 
111
- payload = cast(Optional["ConnectionInitPayload"], payload)
112
101
  self.connection_params = payload
113
102
 
114
- acknowledge_message: OperationMessage = {"type": GQL_CONNECTION_ACK}
115
- await self.websocket.send_json(acknowledge_message)
103
+ connection_ack_message: ConnectionAckMessage = {"type": "connection_ack"}
104
+ await self.websocket.send_json(connection_ack_message)
116
105
 
117
106
  if self.keep_alive:
118
107
  keep_alive_handler = self.handle_keep_alive()
119
108
  self.keep_alive_task = asyncio.create_task(keep_alive_handler)
120
109
 
121
- async def handle_connection_terminate(self, message: OperationMessage) -> None:
110
+ async def handle_connection_terminate(
111
+ self, message: ConnectionTerminateMessage
112
+ ) -> None:
122
113
  await self.websocket.close(code=1000, reason="")
123
114
 
124
- async def handle_start(self, message: OperationMessage) -> None:
115
+ async def handle_start(self, message: StartMessage) -> None:
125
116
  operation_id = message["id"]
126
- payload = cast("StartPayload", message["payload"])
117
+ payload = message["payload"]
127
118
  query = payload["query"]
128
119
  operation_name = payload.get("operationName")
129
120
  variables = payload.get("variables")
@@ -136,46 +127,58 @@ class BaseGraphQLWSHandler:
136
127
  if self.debug:
137
128
  pretty_print_graphql_operation(operation_name, query, variables)
138
129
 
139
- result_source = self.schema.subscribe(
140
- query=query,
141
- variable_values=variables,
142
- operation_name=operation_name,
143
- context_value=self.context,
144
- root_value=self.root_value,
130
+ result_handler = self.handle_async_results(
131
+ operation_id, query, operation_name, variables
145
132
  )
146
-
147
- result_handler = self.handle_async_results(result_source, operation_id)
148
133
  self.tasks[operation_id] = asyncio.create_task(result_handler)
149
134
 
150
- async def handle_stop(self, message: OperationMessage) -> None:
135
+ async def handle_stop(self, message: StopMessage) -> None:
151
136
  operation_id = message["id"]
152
137
  await self.cleanup_operation(operation_id)
153
138
 
154
139
  async def handle_keep_alive(self) -> None:
155
140
  assert self.keep_alive_interval
156
141
  while True:
157
- data: OperationMessage = {"type": GQL_CONNECTION_KEEP_ALIVE}
142
+ data: ConnectionKeepAliveMessage = {"type": "ka"}
158
143
  await self.websocket.send_json(data)
159
144
  await asyncio.sleep(self.keep_alive_interval)
160
145
 
161
146
  async def handle_async_results(
162
147
  self,
163
- result_source: Awaitable[SubscriptionResult],
164
148
  operation_id: str,
149
+ query: str,
150
+ operation_name: Optional[str],
151
+ variables: Optional[Dict[str, object]],
165
152
  ) -> None:
166
153
  try:
167
- agen_or_err = await result_source
154
+ agen_or_err = await self.schema.subscribe(
155
+ query=query,
156
+ variable_values=variables,
157
+ operation_name=operation_name,
158
+ context_value=self.context,
159
+ root_value=self.root_value,
160
+ )
168
161
  if isinstance(agen_or_err, PreExecutionError):
169
162
  assert agen_or_err.errors
170
163
  error_payload = agen_or_err.errors[0].formatted
171
- await self.send_message(GQL_ERROR, operation_id, error_payload)
164
+ error_message: ErrorMessage = {
165
+ "type": "error",
166
+ "id": operation_id,
167
+ "payload": error_payload,
168
+ }
169
+ await self.websocket.send_json(error_message)
172
170
  else:
173
171
  self.subscriptions[operation_id] = agen_or_err
174
172
  async for result in agen_or_err:
175
173
  await self.send_data(result, operation_id)
176
- await self.send_message(GQL_COMPLETE, operation_id, None)
174
+ complete_message: CompleteMessage = {
175
+ "type": "complete",
176
+ "id": operation_id,
177
+ }
178
+ await self.websocket.send_json(complete_message)
177
179
  except asyncio.CancelledError:
178
- await self.send_message(GQL_COMPLETE, operation_id, None)
180
+ complete_message: CompleteMessage = {"type": "complete", "id": operation_id}
181
+ await self.websocket.send_json(complete_message)
179
182
 
180
183
  async def cleanup_operation(self, operation_id: str) -> None:
181
184
  if operation_id in self.subscriptions:
@@ -188,26 +191,24 @@ class BaseGraphQLWSHandler:
188
191
  await self.tasks[operation_id]
189
192
  del self.tasks[operation_id]
190
193
 
191
- async def send_message(
192
- self,
193
- type_: str,
194
- operation_id: str,
195
- payload: Optional[OperationMessagePayload] = None,
196
- ) -> None:
197
- data: OperationMessage = {"type": type_, "id": operation_id}
198
- if payload is not None:
199
- data["payload"] = payload
200
- await self.websocket.send_json(data)
201
-
202
194
  async def send_data(
203
195
  self, execution_result: ExecutionResult, operation_id: str
204
196
  ) -> None:
205
- payload: DataPayload = {"data": execution_result.data}
197
+ data_message: DataMessage = {
198
+ "type": "data",
199
+ "id": operation_id,
200
+ "payload": {"data": execution_result.data},
201
+ }
202
+
206
203
  if execution_result.errors:
207
- payload["errors"] = [err.formatted for err in execution_result.errors]
204
+ data_message["payload"]["errors"] = [
205
+ err.formatted for err in execution_result.errors
206
+ ]
207
+
208
208
  if execution_result.extensions:
209
- payload["extensions"] = execution_result.extensions
210
- await self.send_message(GQL_DATA, operation_id, payload)
209
+ data_message["payload"]["extensions"] = execution_result.extensions
210
+
211
+ await self.websocket.send_json(data_message)
211
212
 
212
213
 
213
214
  __all__ = ["BaseGraphQLWSHandler"]
@@ -0,0 +1,96 @@
1
+ from typing import Dict, List, TypedDict, Union
2
+ from typing_extensions import Literal, NotRequired
3
+
4
+ from graphql import GraphQLFormattedError
5
+
6
+
7
+ class ConnectionInitMessage(TypedDict):
8
+ type: Literal["connection_init"]
9
+ payload: NotRequired[Dict[str, object]]
10
+
11
+
12
+ class StartMessagePayload(TypedDict):
13
+ query: str
14
+ variables: NotRequired[Dict[str, object]]
15
+ operationName: NotRequired[str]
16
+
17
+
18
+ class StartMessage(TypedDict):
19
+ type: Literal["start"]
20
+ id: str
21
+ payload: StartMessagePayload
22
+
23
+
24
+ class StopMessage(TypedDict):
25
+ type: Literal["stop"]
26
+ id: str
27
+
28
+
29
+ class ConnectionTerminateMessage(TypedDict):
30
+ type: Literal["connection_terminate"]
31
+
32
+
33
+ class ConnectionErrorMessage(TypedDict):
34
+ type: Literal["connection_error"]
35
+ payload: NotRequired[Dict[str, object]]
36
+
37
+
38
+ class ConnectionAckMessage(TypedDict):
39
+ type: Literal["connection_ack"]
40
+
41
+
42
+ class DataMessagePayload(TypedDict):
43
+ data: object
44
+ errors: NotRequired[List[GraphQLFormattedError]]
45
+
46
+ # Non-standard field:
47
+ extensions: NotRequired[Dict[str, object]]
48
+
49
+
50
+ class DataMessage(TypedDict):
51
+ type: Literal["data"]
52
+ id: str
53
+ payload: DataMessagePayload
54
+
55
+
56
+ class ErrorMessage(TypedDict):
57
+ type: Literal["error"]
58
+ id: str
59
+ payload: GraphQLFormattedError
60
+
61
+
62
+ class CompleteMessage(TypedDict):
63
+ type: Literal["complete"]
64
+ id: str
65
+
66
+
67
+ class ConnectionKeepAliveMessage(TypedDict):
68
+ type: Literal["ka"]
69
+
70
+
71
+ OperationMessage = Union[
72
+ ConnectionInitMessage,
73
+ StartMessage,
74
+ StopMessage,
75
+ ConnectionTerminateMessage,
76
+ ConnectionErrorMessage,
77
+ ConnectionAckMessage,
78
+ DataMessage,
79
+ ErrorMessage,
80
+ CompleteMessage,
81
+ ]
82
+
83
+
84
+ __all__ = [
85
+ "ConnectionInitMessage",
86
+ "StartMessage",
87
+ "StopMessage",
88
+ "ConnectionTerminateMessage",
89
+ "ConnectionErrorMessage",
90
+ "ConnectionAckMessage",
91
+ "DataMessage",
92
+ "ErrorMessage",
93
+ "CompleteMessage",
94
+ "ConnectionKeepAliveMessage",
95
+ "OperationMessage",
96
+ ]
@@ -1,24 +0,0 @@
1
- GQL_CONNECTION_INIT = "connection_init"
2
- GQL_CONNECTION_ACK = "connection_ack"
3
- GQL_CONNECTION_ERROR = "connection_error"
4
- GQL_CONNECTION_TERMINATE = "connection_terminate"
5
- GQL_CONNECTION_KEEP_ALIVE = "ka"
6
- GQL_START = "start"
7
- GQL_DATA = "data"
8
- GQL_ERROR = "error"
9
- GQL_COMPLETE = "complete"
10
- GQL_STOP = "stop"
11
-
12
-
13
- __all__ = [
14
- "GQL_CONNECTION_INIT",
15
- "GQL_CONNECTION_ACK",
16
- "GQL_CONNECTION_ERROR",
17
- "GQL_CONNECTION_TERMINATE",
18
- "GQL_CONNECTION_KEEP_ALIVE",
19
- "GQL_START",
20
- "GQL_DATA",
21
- "GQL_ERROR",
22
- "GQL_COMPLETE",
23
- "GQL_STOP",
24
- ]
@@ -1,52 +0,0 @@
1
- from typing import Any, Dict, List, Optional, Union
2
- from typing_extensions import TypedDict
3
-
4
- from graphql import GraphQLFormattedError
5
-
6
- ConnectionInitPayload = Dict[str, Any]
7
-
8
-
9
- ConnectionErrorPayload = Dict[str, Any]
10
-
11
-
12
- class StartPayload(TypedDict, total=False):
13
- query: str
14
- variables: Optional[Dict[str, Any]]
15
- operationName: Optional[str]
16
-
17
-
18
- class DataPayload(TypedDict, total=False):
19
- data: Any
20
-
21
- # Optional list of formatted graphql.GraphQLError objects
22
- errors: Optional[List[GraphQLFormattedError]]
23
- extensions: Optional[Dict[str, Any]]
24
-
25
-
26
- ErrorPayload = GraphQLFormattedError
27
-
28
-
29
- OperationMessagePayload = Union[
30
- ConnectionInitPayload,
31
- ConnectionErrorPayload,
32
- StartPayload,
33
- DataPayload,
34
- ErrorPayload,
35
- ]
36
-
37
-
38
- class OperationMessage(TypedDict, total=False):
39
- type: str
40
- id: str
41
- payload: OperationMessagePayload
42
-
43
-
44
- __all__ = [
45
- "ConnectionInitPayload",
46
- "ConnectionErrorPayload",
47
- "StartPayload",
48
- "DataPayload",
49
- "ErrorPayload",
50
- "OperationMessagePayload",
51
- "OperationMessage",
52
- ]