strawberry-graphql 0.220.0.dev1709543239__tar.gz → 0.221.0.dev1710955937__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 (248) hide show
  1. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/PKG-INFO +1 -1
  2. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/pyproject.toml +1 -1
  3. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/channels/testing.py +5 -1
  4. strawberry_graphql-0.221.0.dev1710955937/strawberry/schema/execute.py +263 -0
  5. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/schema_codegen/__init__.py +196 -15
  6. strawberry_graphql-0.220.0.dev1709543239/strawberry/schema/execute.py +0 -274
  7. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/LICENSE +0 -0
  8. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/README.md +0 -0
  9. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/__init__.py +0 -0
  10. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/__main__.py +0 -0
  11. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/aiohttp/__init__.py +0 -0
  12. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/aiohttp/handlers/__init__.py +0 -0
  13. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/aiohttp/handlers/graphql_transport_ws_handler.py +0 -0
  14. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/aiohttp/handlers/graphql_ws_handler.py +0 -0
  15. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/aiohttp/test/__init__.py +0 -0
  16. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/aiohttp/test/client.py +0 -0
  17. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/aiohttp/views.py +0 -0
  18. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/annotation.py +0 -0
  19. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/arguments.py +0 -0
  20. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/asgi/__init__.py +0 -0
  21. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/asgi/handlers/__init__.py +0 -0
  22. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/asgi/handlers/graphql_transport_ws_handler.py +0 -0
  23. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/asgi/handlers/graphql_ws_handler.py +0 -0
  24. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/asgi/test/__init__.py +0 -0
  25. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/asgi/test/client.py +0 -0
  26. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/auto.py +0 -0
  27. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/chalice/__init__.py +0 -0
  28. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/chalice/views.py +0 -0
  29. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/channels/__init__.py +0 -0
  30. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/channels/handlers/base.py +0 -0
  31. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/channels/handlers/graphql_transport_ws_handler.py +0 -0
  32. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/channels/handlers/graphql_ws_handler.py +0 -0
  33. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/channels/handlers/http_handler.py +0 -0
  34. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/channels/handlers/ws_handler.py +0 -0
  35. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/channels/router.py +0 -0
  36. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/cli/__init__.py +0 -0
  37. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/cli/app.py +0 -0
  38. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/cli/commands/__init__.py +0 -0
  39. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/cli/commands/codegen.py +0 -0
  40. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/cli/commands/export_schema.py +0 -0
  41. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/cli/commands/schema_codegen.py +0 -0
  42. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/cli/commands/server.py +0 -0
  43. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/cli/commands/upgrade/__init__.py +0 -0
  44. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/cli/commands/upgrade/_fake_progress.py +0 -0
  45. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/cli/commands/upgrade/_run_codemod.py +0 -0
  46. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/cli/constants.py +0 -0
  47. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/cli/debug_server.py +0 -0
  48. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/cli/utils/__init__.py +0 -0
  49. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/cli/utils/load_schema.py +0 -0
  50. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/codegen/__init__.py +0 -0
  51. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/codegen/exceptions.py +0 -0
  52. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/codegen/plugins/__init__.py +0 -0
  53. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/codegen/plugins/print_operation.py +0 -0
  54. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/codegen/plugins/python.py +0 -0
  55. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/codegen/plugins/typescript.py +0 -0
  56. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/codegen/query_codegen.py +0 -0
  57. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/codegen/types.py +0 -0
  58. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/codemods/__init__.py +0 -0
  59. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/codemods/annotated_unions.py +0 -0
  60. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/custom_scalar.py +0 -0
  61. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/dataloader.py +0 -0
  62. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/directive.py +0 -0
  63. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/django/__init__.py +0 -0
  64. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/django/apps.py +0 -0
  65. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/django/context.py +0 -0
  66. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/django/test/__init__.py +0 -0
  67. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/django/test/client.py +0 -0
  68. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/django/views.py +0 -0
  69. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/enum.py +0 -0
  70. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/exceptions/__init__.py +0 -0
  71. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/exceptions/conflicting_arguments.py +0 -0
  72. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/exceptions/duplicated_type_name.py +0 -0
  73. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/exceptions/exception.py +0 -0
  74. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/exceptions/exception_source.py +0 -0
  75. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/exceptions/handler.py +0 -0
  76. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/exceptions/invalid_argument_type.py +0 -0
  77. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/exceptions/invalid_union_type.py +0 -0
  78. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/exceptions/missing_arguments_annotations.py +0 -0
  79. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/exceptions/missing_field_annotation.py +0 -0
  80. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/exceptions/missing_return_annotation.py +0 -0
  81. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/exceptions/not_a_strawberry_enum.py +0 -0
  82. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/exceptions/object_is_not_a_class.py +0 -0
  83. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/exceptions/object_is_not_an_enum.py +0 -0
  84. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/exceptions/permission_fail_silently_requires_optional.py +0 -0
  85. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/exceptions/private_strawberry_field.py +0 -0
  86. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/exceptions/scalar_already_registered.py +0 -0
  87. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/exceptions/syntax.py +0 -0
  88. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/exceptions/unresolved_field_type.py +0 -0
  89. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/exceptions/utils/__init__.py +0 -0
  90. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/exceptions/utils/source_finder.py +0 -0
  91. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/experimental/__init__.py +0 -0
  92. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/experimental/pydantic/__init__.py +0 -0
  93. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/experimental/pydantic/_compat.py +0 -0
  94. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/experimental/pydantic/conversion.py +0 -0
  95. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/experimental/pydantic/conversion_types.py +0 -0
  96. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/experimental/pydantic/error_type.py +0 -0
  97. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/experimental/pydantic/exceptions.py +0 -0
  98. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/experimental/pydantic/fields.py +0 -0
  99. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/experimental/pydantic/object_type.py +0 -0
  100. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/experimental/pydantic/utils.py +0 -0
  101. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/ext/LICENSE +0 -0
  102. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/ext/__init__.py +0 -0
  103. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/ext/dataclasses/LICENSE +0 -0
  104. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/ext/dataclasses/__init__.py +0 -0
  105. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/ext/dataclasses/dataclasses.py +0 -0
  106. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/ext/mypy_plugin.py +0 -0
  107. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/extensions/__init__.py +0 -0
  108. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/extensions/add_validation_rules.py +0 -0
  109. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/extensions/base_extension.py +0 -0
  110. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/extensions/context.py +0 -0
  111. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/extensions/directives.py +0 -0
  112. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/extensions/disable_validation.py +0 -0
  113. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/extensions/field_extension.py +0 -0
  114. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/extensions/mask_errors.py +0 -0
  115. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/extensions/max_aliases.py +0 -0
  116. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/extensions/max_tokens.py +0 -0
  117. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/extensions/parser_cache.py +0 -0
  118. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/extensions/pyinstrument.py +0 -0
  119. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/extensions/query_depth_limiter.py +0 -0
  120. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/extensions/runner.py +0 -0
  121. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/extensions/tracing/__init__.py +0 -0
  122. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/extensions/tracing/apollo.py +0 -0
  123. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/extensions/tracing/datadog.py +0 -0
  124. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/extensions/tracing/opentelemetry.py +0 -0
  125. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/extensions/tracing/sentry.py +0 -0
  126. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/extensions/tracing/utils.py +0 -0
  127. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/extensions/utils.py +0 -0
  128. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/extensions/validation_cache.py +0 -0
  129. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/fastapi/__init__.py +0 -0
  130. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/fastapi/context.py +0 -0
  131. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/fastapi/handlers/__init__.py +0 -0
  132. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/fastapi/handlers/graphql_transport_ws_handler.py +0 -0
  133. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/fastapi/handlers/graphql_ws_handler.py +0 -0
  134. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/fastapi/router.py +0 -0
  135. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/federation/__init__.py +0 -0
  136. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/federation/argument.py +0 -0
  137. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/federation/enum.py +0 -0
  138. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/federation/field.py +0 -0
  139. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/federation/mutation.py +0 -0
  140. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/federation/object_type.py +0 -0
  141. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/federation/scalar.py +0 -0
  142. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/federation/schema.py +0 -0
  143. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/federation/schema_directive.py +0 -0
  144. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/federation/schema_directives.py +0 -0
  145. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/federation/types.py +0 -0
  146. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/federation/union.py +0 -0
  147. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/field.py +0 -0
  148. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/field_extensions/__init__.py +0 -0
  149. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/field_extensions/input_mutation.py +0 -0
  150. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/file_uploads/__init__.py +0 -0
  151. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/file_uploads/scalars.py +0 -0
  152. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/file_uploads/utils.py +0 -0
  153. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/flask/__init__.py +0 -0
  154. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/flask/views.py +0 -0
  155. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/http/__init__.py +0 -0
  156. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/http/async_base_view.py +0 -0
  157. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/http/base.py +0 -0
  158. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/http/exceptions.py +0 -0
  159. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/http/ides.py +0 -0
  160. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/http/sync_base_view.py +0 -0
  161. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/http/temporal_response.py +0 -0
  162. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/http/types.py +0 -0
  163. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/http/typevars.py +0 -0
  164. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/lazy_type.py +0 -0
  165. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/litestar/__init__.py +0 -0
  166. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/litestar/controller.py +0 -0
  167. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/litestar/handlers/graphql_transport_ws_handler.py +0 -0
  168. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/litestar/handlers/graphql_ws_handler.py +0 -0
  169. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/mutation.py +0 -0
  170. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/object_type.py +0 -0
  171. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/parent.py +0 -0
  172. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/permission.py +0 -0
  173. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/printer/__init__.py +0 -0
  174. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/printer/ast_from_value.py +0 -0
  175. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/printer/printer.py +0 -0
  176. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/private.py +0 -0
  177. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/py.typed +0 -0
  178. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/quart/__init__.py +0 -0
  179. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/quart/views.py +0 -0
  180. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/relay/__init__.py +0 -0
  181. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/relay/exceptions.py +0 -0
  182. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/relay/fields.py +0 -0
  183. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/relay/types.py +0 -0
  184. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/relay/utils.py +0 -0
  185. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/resolvers.py +0 -0
  186. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/sanic/__init__.py +0 -0
  187. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/sanic/context.py +0 -0
  188. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/sanic/utils.py +0 -0
  189. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/sanic/views.py +0 -0
  190. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/scalars.py +0 -0
  191. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/schema/__init__.py +0 -0
  192. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/schema/base.py +0 -0
  193. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/schema/compat.py +0 -0
  194. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/schema/config.py +0 -0
  195. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/schema/exceptions.py +0 -0
  196. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/schema/name_converter.py +0 -0
  197. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/schema/schema.py +0 -0
  198. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/schema/schema_converter.py +0 -0
  199. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/schema/types/__init__.py +0 -0
  200. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/schema/types/base_scalars.py +0 -0
  201. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/schema/types/concrete_type.py +0 -0
  202. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/schema/types/scalar.py +0 -0
  203. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/schema_directive.py +0 -0
  204. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/starlite/__init__.py +0 -0
  205. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/starlite/controller.py +0 -0
  206. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/starlite/handlers/graphql_transport_ws_handler.py +0 -0
  207. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/starlite/handlers/graphql_ws_handler.py +0 -0
  208. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/static/apollo-sandbox.html +0 -0
  209. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/static/graphiql.html +0 -0
  210. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/static/pathfinder.html +0 -0
  211. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/subscriptions/__init__.py +0 -0
  212. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/subscriptions/protocols/__init__.py +0 -0
  213. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/subscriptions/protocols/graphql_transport_ws/__init__.py +0 -0
  214. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/subscriptions/protocols/graphql_transport_ws/handlers.py +0 -0
  215. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/subscriptions/protocols/graphql_transport_ws/types.py +0 -0
  216. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/subscriptions/protocols/graphql_ws/__init__.py +0 -0
  217. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/subscriptions/protocols/graphql_ws/handlers.py +0 -0
  218. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/subscriptions/protocols/graphql_ws/types.py +0 -0
  219. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/test/__init__.py +0 -0
  220. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/test/client.py +0 -0
  221. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/tools/__init__.py +0 -0
  222. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/tools/create_type.py +0 -0
  223. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/tools/merge_types.py +0 -0
  224. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/type.py +0 -0
  225. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/types/__init__.py +0 -0
  226. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/types/execution.py +0 -0
  227. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/types/fields/__init__.py +0 -0
  228. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/types/fields/resolver.py +0 -0
  229. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/types/graphql.py +0 -0
  230. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/types/info.py +0 -0
  231. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/types/nodes.py +0 -0
  232. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/types/type_resolver.py +0 -0
  233. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/types/types.py +0 -0
  234. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/union.py +0 -0
  235. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/unset.py +0 -0
  236. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/utils/__init__.py +0 -0
  237. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/utils/aio.py +0 -0
  238. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/utils/await_maybe.py +0 -0
  239. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/utils/dataclasses.py +0 -0
  240. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/utils/debug.py +0 -0
  241. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/utils/deprecations.py +0 -0
  242. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/utils/graphql_lexer.py +0 -0
  243. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/utils/importer.py +0 -0
  244. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/utils/inspect.py +0 -0
  245. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/utils/logging.py +0 -0
  246. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/utils/operation.py +0 -0
  247. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/utils/str_converters.py +0 -0
  248. {strawberry_graphql-0.220.0.dev1709543239 → strawberry_graphql-0.221.0.dev1710955937}/strawberry/utils/typing.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: strawberry-graphql
