strawberry-graphql 0.168.2__tar.gz → 0.170.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 (228) hide show
  1. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/PKG-INFO +1 -1
  2. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/pyproject.toml +2 -2
  3. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/aiohttp/handlers/__init__.py +1 -2
  4. strawberry_graphql-0.170.0/strawberry/aiohttp/views.py +171 -0
  5. strawberry_graphql-0.170.0/strawberry/asgi/__init__.py +206 -0
  6. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/asgi/handlers/__init__.py +1 -2
  7. strawberry_graphql-0.170.0/strawberry/chalice/views.py +135 -0
  8. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/cli/debug_server.py +2 -1
  9. strawberry_graphql-0.170.0/strawberry/django/views.py +259 -0
  10. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/fastapi/router.py +101 -164
  11. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/file_uploads/utils.py +2 -2
  12. strawberry_graphql-0.170.0/strawberry/flask/views.py +163 -0
  13. strawberry_graphql-0.170.0/strawberry/http/async_base_view.py +215 -0
  14. strawberry_graphql-0.170.0/strawberry/http/base.py +63 -0
  15. strawberry_graphql-0.170.0/strawberry/http/exceptions.py +4 -0
  16. strawberry_graphql-0.170.0/strawberry/http/sync_base_view.py +210 -0
  17. strawberry_graphql-0.170.0/strawberry/http/temporal_response.py +8 -0
  18. strawberry_graphql-0.170.0/strawberry/http/types.py +13 -0
  19. strawberry_graphql-0.170.0/strawberry/http/typevars.py +7 -0
  20. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/sanic/utils.py +9 -2
  21. strawberry_graphql-0.170.0/strawberry/sanic/views.py +172 -0
  22. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/schema/name_converter.py +4 -1
  23. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/schema/schema_converter.py +6 -1
  24. strawberry_graphql-0.170.0/strawberry/starlite/controller.py +364 -0
  25. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/types/graphql.py +5 -2
  26. strawberry_graphql-0.168.2/strawberry/aiohttp/handlers/http_handler.py +0 -163
  27. strawberry_graphql-0.168.2/strawberry/aiohttp/views.py +0 -109
  28. strawberry_graphql-0.168.2/strawberry/asgi/__init__.py +0 -117
  29. strawberry_graphql-0.168.2/strawberry/asgi/handlers/http_handler.py +0 -214
  30. strawberry_graphql-0.168.2/strawberry/chalice/views.py +0 -212
  31. strawberry_graphql-0.168.2/strawberry/django/views.py +0 -321
  32. strawberry_graphql-0.168.2/strawberry/flask/views.py +0 -224
  33. strawberry_graphql-0.168.2/strawberry/http/temporal_response.py +0 -6
  34. strawberry_graphql-0.168.2/strawberry/sanic/views.py +0 -222
  35. strawberry_graphql-0.168.2/strawberry/starlite/controller.py +0 -422
  36. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/LICENSE +0 -0
  37. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/README.md +0 -0
  38. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/__init__.py +0 -0
  39. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/__main__.py +0 -0
  40. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/aiohttp/__init__.py +0 -0
  41. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/aiohttp/handlers/graphql_transport_ws_handler.py +0 -0
  42. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/aiohttp/handlers/graphql_ws_handler.py +0 -0
  43. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/aiohttp/test/__init__.py +0 -0
  44. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/aiohttp/test/client.py +0 -0
  45. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/annotation.py +0 -0
  46. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/arguments.py +0 -0
  47. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/asgi/handlers/graphql_transport_ws_handler.py +0 -0
  48. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/asgi/handlers/graphql_ws_handler.py +0 -0
  49. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/asgi/test/__init__.py +0 -0
  50. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/asgi/test/client.py +0 -0
  51. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/auto.py +0 -0
  52. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/chalice/__init__.py +0 -0
  53. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/channels/__init__.py +0 -0
  54. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/channels/context.py +0 -0
  55. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/channels/handlers/base.py +0 -0
  56. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/channels/handlers/graphql_transport_ws_handler.py +0 -0
  57. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/channels/handlers/graphql_ws_handler.py +0 -0
  58. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/channels/handlers/http_handler.py +0 -0
  59. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/channels/handlers/ws_handler.py +0 -0
  60. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/channels/router.py +0 -0
  61. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/channels/testing.py +0 -0
  62. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/cli/__init__.py +0 -0
  63. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/cli/commands/__init__.py +0 -0
  64. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/cli/commands/codegen.py +0 -0
  65. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/cli/commands/export_schema.py +0 -0
  66. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/cli/commands/server.py +0 -0
  67. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/cli/constants.py +0 -0
  68. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/cli/utils/__init__.py +0 -0
  69. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/cli/utils/load_schema.py +0 -0
  70. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/codegen/__init__.py +0 -0
  71. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/codegen/exceptions.py +0 -0
  72. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/codegen/plugins/__init__.py +0 -0
  73. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/codegen/plugins/print_operation.py +0 -0
  74. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/codegen/plugins/python.py +0 -0
  75. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/codegen/plugins/typescript.py +0 -0
  76. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/codegen/query_codegen.py +0 -0
  77. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/codegen/types.py +0 -0
  78. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/custom_scalar.py +0 -0
  79. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/dataloader.py +0 -0
  80. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/directive.py +0 -0
  81. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/django/__init__.py +0 -0
  82. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/django/apps.py +0 -0
  83. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/django/context.py +0 -0
  84. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/django/test/__init__.py +0 -0
  85. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/django/test/client.py +0 -0
  86. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/enum.py +0 -0
  87. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/exceptions/__init__.py +0 -0
  88. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/exceptions/duplicated_type_name.py +0 -0
  89. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/exceptions/exception.py +0 -0
  90. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/exceptions/exception_source.py +0 -0
  91. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/exceptions/handler.py +0 -0
  92. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/exceptions/invalid_argument_type.py +0 -0
  93. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/exceptions/invalid_union_type.py +0 -0
  94. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/exceptions/missing_arguments_annotations.py +0 -0
  95. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/exceptions/missing_field_annotation.py +0 -0
  96. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/exceptions/missing_return_annotation.py +0 -0
  97. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/exceptions/not_a_strawberry_enum.py +0 -0
  98. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/exceptions/object_is_not_a_class.py +0 -0
  99. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/exceptions/object_is_not_an_enum.py +0 -0
  100. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/exceptions/private_strawberry_field.py +0 -0
  101. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/exceptions/scalar_already_registered.py +0 -0
  102. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/exceptions/syntax.py +0 -0
  103. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/exceptions/unresolved_field_type.py +0 -0
  104. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/exceptions/utils/__init__.py +0 -0
  105. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/exceptions/utils/source_finder.py +0 -0
  106. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/experimental/__init__.py +0 -0
  107. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/experimental/pydantic/__init__.py +0 -0
  108. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/experimental/pydantic/conversion.py +0 -0
  109. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/experimental/pydantic/conversion_types.py +0 -0
  110. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/experimental/pydantic/error_type.py +0 -0
  111. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/experimental/pydantic/exceptions.py +0 -0
  112. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/experimental/pydantic/fields.py +0 -0
  113. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/experimental/pydantic/object_type.py +0 -0
  114. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/experimental/pydantic/utils.py +0 -0
  115. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/ext/LICENSE +0 -0
  116. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/ext/__init__.py +0 -0
  117. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/ext/dataclasses/LICENSE +0 -0
  118. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/ext/dataclasses/__init__.py +0 -0
  119. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/ext/dataclasses/dataclasses.py +0 -0
  120. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/ext/mypy_plugin.py +0 -0
  121. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/extensions/__init__.py +0 -0
  122. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/extensions/add_validation_rules.py +0 -0
  123. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/extensions/base_extension.py +0 -0
  124. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/extensions/context.py +0 -0
  125. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/extensions/directives.py +0 -0
  126. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/extensions/disable_validation.py +0 -0
  127. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/extensions/field_extension.py +0 -0
  128. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/extensions/mask_errors.py +0 -0
  129. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/extensions/parser_cache.py +0 -0
  130. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/extensions/query_depth_limiter.py +0 -0
  131. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/extensions/runner.py +0 -0
  132. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/extensions/tracing/__init__.py +0 -0
  133. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/extensions/tracing/apollo.py +0 -0
  134. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/extensions/tracing/datadog.py +0 -0
  135. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/extensions/tracing/opentelemetry.py +0 -0
  136. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/extensions/tracing/utils.py +0 -0
  137. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/extensions/utils.py +0 -0
  138. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/extensions/validation_cache.py +0 -0
  139. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/fastapi/__init__.py +0 -0
  140. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/fastapi/context.py +0 -0
  141. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/fastapi/handlers/__init__.py +0 -0
  142. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/fastapi/handlers/graphql_transport_ws_handler.py +0 -0
  143. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/fastapi/handlers/graphql_ws_handler.py +0 -0
  144. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/federation/__init__.py +0 -0
  145. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/federation/argument.py +0 -0
  146. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/federation/enum.py +0 -0
  147. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/federation/field.py +0 -0
  148. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/federation/mutation.py +0 -0
  149. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/federation/object_type.py +0 -0
  150. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/federation/scalar.py +0 -0
  151. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/federation/schema.py +0 -0
  152. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/federation/schema_directive.py +0 -0
  153. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/federation/schema_directives.py +0 -0
  154. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/federation/types.py +0 -0
  155. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/federation/union.py +0 -0
  156. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/field.py +0 -0
  157. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/file_uploads/__init__.py +0 -0
  158. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/file_uploads/scalars.py +0 -0
  159. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/flask/__init__.py +0 -0
  160. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/flask/graphiql.py +0 -0
  161. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/http/__init__.py +0 -0
  162. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/lazy_type.py +0 -0
  163. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/mutation.py +0 -0
  164. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/object_type.py +0 -0
  165. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/permission.py +0 -0
  166. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/printer/__init__.py +0 -0
  167. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/printer/ast_from_value.py +0 -0
  168. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/printer/printer.py +0 -0
  169. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/private.py +0 -0
  170. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/py.typed +0 -0
  171. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/resolvers.py +0 -0
  172. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/sanic/__init__.py +0 -0
  173. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/sanic/context.py +0 -0
  174. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/sanic/graphiql.py +0 -0
  175. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/scalars.py +0 -0
  176. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/schema/__init__.py +0 -0
  177. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/schema/base.py +0 -0
  178. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/schema/compat.py +0 -0
  179. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/schema/config.py +0 -0
  180. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/schema/exceptions.py +0 -0
  181. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/schema/execute.py +0 -0
  182. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/schema/schema.py +0 -0
  183. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/schema/types/__init__.py +0 -0
  184. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/schema/types/base_scalars.py +0 -0
  185. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/schema/types/concrete_type.py +0 -0
  186. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/schema/types/scalar.py +0 -0
  187. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/schema_directive.py +0 -0
  188. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/starlite/__init__.py +0 -0
  189. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/starlite/handlers/graphql_transport_ws_handler.py +0 -0
  190. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/starlite/handlers/graphql_ws_handler.py +0 -0
  191. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/static/graphiql.html +0 -0
  192. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/subscriptions/__init__.py +0 -0
  193. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/subscriptions/protocols/__init__.py +0 -0
  194. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/subscriptions/protocols/graphql_transport_ws/__init__.py +0 -0
  195. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/subscriptions/protocols/graphql_transport_ws/handlers.py +0 -0
  196. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/subscriptions/protocols/graphql_transport_ws/types.py +0 -0
  197. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/subscriptions/protocols/graphql_ws/__init__.py +0 -0
  198. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/subscriptions/protocols/graphql_ws/handlers.py +0 -0
  199. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/subscriptions/protocols/graphql_ws/types.py +0 -0
  200. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/test/__init__.py +0 -0
  201. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/test/client.py +0 -0
  202. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/tools/__init__.py +0 -0
  203. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/tools/create_type.py +0 -0
  204. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/tools/merge_types.py +0 -0
  205. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/type.py +0 -0
  206. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/types/__init__.py +0 -0
  207. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/types/execution.py +0 -0
  208. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/types/fields/__init__.py +0 -0
  209. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/types/fields/resolver.py +0 -0
  210. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/types/info.py +0 -0
  211. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/types/nodes.py +0 -0
  212. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/types/type_resolver.py +0 -0
  213. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/types/types.py +0 -0
  214. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/union.py +0 -0
  215. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/unset.py +0 -0
  216. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/utils/__init__.py +0 -0
  217. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/utils/await_maybe.py +0 -0
  218. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/utils/cached_property.py +0 -0
  219. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/utils/dataclasses.py +0 -0
  220. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/utils/debug.py +0 -0
  221. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/utils/graphiql.py +0 -0
  222. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/utils/graphql_lexer.py +0 -0
  223. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/utils/importer.py +0 -0
  224. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/utils/inspect.py +0 -0
  225. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/utils/logging.py +0 -0
  226. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/utils/operation.py +0 -0
  227. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.0}/strawberry/utils/str_converters.py +0 -0
  228. {strawberry_graphql-0.168.2 → strawberry_graphql-0.170.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.168.2
3
+ Version: 0.170.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.168.2"
4
+ version = "0.170.0"
5
5
  description = "A library for creating GraphQL APIs"
6
6
  authors = ["Patrick Arminio <patrick.arminio@gmail.com>"]
7
7
  license = "MIT"
@@ -151,7 +151,7 @@ markers = [
151
151
  "fastapi",
152
152
  "chalice",
153
153
  "flask",
154
- "starlite,"
154
+ "starlite"
155
155
  ]
156
156
  asyncio_mode = "auto"
157
157
  filterwarnings = [
@@ -2,6 +2,5 @@ from strawberry.aiohttp.handlers.graphql_transport_ws_handler import (
2
2
  GraphQLTransportWSHandler,
3
3
  )
4
4
  from strawberry.aiohttp.handlers.graphql_ws_handler import GraphQLWSHandler
5
- from strawberry.aiohttp.handlers.http_handler import HTTPHandler
6
5
 
7
- __all__ = ["GraphQLTransportWSHandler", "GraphQLWSHandler", "HTTPHandler"]
6
+ __all__ = ["GraphQLTransportWSHandler", "GraphQLWSHandler"]
@@ -0,0 +1,171 @@
1
+ from __future__ import annotations
2
+
3
+ import asyncio
4
+ from datetime import timedelta
5
+ from io import BytesIO
6
+ from typing import (
7
+ TYPE_CHECKING,
8
+ Any,
9
+ Dict,
10
+ Iterable,
11
+ Mapping,
12
+ Optional,
13
+ cast,
14
+ )
15
+
16
+ from aiohttp import web
17
+ from strawberry.aiohttp.handlers import (
18
+ GraphQLTransportWSHandler,
19
+ GraphQLWSHandler,
20
+ )
21
+ from strawberry.http.async_base_view import AsyncBaseHTTPView, AsyncHTTPRequestAdapter
22
+ from strawberry.http.exceptions import HTTPException
23
+ from strawberry.http.types import FormData, HTTPMethod, QueryParams
24
+ from strawberry.http.typevars import (
25
+ Context,
26
+ RootValue,
27
+ )
28
+ from strawberry.subscriptions import GRAPHQL_TRANSPORT_WS_PROTOCOL, GRAPHQL_WS_PROTOCOL
29
+ from strawberry.utils.graphiql import get_graphiql_html
30
+
31
+ if TYPE_CHECKING:
32
+ from strawberry.http import GraphQLHTTPResponse
33
+ from strawberry.schema import BaseSchema
34
+
35
+
36
+ class AioHTTPRequestAdapter(AsyncHTTPRequestAdapter):
37
+ def __init__(self, request: web.Request):
38
+ self.request = request
39
+
40
+ @property
41
+ def query_params(self) -> QueryParams:
42
+ return self.request.query.copy()
43
+
44
+ async def get_body(self) -> str:
45
+ return (await self.request.content.read()).decode()
46
+
47
+ @property
48
+ def method(self) -> HTTPMethod:
49
+ return cast(HTTPMethod, self.request.method.upper())
50
+
51
+ @property
52
+ def headers(self) -> Mapping[str, str]:
53
+ return self.request.headers
54
+
55
+ async def get_form_data(self) -> FormData:
56
+ reader = await self.request.multipart()
57
+
58
+ data: Dict[str, Any] = {}
59
+ files: Dict[str, Any] = {}
60
+
61
+ async for field in reader:
62
+ assert field.name
63
+
64
+ if field.filename:
65
+ files[field.name] = BytesIO(await field.read(decode=False))
66
+ else:
67
+ data[field.name] = await field.text()
68
+
69
+ return FormData(files=files, form=data)
70
+
71
+ @property
72
+ def content_type(self) -> Optional[str]:
73
+ return self.request.content_type
74
+
75
+
76
+ class GraphQLView(
77
+ AsyncBaseHTTPView[web.Request, web.Response, web.Response, Context, RootValue]
78
+ ):
79
+ # Mark the view as coroutine so that AIOHTTP does not confuse it with a deprecated
80
+ # bare handler function.
81
+ _is_coroutine = asyncio.coroutines._is_coroutine # type: ignore[attr-defined]
82
+
83
+ graphql_transport_ws_handler_class = GraphQLTransportWSHandler
84
+ graphql_ws_handler_class = GraphQLWSHandler
85
+ allow_queries_via_get = True
86
+ request_adapter_class = AioHTTPRequestAdapter
87
+
88
+ def __init__(
89
+ self,
90
+ schema: BaseSchema,
91
+ graphiql: bool = True,
92
+ allow_queries_via_get: bool = True,
93
+ keep_alive: bool = True,
94
+ keep_alive_interval: float = 1,
95
+ debug: bool = False,
96
+ subscription_protocols: Iterable[str] = (
97
+ GRAPHQL_TRANSPORT_WS_PROTOCOL,
98
+ GRAPHQL_WS_PROTOCOL,
99
+ ),
100
+ connection_init_wait_timeout: timedelta = timedelta(minutes=1),
101
+ ):
102
+ self.schema = schema
103
+ self.graphiql = graphiql
104
+ self.allow_queries_via_get = allow_queries_via_get
105
+ self.keep_alive = keep_alive
106
+ self.keep_alive_interval = keep_alive_interval
107
+ self.debug = debug
108
+ self.subscription_protocols = subscription_protocols
109
+ self.connection_init_wait_timeout = connection_init_wait_timeout
110
+
111
+ def render_graphiql(self, request: web.Request) -> web.Response:
112
+ # TODO: get_graphiql_html should be on self
113
+ html_string = get_graphiql_html()
114
+
115
+ return web.Response(text=html_string, content_type="text/html")
116
+
117
+ async def get_sub_response(self, request: web.Request) -> web.Response:
118
+ return web.Response()
119
+
120
+ async def __call__(self, request: web.Request) -> web.StreamResponse:
121
+ ws = web.WebSocketResponse(protocols=self.subscription_protocols)
122
+ ws_test = ws.can_prepare(request)
123
+
124
+ if not ws_test.ok:
125
+ try:
126
+ return await self.run(request=request)
127
+ except HTTPException as e:
128
+ return web.Response(
129
+ body=e.reason,
130
+ status=e.status_code,
131
+ )
132
+
133
+ if ws_test.protocol == GRAPHQL_TRANSPORT_WS_PROTOCOL:
134
+ return await self.graphql_transport_ws_handler_class(
135
+ schema=self.schema,
136
+ debug=self.debug,
137
+ connection_init_wait_timeout=self.connection_init_wait_timeout,
138
+ get_context=self.get_context, # type: ignore
139
+ get_root_value=self.get_root_value,
140
+ request=request,
141
+ ).handle()
142
+ elif ws_test.protocol == GRAPHQL_WS_PROTOCOL:
143
+ return await self.graphql_ws_handler_class(
144
+ schema=self.schema,
145
+ debug=self.debug,
146
+ keep_alive=self.keep_alive,
147
+ keep_alive_interval=self.keep_alive_interval,
148
+ get_context=self.get_context,
149
+ get_root_value=self.get_root_value,
150
+ request=request,
151
+ ).handle()
152
+ else:
153
+ await ws.prepare(request)
154
+ await ws.close(code=4406, message=b"Subprotocol not acceptable")
155
+ return ws
156
+
157
+ async def get_root_value(self, request: web.Request) -> Optional[RootValue]:
158
+ return None
159
+
160
+ async def get_context(
161
+ self, request: web.Request, response: web.Response
162
+ ) -> Context:
163
+ return {"request": request, "response": response} # type: ignore
164
+
165
+ def create_response(
166
+ self, response_data: GraphQLHTTPResponse, sub_response: web.Response
167
+ ) -> web.Response:
168
+ sub_response.text = self.encode_json(response_data)
169
+ sub_response.content_type = "application/json"
170
+
171
+ return sub_response
@@ -0,0 +1,206 @@
1
+ from __future__ import annotations
2
+
3
+ from datetime import timedelta
4
+ from typing import (
5
+ TYPE_CHECKING,
6
+ Any,
7
+ Mapping,
8
+ Optional,
9
+ Sequence,
10
+ Union,
11
+ cast,
12
+ )
13
+
14
+ from starlette import status
15
+ from starlette.requests import Request
16
+ from starlette.responses import HTMLResponse, PlainTextResponse, Response
17
+ from starlette.websockets import WebSocket
18
+
19
+ from strawberry.asgi.handlers import (
20
+ GraphQLTransportWSHandler,
21
+ GraphQLWSHandler,
22
+ )
23
+ from strawberry.http.async_base_view import AsyncBaseHTTPView, AsyncHTTPRequestAdapter
24
+ from strawberry.http.exceptions import HTTPException
25
+ from strawberry.http.types import FormData, HTTPMethod, QueryParams
26
+ from strawberry.http.typevars import (
27
+ Context,
28
+ RootValue,
29
+ )
30
+ from strawberry.subscriptions import GRAPHQL_TRANSPORT_WS_PROTOCOL, GRAPHQL_WS_PROTOCOL
31
+ from strawberry.utils.graphiql import get_graphiql_html
32
+
33
+ if TYPE_CHECKING:
34
+ from starlette.types import Receive, Scope, Send
35
+
36
+ from strawberry.http import GraphQLHTTPResponse
37
+ from strawberry.schema import BaseSchema
38
+
39
+
40
+ class ASGIRequestAdapter(AsyncHTTPRequestAdapter):
41
+ def __init__(self, request: Request) -> None:
42
+ self.request = request
43
+
44
+ @property
45
+ def query_params(self) -> QueryParams:
46
+ return dict(self.request.query_params)
47
+
48
+ @property
49
+ def method(self) -> HTTPMethod:
50
+ return cast(HTTPMethod, self.request.method.upper())
51
+
52
+ @property
53
+ def headers(self) -> Mapping[str, str]:
54
+ return self.request.headers
55
+
56
+ @property
57
+ def content_type(self) -> Optional[str]:
58
+ return self.request.headers.get("content-type")
59
+
60
+ async def get_body(self) -> bytes:
61
+ return await self.request.body()
62
+
63
+ async def get_form_data(self) -> FormData:
64
+ multipart_data = await self.request.form()
65
+
66
+ return FormData(
67
+ files=multipart_data,
68
+ form=multipart_data,
69
+ )
70
+
71
+
72
+ class GraphQL(
73
+ AsyncBaseHTTPView[
74
+ Union[Request, WebSocket],
75
+ Response,
76
+ Response,
77
+ Context,
78
+ RootValue,
79
+ ]
80
+ ):
81
+ graphql_transport_ws_handler_class = GraphQLTransportWSHandler
82
+ graphql_ws_handler_class = GraphQLWSHandler
83
+ allow_queries_via_get = True
84
+ request_adapter_class = ASGIRequestAdapter # pyright: ignore
85
+
86
+ def __init__(
87
+ self,
88
+ schema: BaseSchema,
89
+ graphiql: bool = True,
90
+ allow_queries_via_get: bool = True,
91
+ keep_alive: bool = False,
92
+ keep_alive_interval: float = 1,
93
+ debug: bool = False,
94
+ subscription_protocols: Sequence[str] = (
95
+ GRAPHQL_TRANSPORT_WS_PROTOCOL,
96
+ GRAPHQL_WS_PROTOCOL,
97
+ ),
98
+ connection_init_wait_timeout: timedelta = timedelta(minutes=1),
99
+ ) -> None:
100
+ self.schema = schema
101
+ self.graphiql = graphiql
102
+ self.allow_queries_via_get = allow_queries_via_get
103
+ self.keep_alive = keep_alive
104
+ self.keep_alive_interval = keep_alive_interval
105
+ self.debug = debug
106
+ self.protocols = subscription_protocols
107
+ self.connection_init_wait_timeout = connection_init_wait_timeout
108
+
109
+ async def __call__(self, scope: Scope, receive: Receive, send: Send):
110
+ if scope["type"] == "http":
111
+ return await self.handle_http(scope, receive, send)
112
+
113
+ elif scope["type"] == "websocket":
114
+ ws = WebSocket(scope=scope, receive=receive, send=send)
115
+ preferred_protocol = self.pick_preferred_protocol(ws)
116
+
117
+ if preferred_protocol == GRAPHQL_TRANSPORT_WS_PROTOCOL:
118
+ await self.graphql_transport_ws_handler_class(
119
+ schema=self.schema,
120
+ debug=self.debug,
121
+ connection_init_wait_timeout=self.connection_init_wait_timeout,
122
+ get_context=self.get_context,
123
+ get_root_value=self.get_root_value,
124
+ ws=ws,
125
+ ).handle()
126
+ elif preferred_protocol == GRAPHQL_WS_PROTOCOL:
127
+ await self.graphql_ws_handler_class(
128
+ schema=self.schema,
129
+ debug=self.debug,
130
+ keep_alive=self.keep_alive,
131
+ keep_alive_interval=self.keep_alive_interval,
132
+ get_context=self.get_context,
133
+ get_root_value=self.get_root_value,
134
+ ws=ws,
135
+ ).handle()
136
+ else:
137
+ # Subprotocol not acceptable
138
+ await ws.close(code=4406)
139
+
140
+ else: # pragma: no cover
141
+ raise ValueError("Unknown scope type: {!r}".format(scope["type"]))
142
+
143
+ def pick_preferred_protocol(self, ws: WebSocket) -> Optional[str]:
144
+ protocols = ws["subprotocols"]
145
+ intersection = set(protocols) & set(self.protocols)
146
+ sorted_intersection = sorted(intersection, key=protocols.index)
147
+ return next(iter(sorted_intersection), None)
148
+
149
+ async def get_root_value(self, request: Union[Request, WebSocket]) -> Optional[Any]:
150
+ return None
151
+
152
+ async def get_context(
153
+ self, request: Union[Request, WebSocket], response: Response
154
+ ) -> Context:
155
+ return {"request": request, "response": response} # type: ignore
156
+
157
+ async def get_sub_response(
158
+ self,
159
+ request: Union[Request, WebSocket],
160
+ ) -> Response:
161
+ sub_response = Response()
162
+ sub_response.status_code = None # type: ignore
163
+ del sub_response.headers["content-length"]
164
+
165
+ return sub_response
166
+
167
+ async def handle_http(
168
+ self,
169
+ scope: Scope,
170
+ receive: Receive,
171
+ send: Send,
172
+ ) -> None:
173
+ request = Request(scope=scope, receive=receive)
174
+
175
+ try:
176
+ response = await self.run(request)
177
+ except HTTPException as e:
178
+ response = PlainTextResponse(
179
+ e.reason, status_code=e.status_code
180
+ ) # pyright: ignore
181
+
182
+ await response(scope, receive, send)
183
+
184
+ def render_graphiql(self, request: Union[Request, WebSocket]) -> Response:
185
+ html = get_graphiql_html()
186
+
187
+ return HTMLResponse(html)
188
+
189
+ def create_response(
190
+ self, response_data: GraphQLHTTPResponse, sub_response: Response
191
+ ) -> Response:
192
+ response = Response(
193
+ self.encode_json(response_data),
194
+ status_code=status.HTTP_200_OK,
195
+ media_type="application/json",
196
+ )
197
+
198
+ response.headers.raw.extend(sub_response.headers.raw)
199
+
200
+ if sub_response.background:
201
+ response.background = sub_response.background
202
+
203
+ if sub_response.status_code:
204
+ response.status_code = sub_response.status_code
205
+
206
+ return response
@@ -2,6 +2,5 @@ from strawberry.asgi.handlers.graphql_transport_ws_handler import (
2
2
  GraphQLTransportWSHandler,
3
3
  )
4
4
  from strawberry.asgi.handlers.graphql_ws_handler import GraphQLWSHandler
5
- from strawberry.asgi.handlers.http_handler import HTTPHandler
6
5
 
7
- __all__ = ["GraphQLTransportWSHandler", "GraphQLWSHandler", "HTTPHandler"]
6
+ __all__ = ["GraphQLTransportWSHandler", "GraphQLWSHandler"]
@@ -0,0 +1,135 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import TYPE_CHECKING, Any, Dict, Mapping, Optional, Union, cast
4
+
5
+ from chalice.app import Request, Response
6
+ from strawberry.http.exceptions import HTTPException
7
+ from strawberry.http.sync_base_view import SyncBaseHTTPView, SyncHTTPRequestAdapter
8
+ from strawberry.http.temporal_response import TemporalResponse
9
+ from strawberry.http.types import HTTPMethod, QueryParams
10
+ from strawberry.http.typevars import Context, RootValue
11
+ from strawberry.utils.graphiql import get_graphiql_html
12
+
13
+ if TYPE_CHECKING:
14
+ from strawberry.http import GraphQLHTTPResponse
15
+ from strawberry.schema import BaseSchema
16
+
17
+
18
+ class ChaliceHTTPRequestAdapter(SyncHTTPRequestAdapter):
19
+ def __init__(self, request: Request):
20
+ self.request = request
21
+
22
+ @property
23
+ def query_params(self) -> QueryParams:
24
+ return self.request.query_params or {} # type: ignore
25
+
26
+ @property
27
+ def body(self) -> Union[str, bytes]:
28
+ return self.request.raw_body
29
+
30
+ @property
31
+ def method(self) -> HTTPMethod:
32
+ return cast(HTTPMethod, self.request.method.upper())
33
+
34
+ @property
35
+ def headers(self) -> Mapping[str, str]:
36
+ return self.request.headers
37
+
38
+ @property
39
+ def post_data(self) -> Mapping[str, Union[str, bytes]]:
40
+ raise NotImplementedError
41
+
42
+ @property
43
+ def files(self) -> Mapping[str, Any]:
44
+ raise NotImplementedError
45
+
46
+ @property
47
+ def content_type(self) -> Optional[str]:
48
+ return self.request.headers.get("Content-Type", None)
49
+
50
+
51
+ class GraphQLView(
52
+ SyncBaseHTTPView[Request, Response, TemporalResponse, Context, RootValue]
53
+ ):
54
+ allow_queries_via_get: bool = True
55
+ request_adapter_class = ChaliceHTTPRequestAdapter
56
+
57
+ def __init__(
58
+ self,
59
+ schema: BaseSchema,
60
+ graphiql: bool = True,
61
+ allow_queries_via_get: bool = True,
62
+ ):
63
+ self.graphiql = graphiql
64
+ self.allow_queries_via_get = allow_queries_via_get
65
+ self.schema = schema
66
+
67
+ def get_root_value(self, request: Request) -> Optional[RootValue]:
68
+ return None
69
+
70
+ def render_graphiql(self, request: Request) -> Response:
71
+ """
72
+ Returns a string containing the html for the graphiql webpage. It also caches
73
+ the result using lru cache.
74
+ This saves loading from disk each time it is invoked.
75
+
76
+ Returns:
77
+ The GraphiQL html page as a string
78
+ """
79
+ return get_graphiql_html(subscription_enabled=False) # type: ignore
80
+
81
+ def get_sub_response(self, request: Request) -> TemporalResponse:
82
+ return TemporalResponse()
83
+
84
+ @staticmethod
85
+ def error_response(
86
+ message: str,
87
+ error_code: str,
88
+ http_status_code: int,
89
+ headers: Optional[Dict[str, str]] = None,
90
+ ) -> Response:
91
+ """
92
+ A wrapper for error responses
93
+ Returns:
94
+ An errors response
95
+ """
96
+ body = {"Code": error_code, "Message": message}
97
+
98
+ return Response(body=body, status_code=http_status_code, headers=headers)
99
+
100
+ def get_context(self, request: Request, response: TemporalResponse) -> Context:
101
+ return {"request": request, "response": response} # type: ignore
102
+
103
+ def create_response(
104
+ self, response_data: GraphQLHTTPResponse, sub_response: TemporalResponse
105
+ ) -> Response:
106
+ status_code = 200
107
+
108
+ if sub_response.status_code != 200:
109
+ status_code = sub_response.status_code
110
+
111
+ return Response(
112
+ body=self.encode_json(response_data),
113
+ status_code=status_code,
114
+ headers=sub_response.headers,
115
+ )
116
+
117
+ def execute_request(self, request: Request) -> Response:
118
+ try:
119
+ return self.run(request=request)
120
+ except HTTPException as e:
121
+ error_code_map = {
122
+ 400: "BadRequestError",
123
+ 401: "UnauthorizedError",
124
+ 403: "ForbiddenError",
125
+ 404: "NotFoundError",
126
+ 409: "ConflictError",
127
+ 429: "TooManyRequestsError",
128
+ 500: "ChaliceViewError",
129
+ }
130
+
131
+ return self.error_response(
132
+ error_code=error_code_map.get(e.status_code, "ChaliceViewError"),
133
+ message=e.reason,
134
+ http_status_code=e.status_code,
135
+ )
@@ -1,4 +1,5 @@
1
1
  import os
2
+ from typing import Any
2
3
 
3
4
  from starlette.applications import Starlette
4
5
  from starlette.middleware.cors import CORSMiddleware
@@ -21,7 +22,7 @@ schema_symbol = import_module_symbol(schema_import_string, default_symbol_name="
21
22
  log_operations = os.environ[DEBUG_SERVER_LOG_OPERATIONS] == "True"
22
23
 
23
24
  assert isinstance(schema_symbol, Schema)
24
- graphql_app = GraphQL(schema_symbol, debug=log_operations)
25
+ graphql_app = GraphQL[Any, Any](schema_symbol, debug=log_operations)
25
26
 
26
27
  paths = ["/", "/graphql"]
27
28
  for path in paths: