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