3
- Version: 0.220.0.dev1709543239
3
+ Version: 0.221.0.dev1710955937
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.220.0.dev.1709543239"
4
+ version = "0.221.0.dev.1710955937"
5
5
  description = "A library for creating GraphQL APIs"
6
6
  authors = ["Patrick Arminio <patrick.arminio@gmail.com>"]
7
7
  license = "MIT"
@@ -69,6 +69,7 @@ class GraphQLWebsocketCommunicator(WebsocketCommunicator):
69
69
  path: str,
70
70
  headers: Optional[List[Tuple[bytes, bytes]]] = None,
71
71
  protocol: str = GRAPHQL_TRANSPORT_WS_PROTOCOL,
72
+ connection_params: dict = {},
72
73
  **kwargs: Any,
73
74
  ):
74
75
  """
@@ -81,6 +82,7 @@ class GraphQLWebsocketCommunicator(WebsocketCommunicator):
81
82
  self.protocol = protocol
82
83
  subprotocols = kwargs.get("subprotocols", [])
83
84
  subprotocols.append(protocol)
85
+ self.connection_params = connection_params
84
86
  super().__init__(application, path, headers, subprotocols=subprotocols)
85
87
 
86
88
  async def __aenter__(self) -> Self:
@@ -99,7 +101,9 @@ class GraphQLWebsocketCommunicator(WebsocketCommunicator):
99
101
  res = await self.connect()
100
102
  if self.protocol == GRAPHQL_TRANSPORT_WS_PROTOCOL:
101
103
  assert res == (True, GRAPHQL_TRANSPORT_WS_PROTOCOL)
102
- await self.send_json_to(ConnectionInitMessage().as_dict())
104
+ await self.send_json_to(
105
+ ConnectionInitMessage(payload=self.connection_params).as_dict()
106
+ )
103
107
  response = await self.receive_json_from()
104
108
  assert response == ConnectionAckMessage().as_dict()
105
109
  else:
@@ -0,0 +1,263 @@
1
+ from __future__ import annotations
2
+
3
+ from asyncio import ensure_future
4
+ from inspect import isawaitable
5
+ from typing import (
6
+ TYPE_CHECKING,
7
+ Awaitable,
8
+ Callable,
9
+ Iterable,
10
+ List,
11
+ Optional,
12
+ Sequence,
13
+ Tuple,
14
+ Type,
15
+ TypedDict,
16
+ Union,
17
+ cast,
18
+ )
19
+
20
+ from graphql import GraphQLError, parse
21
+ from graphql import execute as original_execute
22
+ from graphql.validation import validate
23
+
24
+ from strawberry.exceptions import MissingQueryError
25
+ from strawberry.extensions.runner import SchemaExtensionsRunner
26
+ from strawberry.types import ExecutionResult
27
+
28
+ from .exceptions import InvalidOperationTypeError
29
+
30
+ if TYPE_CHECKING:
31
+ from typing_extensions import NotRequired, Unpack
32
+
33
+ from graphql import ExecutionContext as GraphQLExecutionContext
34
+ from graphql import ExecutionResult as GraphQLExecutionResult
35
+ from graphql import GraphQLSchema
36
+ from graphql.language import DocumentNode
37
+ from graphql.validation import ASTValidationRule
38
+
39
+ from strawberry.extensions import SchemaExtension
40
+ from strawberry.types import ExecutionContext
41
+ from strawberry.types.graphql import OperationType
42
+
43
+
44
+ # duplicated because of https://github.com/mkdocstrings/griffe-typingdoc/issues/7
45
+ class ParseOptions(TypedDict):
46
+ max_tokens: NotRequired[int]
47
+
48
+
49
+ def parse_document(query: str, **kwargs: Unpack[ParseOptions]) -> DocumentNode:
50
+ return parse(query, **kwargs)
51
+
52
+
53
+ def validate_document(
54
+ schema: GraphQLSchema,
55
+ document: DocumentNode,
56
+ validation_rules: Tuple[Type[ASTValidationRule], ...],
57
+ ) -> List[GraphQLError]:
58
+ return validate(
59
+ schema,
60
+ document,
61
+ validation_rules,
62
+ )
63
+
64
+
65
+ def _run_validation(execution_context: ExecutionContext) -> None:
66
+ # Check if there are any validation rules or if validation has
67
+ # already been run by an extension
68
+ if len(execution_context.validation_rules) > 0 and execution_context.errors is None:
69
+ assert execution_context.graphql_document
70
+ execution_context.errors = validate_document(
71
+ execution_context.schema._schema,
72
+ execution_context.graphql_document,
73
+ execution_context.validation_rules,
74
+ )
75
+
76
+
77
+ async def execute(
78
+ schema: GraphQLSchema,
79
+ *,
80
+ allowed_operation_types: Iterable[OperationType],
81
+ extensions: Sequence[Union[Type[SchemaExtension], SchemaExtension]],
82
+ execution_context: ExecutionContext,
83
+ execution_context_class: Optional[Type[GraphQLExecutionContext]] = None,
84
+ process_errors: Callable[[List[GraphQLError], Optional[ExecutionContext]], None],
85
+ ) -> ExecutionResult:
86
+ extensions_runner = SchemaExtensionsRunner(
87
+ execution_context=execution_context,
88
+ extensions=list(extensions),
89
+ )
90
+
91
+ async with extensions_runner.operation():
92
+ # Note: In graphql-core the schema would be validated here but in
93
+ # Strawberry we are validating it at initialisation time instead
94
+ if not execution_context.query:
95
+ raise MissingQueryError()
96
+
97
+ async with extensions_runner.parsing():
98
+ try:
99
+ if not execution_context.graphql_document:
100
+ execution_context.graphql_document = parse_document(
101
+ execution_context.query, **execution_context.parse_options
102
+ )
103
+
104
+ except GraphQLError as error:
105
+ execution_context.errors = [error]
106
+ process_errors([error], execution_context)
107
+ return ExecutionResult(
108
+ data=None,
109
+ errors=[error],
110
+ extensions=await extensions_runner.get_extensions_results(),
111
+ )
112
+
113
+ except Exception as error: # pragma: no cover
114
+ error = GraphQLError(str(error), original_error=error)
115
+
116
+ execution_context.errors = [error]
117
+ process_errors([error], execution_context)
118
+
119
+ return ExecutionResult(
120
+ data=None,
121
+ errors=[error],
122
+ extensions=await extensions_runner.get_extensions_results(),
123
+ )
124
+
125
+ if execution_context.operation_type not in allowed_operation_types:
126
+ raise InvalidOperationTypeError(execution_context.operation_type)
127
+
128
+ async with extensions_runner.validation():
129
+ _run_validation(execution_context)
130
+ if execution_context.errors:
131
+ process_errors(execution_context.errors, execution_context)
132
+ return ExecutionResult(data=None, errors=execution_context.errors)
133
+
134
+ async with extensions_runner.executing():
135
+ if not execution_context.result:
136
+ result = original_execute(
137
+ schema,
138
+ execution_context.graphql_document,
139
+ root_value=execution_context.root_value,
140
+ middleware=extensions_runner.as_middleware_manager(),
141
+ variable_values=execution_context.variables,
142
+ operation_name=execution_context.operation_name,
143
+ context_value=execution_context.context,
144
+ execution_context_class=execution_context_class,
145
+ )
146
+
147
+ if isawaitable(result):
148
+ result = await cast(Awaitable["GraphQLExecutionResult"], result)
149
+
150
+ result = cast("GraphQLExecutionResult", result)
151
+ execution_context.result = result
152
+ # Also set errors on the execution_context so that it's easier
153
+ # to access in extensions
154
+ if result.errors:
155
+ execution_context.errors = result.errors
156
+
157
+ # Run the `Schema.process_errors` function here before
158
+ # extensions have a chance to modify them (see the MaskErrors
159
+ # extension). That way we can log the original errors but
160
+ # only return a sanitised version to the client.
161
+ process_errors(result.errors, execution_context)
162
+
163
+ return ExecutionResult(
164
+ data=execution_context.result.data,
165
+ errors=execution_context.result.errors,
166
+ extensions=await extensions_runner.get_extensions_results(),
167
+ )
168
+
169
+
170
+ def execute_sync(
171
+ schema: GraphQLSchema,
172
+ *,
173
+ allowed_operation_types: Iterable[OperationType],
174
+ extensions: Sequence[Union[Type[SchemaExtension], SchemaExtension]],
175
+ execution_context: ExecutionContext,
176
+ execution_context_class: Optional[Type[GraphQLExecutionContext]] = None,
177
+ process_errors: Callable[[List[GraphQLError], Optional[ExecutionContext]], None],
178
+ ) -> ExecutionResult:
179
+ extensions_runner = SchemaExtensionsRunner(
180
+ execution_context=execution_context,
181
+ extensions=list(extensions),
182
+ )
183
+
184
+ with extensions_runner.operation():
185
+ # Note: In graphql-core the schema would be validated here but in
186
+ # Strawberry we are validating it at initialisation time instead
187
+ if not execution_context.query:
188
+ raise MissingQueryError()
189
+
190
+ with extensions_runner.parsing():
191
+ try:
192
+ if not execution_context.graphql_document:
193
+ execution_context.graphql_document = parse_document(
194
+ execution_context.query, **execution_context.parse_options
195
+ )
196
+
197
+ except GraphQLError as error:
198
+ execution_context.errors = [error]
199
+ process_errors([error], execution_context)
200
+ return ExecutionResult(
201
+ data=None,
202
+ errors=[error],
203
+ extensions=extensions_runner.get_extensions_results_sync(),
204
+ )
205
+
206
+ except Exception as error: # pragma: no cover
207
+ error = GraphQLError(str(error), original_error=error)
208
+
209
+ execution_context.errors = [error]
210
+ process_errors([error], execution_context)
211
+ return ExecutionResult(
212
+ data=None,
213
+ errors=[error],
214
+ extensions=extensions_runner.get_extensions_results_sync(),
215
+ )
216
+
217
+ if execution_context.operation_type not in allowed_operation_types:
218
+ raise InvalidOperationTypeError(execution_context.operation_type)
219
+
220
+ with extensions_runner.validation():
221
+ _run_validation(execution_context)
222
+ if execution_context.errors:
223
+ process_errors(execution_context.errors, execution_context)
224
+ return ExecutionResult(data=None, errors=execution_context.errors)
225
+
226
+ with extensions_runner.executing():
227
+ if not execution_context.result:
228
+ result = original_execute(
229
+ schema,
230
+ execution_context.graphql_document,
231
+ root_value=execution_context.root_value,
232
+ middleware=extensions_runner.as_middleware_manager(),
233
+ variable_values=execution_context.variables,
234
+ operation_name=execution_context.operation_name,
235
+ context_value=execution_context.context,
236
+ execution_context_class=execution_context_class,
237
+ )
238
+
239
+ if isawaitable(result):
240
+ result = cast(Awaitable["GraphQLExecutionResult"], result)
241
+ ensure_future(result).cancel()
242
+ raise RuntimeError(
243
+ "GraphQL execution failed to complete synchronously."
244
+ )
245
+
246
+ result = cast("GraphQLExecutionResult", result)
247
+ execution_context.result = result
248
+ # Also set errors on the execution_context so that it's easier
249
+ # to access in extensions
250
+ if result.errors:
251
+ execution_context.errors = result.errors
252
+
253
+ # Run the `Schema.process_errors` function here before
254
+ # extensions have a chance to modify them (see the MaskErrors
255
+ # extension). That way we can log the original errors but
256
+ # only return a sanitised version to the client.
257
+ process_errors(result.errors, execution_context)
258
+
259
+ return ExecutionResult(
260
+ data=execution_context.result.data,
261
+ errors=execution_context.result.errors,
262
+ extensions=extensions_runner.get_extensions_results_sync(),
263
+ )
@@ -2,6 +2,9 @@ from __future__ import annotations
2
2
 
3
3
  import dataclasses
4
4
  import keyword
5
+ from collections import defaultdict
6
+ from typing import TYPE_CHECKING, Tuple
7
+ from typing_extensions import Protocol
5
8
 
6
9
  import libcst as cst
7
10
  from graphql import (
@@ -19,6 +22,7 @@ from graphql import (
19
22
  OperationType,
20
23
  ScalarTypeDefinitionNode,
21
24
  SchemaDefinitionNode,
25
+ SchemaExtensionNode,
22
26
  StringValueNode,
23
27
  TypeNode,
24
28
  UnionTypeDefinitionNode,
@@ -27,6 +31,14 @@ from graphql import (
27
31
 
28
32
  from strawberry.utils.str_converters import to_snake_case
29
33
 
34
+ if TYPE_CHECKING:
35
+ from graphql.language.ast import ConstDirectiveNode
36
+
37
+
38
+ class HasDirectives(Protocol):
39
+ directives: Tuple[ConstDirectiveNode]
40
+
41
+
30
42
  _SCALAR_MAP = {
31
43
  "Int": cst.Name("int"),
32
44
  "Float": cst.Name("float"),
@@ -48,6 +60,19 @@ _SCALAR_MAP = {
48
60
  }
49
61
 
50
62
 
63
+ def _is_federation_link_directive(directive: ConstDirectiveNode) -> bool:
64
+ if directive.name.value != "link":
65
+ return False
66
+
67
+ for argument in directive.arguments:
68
+ if argument.name.value == "url":
69
+ return argument.value.value.startswith(
70
+ "https://specs.apollo.dev/federation"
71
+ )
72
+
73
+ return False
74
+
75
+
51
76
  def _get_field_type(
52
77
  field_type: TypeNode, was_non_nullable: bool = False
53
78
  ) -> cst.BaseExpression:
@@ -85,7 +110,10 @@ def _get_field_type(
85
110
  )
86
111
 
87
112
 
88
- def _get_argument(name: str, value: str) -> cst.Arg:
113
+ def _sanitize_argument(value: str | bool) -> cst.SimpleString | cst.Name:
114
+ if isinstance(value, bool):
115
+ return cst.Name(value=str(value))
116
+
89
117
  if "\n" in value:
90
118
  argument_value = cst.SimpleString(f'"""\n{value}\n"""')
91
119
  elif '"' in value:
@@ -93,6 +121,12 @@ def _get_argument(name: str, value: str) -> cst.Arg:
93
121
  else:
94
122
  argument_value = cst.SimpleString(f'"{value}"')
95
123
 
124
+ return argument_value
125
+
126
+
127
+ def _get_argument(name: str, value: str | bool) -> cst.Arg:
128
+ argument_value = _sanitize_argument(value)
129
+
96
130
  return cst.Arg(
97
131
  value=argument_value,
98
132
  keyword=cst.Name(name),
@@ -100,7 +134,25 @@ def _get_argument(name: str, value: str) -> cst.Arg:
100
134
  )
101
135
 
102
136
 
103
- def _get_field_value(description: str | None, alias: str | None) -> cst.Call | None:
137
+ def _get_argument_list(name: str, values: list[str]) -> cst.Arg:
138
+ value = cst.List(
139
+ elements=[cst.Element(value=_sanitize_argument(value)) for value in values],
140
+ )
141
+
142
+ return cst.Arg(
143
+ value=value,
144
+ keyword=cst.Name(name),
145
+ equal=cst.AssignEqual(cst.SimpleWhitespace(""), cst.SimpleWhitespace("")),
146
+ )
147
+
148
+
149
+ def _get_field_value(
150
+ field: FieldDefinitionNode | InputValueDefinitionNode,
151
+ alias: str | None,
152
+ is_apollo_federation: bool,
153
+ ) -> cst.Call | None:
154
+ description = field.description.value if field.description else None
155
+
104
156
  args = list(
105
157
  filter(
106
158
  None,
@@ -111,6 +163,24 @@ def _get_field_value(description: str | None, alias: str | None) -> cst.Call | N
111
163
  )
112
164
  )
113
165
 
166
+ directives = _get_directives(field)
167
+
168
+ apollo_federation_args = _get_federation_arguments(directives)
169
+
170
+ if is_apollo_federation and apollo_federation_args:
171
+ args.extend(apollo_federation_args)
172
+
173
+ return cst.Call(
174
+ func=cst.Attribute(
175
+ value=cst.Attribute(
176
+ value=cst.Name("strawberry"),
177
+ attr=cst.Name("federation"),
178
+ ),
179
+ attr=cst.Name("field"),
180
+ ),
181
+ args=args,
182
+ )
183
+
114
184
  if args:
115
185
  return cst.Call(
116
186
  func=cst.Attribute(
@@ -125,6 +195,7 @@ def _get_field_value(description: str | None, alias: str | None) -> cst.Call | N
125
195
 
126
196
  def _get_field(
127
197
  field: FieldDefinitionNode | InputValueDefinitionNode,
198
+ is_apollo_federation: bool,
128
199
  ) -> cst.SimpleStatementLine:
129
200
  name = to_snake_case(field.name.value)
130
201
  alias: str | None = None
@@ -141,19 +212,67 @@ def _get_field(
141
212
  _get_field_type(field.type),
142
213
  ),
143
214
  value=_get_field_value(
144
- description=field.description.value if field.description else None,
145
- alias=alias if alias != name else None,
215
+ field, alias=alias, is_apollo_federation=is_apollo_federation
146
216
  ),
147
217
  )
148
218
  ]
149
219
  )
150
220
 
151
221
 
222
+ def _get_directives(definition: HasDirectives) -> dict[str, list[dict[str, str]]]:
223
+ directives = defaultdict(list)
224
+
225
+ for directive in definition.directives:
226
+ directive_name = directive.name.value
227
+
228
+ directives[directive_name].append(
229
+ {
230
+ argument.name.value: argument.value.value
231
+ for argument in directive.arguments
232
+ }
233
+ )
234
+
235
+ return directives
236
+
237
+
238
+ def _get_federation_arguments(
239
+ directives: dict[str, list[dict[str, str]]],
240
+ ) -> list[cst.Arg]:
241
+ def append_arg_from_directive(
242
+ directive: str, argument_name: str, keyword_name: str | None = None
243
+ ):
244
+ keyword_name = keyword_name or directive
245
+
246
+ if directive in directives:
247
+ arguments.append(
248
+ _get_argument_list(
249
+ keyword_name,
250
+ [item[argument_name] for item in directives[directive]],
251
+ )
252
+ )
253
+
254
+ arguments: list[cst.Arg] = []
255
+
256
+ append_arg_from_directive("key", "fields", "keys")
257
+ append_arg_from_directive("requires", "fields")
258
+ append_arg_from_directive("provides", "fields")
259
+ append_arg_from_directive("tag", "name", "tags")
260
+
261
+ boolean_keys = ("shareable", "inaccessible", "external", "override")
262
+
263
+ arguments.extend(
264
+ _get_argument(key, True) for key in boolean_keys if directives.get(key, False)
265
+ )
266
+
267
+ return arguments
268
+
269
+
152
270
  def _get_strawberry_decorator(
153
271
  definition: ObjectTypeDefinitionNode
154
272
  | ObjectTypeExtensionNode
155
273
  | InterfaceTypeDefinitionNode
156
274
  | InputObjectTypeDefinitionNode,
275
+ is_apollo_federation: bool,
157
276
  ) -> cst.Decorator:
158
277
  type_ = {
159
278
  ObjectTypeDefinitionNode: "type",
@@ -168,15 +287,36 @@ def _get_strawberry_decorator(
168
287
  else None
169
288
  )
170
289
 
290
+ directives = _get_directives(definition)
291
+
171
292
  decorator: cst.BaseExpression = cst.Attribute(
172
293
  value=cst.Name("strawberry"),
173
294
  attr=cst.Name(type_),
174
295
  )
175
296
 
297
+ arguments: list[cst.Arg] = []
298
+
176
299
  if description is not None:
300
+ arguments.append(_get_argument("description", description.value))
301
+
302
+ federation_arguments = _get_federation_arguments(directives)
303
+
304
+ # and has any directive that is a federation directive
305
+ if is_apollo_federation and federation_arguments:
306
+ decorator = cst.Attribute(
307
+ value=cst.Attribute(
308
+ value=cst.Name("strawberry"),
309
+ attr=cst.Name("federation"),
310
+ ),
311
+ attr=cst.Name(type_),
312
+ )
313
+
314
+ arguments.extend(federation_arguments)
315
+
316
+ if arguments:
177
317
  decorator = cst.Call(
178
318
  func=decorator,
179
- args=[_get_argument("description", description.value)],
319
+ args=arguments,
180
320
  )
181
321
 
182
322
  return cst.Decorator(
@@ -189,8 +329,9 @@ def _get_class_definition(
189
329
  | ObjectTypeExtensionNode
190
330
  | InterfaceTypeDefinitionNode
191
331
  | InputObjectTypeDefinitionNode,
332
+ is_apollo_federation: bool,
192
333
  ) -> cst.ClassDef:
193
- decorator = _get_strawberry_decorator(definition)
334
+ decorator = _get_strawberry_decorator(definition, is_apollo_federation)
194
335
 
195
336
  bases = (
196
337
  [cst.Arg(cst.Name(interface.name.value)) for interface in definition.interfaces]
@@ -204,7 +345,11 @@ def _get_class_definition(
204
345
  return cst.ClassDef(
205
346
  name=cst.Name(definition.name.value),
206
347
  bases=bases,
207
- body=cst.IndentedBlock(body=[_get_field(field) for field in definition.fields]),
348
+ body=cst.IndentedBlock(
349
+ body=[
350
+ _get_field(field, is_apollo_federation) for field in definition.fields
351
+ ]
352
+ ),
208
353
  decorators=[decorator],
209
354
  )
210
355
 
@@ -243,6 +388,7 @@ def _get_schema_definition(
243
388
  root_query_name: str | None,
244
389
  root_mutation_name: str | None,
245
390
  root_subscription_name: str | None,
391
+ is_apollo_federation: bool,
246
392
  ) -> cst.SimpleStatementLine | None:
247
393
  if not any([root_query_name, root_mutation_name, root_subscription_name]):
248
394
  return None
@@ -265,17 +411,40 @@ def _get_schema_definition(
265
411
  if root_subscription_name:
266
412
  args.append(_get_arg("subscription", root_subscription_name))
267
413
 
414
+ schema_call = cst.Call(
415
+ func=cst.Attribute(
416
+ value=cst.Name("strawberry"),
417
+ attr=cst.Name("Schema"),
418
+ ),
419
+ args=args,
420
+ )
421
+
422
+ if is_apollo_federation:
423
+ args.append(
424
+ cst.Arg(
425
+ keyword=cst.Name("enable_federation_2"),
426
+ value=cst.Name("True"),
427
+ equal=cst.AssignEqual(
428
+ cst.SimpleWhitespace(""), cst.SimpleWhitespace("")
429
+ ),
430
+ )
431
+ )
432
+ schema_call = cst.Call(
433
+ func=cst.Attribute(
434
+ value=cst.Attribute(
435
+ value=cst.Name(value="strawberry"),
436
+ attr=cst.Name(value="federation"),
437
+ ),
438
+ attr=cst.Name(value="Schema"),
439
+ ),
440
+ args=args,
441
+ )
442
+
268
443
  return cst.SimpleStatementLine(
269
444
  body=[
270
445
  cst.Assign(
271
446
  targets=[cst.AssignTarget(cst.Name("schema"))],
272
- value=cst.Call(
273
- func=cst.Attribute(
274
- value=cst.Name("strawberry"),
275
- attr=cst.Name("Schema"),
276
- ),
277
- args=args,
278
- ),
447
+ value=schema_call,
279
448
  )
280
449
  ]
281
450
  )
@@ -430,6 +599,12 @@ def codegen(schema: str) -> str:
430
599
 
431
600
  object_types: dict[str, cst.ClassDef] = {}
432
601
 
602
+ # when we encounter a extend schema @link ..., we check if is an apollo federation schema
603
+ # and we use this variable to keep track of it, but at the moment the assumption is that
604
+ # the schema extension is always done at the top, this might not be the case all the
605
+ # time
606
+ is_apollo_federation = False
607
+
433
608
  for definition in document.definitions:
434
609
  if isinstance(
435
610
  definition,
@@ -440,7 +615,7 @@ def codegen(schema: str) -> str:
440
615
  ObjectTypeExtensionNode,
441
616
  ),
442
617
  ):
443
- class_definition = _get_class_definition(definition)
618
+ class_definition = _get_class_definition(definition, is_apollo_federation)
444
619
 
445
620
  object_types[definition.name.value] = class_definition
446
621
 
@@ -478,6 +653,11 @@ def codegen(schema: str) -> str:
478
653
  definitions.append(cst.EmptyLine())
479
654
  definitions.append(scalar_definition)
480
655
  definitions.append(cst.EmptyLine())
656
+ elif isinstance(definition, SchemaExtensionNode):
657
+ is_apollo_federation = any(
658
+ _is_federation_link_directive(directive)
659
+ for directive in definition.directives
660
+ )
481
661
  else:
482
662
  raise NotImplementedError(f"Unknown definition {definition}")
483
663
 
@@ -496,6 +676,7 @@ def codegen(schema: str) -> str:
496
676
  root_query_name=root_query_name,
497
677
  root_mutation_name=root_mutation_name,
498
678
  root_subscription_name=root_subscription_name,
679
+ is_apollo_federation=is_apollo_federation,
499
680
  )
500
681
 
501
682
  if schema_definition: