strawberry-graphql 0.267.0.dev1746643548__py3-none-any.whl → 0.268.1__py3-none-any.whl
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/__init__.py +0 -2
- strawberry/annotation.py +0 -7
- strawberry/http/__init__.py +9 -14
- strawberry/http/async_base_view.py +5 -81
- strawberry/parent.py +21 -2
- strawberry/printer/printer.py +2 -10
- strawberry/scalars.py +3 -1
- strawberry/schema/compat.py +2 -1
- strawberry/schema/config.py +1 -1
- strawberry/schema/schema.py +13 -60
- strawberry/schema/schema_converter.py +60 -8
- strawberry/schema/types/scalar.py +3 -16
- strawberry/static/graphiql.html +5 -5
- strawberry/types/arguments.py +2 -2
- strawberry/types/fields/resolver.py +12 -5
- strawberry/types/scalar.py +2 -0
- strawberry/utils/typing.py +18 -0
- {strawberry_graphql-0.267.0.dev1746643548.dist-info → strawberry_graphql-0.268.1.dist-info}/METADATA +1 -1
- {strawberry_graphql-0.267.0.dev1746643548.dist-info → strawberry_graphql-0.268.1.dist-info}/RECORD +22 -24
- strawberry/schema/_graphql_core.py +0 -46
- strawberry/streamable.py +0 -36
- {strawberry_graphql-0.267.0.dev1746643548.dist-info → strawberry_graphql-0.268.1.dist-info}/LICENSE +0 -0
- {strawberry_graphql-0.267.0.dev1746643548.dist-info → strawberry_graphql-0.268.1.dist-info}/WHEEL +0 -0
- {strawberry_graphql-0.267.0.dev1746643548.dist-info → strawberry_graphql-0.268.1.dist-info}/entry_points.txt +0 -0
strawberry/__init__.py
CHANGED
@@ -11,7 +11,6 @@ from .permission import BasePermission
|
|
11
11
|
from .scalars import ID
|
12
12
|
from .schema import Schema
|
13
13
|
from .schema_directive import schema_directive
|
14
|
-
from .streamable import Streamable
|
15
14
|
from .types.arguments import argument
|
16
15
|
from .types.auto import auto
|
17
16
|
from .types.cast import cast
|
@@ -38,7 +37,6 @@ __all__ = [
|
|
38
37
|
"Private",
|
39
38
|
"Schema",
|
40
39
|
"Some",
|
41
|
-
"Streamable",
|
42
40
|
"argument",
|
43
41
|
"asdict",
|
44
42
|
"auto",
|
strawberry/annotation.py
CHANGED
@@ -17,7 +17,6 @@ from typing import (
|
|
17
17
|
)
|
18
18
|
from typing_extensions import Self, get_args, get_origin
|
19
19
|
|
20
|
-
from strawberry.streamable import StrawberryStreamable
|
21
20
|
from strawberry.types.base import (
|
22
21
|
StrawberryList,
|
23
22
|
StrawberryMaybe,
|
@@ -144,8 +143,6 @@ class StrawberryAnnotation:
|
|
144
143
|
|
145
144
|
if self._is_lazy_type(evaled_type):
|
146
145
|
return evaled_type
|
147
|
-
if self._is_streamable(evaled_type, args):
|
148
|
-
return self.create_list(list[evaled_type])
|
149
146
|
if self._is_list(evaled_type):
|
150
147
|
return self.create_list(evaled_type)
|
151
148
|
if type_of := self._get_maybe_type(evaled_type):
|
@@ -326,10 +323,6 @@ class StrawberryAnnotation:
|
|
326
323
|
def _get_maybe_type(cls, annotation: Any) -> type | None:
|
327
324
|
return get_args(annotation)[0] if _annotation_is_maybe(annotation) else None
|
328
325
|
|
329
|
-
@classmethod
|
330
|
-
def _is_streamable(cls, annotation: Any, args: list[Any]) -> bool:
|
331
|
-
return any(isinstance(arg, StrawberryStreamable) for arg in args)
|
332
|
-
|
333
326
|
@classmethod
|
334
327
|
def _is_strawberry_type(cls, evaled_type: Any) -> bool:
|
335
328
|
# Prevent import cycles
|
strawberry/http/__init__.py
CHANGED
@@ -1,13 +1,11 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
|
3
3
|
from dataclasses import dataclass
|
4
|
-
from typing import Any, Optional
|
4
|
+
from typing import TYPE_CHECKING, Any, Optional
|
5
5
|
from typing_extensions import Literal, TypedDict
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
ResultType,
|
10
|
-
)
|
7
|
+
if TYPE_CHECKING:
|
8
|
+
from strawberry.types import ExecutionResult
|
11
9
|
|
12
10
|
|
13
11
|
class GraphQLHTTPResponse(TypedDict, total=False):
|
@@ -16,16 +14,13 @@ class GraphQLHTTPResponse(TypedDict, total=False):
|
|
16
14
|
extensions: Optional[dict[str, object]]
|
17
15
|
|
18
16
|
|
19
|
-
def process_result(result:
|
20
|
-
|
21
|
-
return result
|
17
|
+
def process_result(result: ExecutionResult) -> GraphQLHTTPResponse:
|
18
|
+
data: GraphQLHTTPResponse = {"data": result.data}
|
22
19
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
**({"extensions": extensions} if extensions else {}),
|
28
|
-
}
|
20
|
+
if result.errors:
|
21
|
+
data["errors"] = [err.formatted for err in result.errors]
|
22
|
+
if result.extensions:
|
23
|
+
data["extensions"] = result.extensions
|
29
24
|
|
30
25
|
return data
|
31
26
|
|
@@ -25,9 +25,6 @@ from strawberry.http import (
|
|
25
25
|
process_result,
|
26
26
|
)
|
27
27
|
from strawberry.http.ides import GraphQL_IDE
|
28
|
-
from strawberry.schema._graphql_core import (
|
29
|
-
GraphQLIncrementalExecutionResults,
|
30
|
-
)
|
31
28
|
from strawberry.schema.base import BaseSchema
|
32
29
|
from strawberry.schema.exceptions import InvalidOperationTypeError
|
33
30
|
from strawberry.subscriptions import GRAPHQL_TRANSPORT_WS_PROTOCOL, GRAPHQL_WS_PROTOCOL
|
@@ -261,7 +258,7 @@ class AsyncBaseHTTPView(
|
|
261
258
|
root_value: Optional[RootValue] = UNSET,
|
262
259
|
) -> WebSocketResponse: ...
|
263
260
|
|
264
|
-
async def run(
|
261
|
+
async def run(
|
265
262
|
self,
|
266
263
|
request: Union[Request, WebSocketRequest],
|
267
264
|
context: Optional[Context] = UNSET,
|
@@ -352,75 +349,6 @@ class AsyncBaseHTTPView(
|
|
352
349
|
"Content-Type": "multipart/mixed;boundary=graphql;subscriptionSpec=1.0,application/json",
|
353
350
|
},
|
354
351
|
)
|
355
|
-
if isinstance(result, GraphQLIncrementalExecutionResults):
|
356
|
-
|
357
|
-
async def stream() -> AsyncGenerator[str, None]:
|
358
|
-
yield "---"
|
359
|
-
|
360
|
-
response = await self.process_result(request, result.initial_result)
|
361
|
-
|
362
|
-
response["hasNext"] = result.initial_result.has_next
|
363
|
-
response["pending"] = [
|
364
|
-
p.formatted for p in result.initial_result.pending
|
365
|
-
]
|
366
|
-
response["extensions"] = result.initial_result.extensions
|
367
|
-
|
368
|
-
yield self.encode_multipart_data(response, "-")
|
369
|
-
|
370
|
-
all_pending = result.initial_result.pending
|
371
|
-
|
372
|
-
async for value in result.subsequent_results:
|
373
|
-
response = {
|
374
|
-
"hasNext": value.has_next,
|
375
|
-
"extensions": value.extensions,
|
376
|
-
}
|
377
|
-
|
378
|
-
if value.pending:
|
379
|
-
response["pending"] = [p.formatted for p in value.pending]
|
380
|
-
|
381
|
-
if value.completed:
|
382
|
-
response["completed"] = [p.formatted for p in value.completed]
|
383
|
-
|
384
|
-
if value.incremental:
|
385
|
-
incremental = []
|
386
|
-
|
387
|
-
all_pending.extend(value.pending)
|
388
|
-
|
389
|
-
for incremental_value in value.incremental:
|
390
|
-
pending_value = next(
|
391
|
-
(
|
392
|
-
v
|
393
|
-
for v in all_pending
|
394
|
-
if v.id == incremental_value.id
|
395
|
-
),
|
396
|
-
None,
|
397
|
-
)
|
398
|
-
|
399
|
-
assert pending_value
|
400
|
-
|
401
|
-
incremental.append(
|
402
|
-
{
|
403
|
-
**incremental_value.formatted,
|
404
|
-
"path": pending_value.path,
|
405
|
-
"label": pending_value.label,
|
406
|
-
}
|
407
|
-
)
|
408
|
-
|
409
|
-
response["incremental"] = incremental
|
410
|
-
|
411
|
-
yield self.encode_multipart_data(response, "-")
|
412
|
-
|
413
|
-
yield "--\r\n"
|
414
|
-
|
415
|
-
return await self.create_streaming_response(
|
416
|
-
request,
|
417
|
-
stream,
|
418
|
-
sub_response,
|
419
|
-
headers={
|
420
|
-
"Transfer-Encoding": "chunked",
|
421
|
-
"Content-Type": 'multipart/mixed; boundary="-"',
|
422
|
-
},
|
423
|
-
)
|
424
352
|
|
425
353
|
response_data = await self.process_result(request=request, result=result)
|
426
354
|
|
@@ -432,16 +360,12 @@ class AsyncBaseHTTPView(
|
|
432
360
|
)
|
433
361
|
|
434
362
|
def encode_multipart_data(self, data: Any, separator: str) -> str:
|
435
|
-
encoded_data = self.encode_json(data)
|
436
|
-
|
437
363
|
return "".join(
|
438
364
|
[
|
439
|
-
"\r\n",
|
440
|
-
"Content-Type: application/json
|
441
|
-
|
442
|
-
"\
|
443
|
-
encoded_data,
|
444
|
-
f"\r\n--{separator}",
|
365
|
+
f"\r\n--{separator}\r\n",
|
366
|
+
"Content-Type: application/json\r\n\r\n",
|
367
|
+
self.encode_json(data),
|
368
|
+
"\n",
|
445
369
|
]
|
446
370
|
)
|
447
371
|
|
strawberry/parent.py
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
-
|
1
|
+
import re
|
2
|
+
from typing import Annotated, Any, ForwardRef, TypeVar
|
3
|
+
|
4
|
+
_parent_re = re.compile(r"^(?:strawberry\.)?Parent\[(.*)\]$")
|
2
5
|
|
3
6
|
|
4
7
|
class StrawberryParent: ...
|
@@ -40,4 +43,20 @@ class Query:
|
|
40
43
|
```
|
41
44
|
"""
|
42
45
|
|
43
|
-
|
46
|
+
|
47
|
+
def resolve_parent_forward_arg(annotation: Any) -> Any:
|
48
|
+
if isinstance(annotation, str):
|
49
|
+
str_annotation = annotation
|
50
|
+
elif isinstance(annotation, ForwardRef):
|
51
|
+
str_annotation = annotation.__forward_arg__
|
52
|
+
else:
|
53
|
+
# If neither, return the annotation as is
|
54
|
+
return annotation
|
55
|
+
|
56
|
+
if parent_match := _parent_re.match(str_annotation):
|
57
|
+
annotation = Parent[ForwardRef(parent_match.group(1))] # type: ignore[misc]
|
58
|
+
|
59
|
+
return annotation
|
60
|
+
|
61
|
+
|
62
|
+
__all__ = ["Parent", "StrawberryParent", "resolve_parent_forward_arg"]
|
strawberry/printer/printer.py
CHANGED
@@ -561,9 +561,9 @@ def print_schema_definition(
|
|
561
561
|
def print_directive(
|
562
562
|
directive: GraphQLDirective, *, schema: BaseSchema
|
563
563
|
) -> Optional[str]:
|
564
|
-
strawberry_directive = directive.extensions
|
564
|
+
strawberry_directive = directive.extensions["strawberry-definition"]
|
565
565
|
|
566
|
-
if
|
566
|
+
if (
|
567
567
|
isinstance(strawberry_directive, StrawberrySchemaDirective)
|
568
568
|
and not strawberry_directive.print_definition
|
569
569
|
):
|
@@ -621,14 +621,6 @@ def print_schema(schema: BaseSchema) -> str:
|
|
621
621
|
if (printed_directive := print_directive(directive, schema=schema)) is not None
|
622
622
|
]
|
623
623
|
|
624
|
-
if schema.config.enable_experimental_incremental_execution:
|
625
|
-
directives.append(
|
626
|
-
"directive @defer(if: Boolean, label: String) on FRAGMENT_SPREAD | INLINE_FRAGMENT"
|
627
|
-
)
|
628
|
-
directives.append(
|
629
|
-
"directive @stream(if: Boolean, label: String, initialCount: Int = 0) on FIELD"
|
630
|
-
)
|
631
|
-
|
632
624
|
def _name_getter(type_: Any) -> str:
|
633
625
|
if hasattr(type_, "name"):
|
634
626
|
return type_.name
|
strawberry/scalars.py
CHANGED
@@ -6,6 +6,8 @@ from typing import TYPE_CHECKING, Any, NewType, Union
|
|
6
6
|
from strawberry.types.scalar import scalar
|
7
7
|
|
8
8
|
if TYPE_CHECKING:
|
9
|
+
from collections.abc import Mapping
|
10
|
+
|
9
11
|
from strawberry.types.scalar import ScalarDefinition, ScalarWrapper
|
10
12
|
|
11
13
|
|
@@ -57,7 +59,7 @@ Base64 = scalar(
|
|
57
59
|
|
58
60
|
def is_scalar(
|
59
61
|
annotation: Any,
|
60
|
-
scalar_registry:
|
62
|
+
scalar_registry: Mapping[object, Union[ScalarWrapper, ScalarDefinition]],
|
61
63
|
) -> bool:
|
62
64
|
if annotation in scalar_registry:
|
63
65
|
return True
|
strawberry/schema/compat.py
CHANGED
@@ -10,6 +10,7 @@ from strawberry.types.base import StrawberryType, has_object_definition
|
|
10
10
|
# TYPE_CHECKING is enabled.
|
11
11
|
|
12
12
|
if TYPE_CHECKING:
|
13
|
+
from collections.abc import Mapping
|
13
14
|
from typing_extensions import TypeGuard
|
14
15
|
|
15
16
|
from strawberry.types.scalar import ScalarDefinition, ScalarWrapper
|
@@ -29,7 +30,7 @@ def is_interface_type(type_: Union[StrawberryType, type]) -> TypeGuard[type]:
|
|
29
30
|
|
30
31
|
def is_scalar(
|
31
32
|
type_: Union[StrawberryType, type],
|
32
|
-
scalar_registry:
|
33
|
+
scalar_registry: Mapping[object, Union[ScalarWrapper, ScalarDefinition]],
|
33
34
|
) -> TypeGuard[type]:
|
34
35
|
return is_strawberry_scalar(type_, scalar_registry)
|
35
36
|
|
strawberry/schema/config.py
CHANGED
@@ -14,9 +14,9 @@ class StrawberryConfig:
|
|
14
14
|
name_converter: NameConverter = field(default_factory=NameConverter)
|
15
15
|
default_resolver: Callable[[Any, str], object] = getattr
|
16
16
|
relay_max_results: int = 100
|
17
|
+
relay_use_legacy_global_id: bool = False
|
17
18
|
disable_field_suggestions: bool = False
|
18
19
|
info_class: type[Info] = Info
|
19
|
-
enable_experimental_incremental_execution: bool = False
|
20
20
|
|
21
21
|
def __post_init__(
|
22
22
|
self,
|
strawberry/schema/schema.py
CHANGED
@@ -29,6 +29,8 @@ from graphql import (
|
|
29
29
|
parse,
|
30
30
|
validate_schema,
|
31
31
|
)
|
32
|
+
from graphql.execution import ExecutionContext as GraphQLExecutionContext
|
33
|
+
from graphql.execution import execute, subscribe
|
32
34
|
from graphql.execution.middleware import MiddlewareManager
|
33
35
|
from graphql.type.directives import specified_directives
|
34
36
|
from graphql.validation import validate
|
@@ -44,7 +46,6 @@ from strawberry.extensions.directives import (
|
|
44
46
|
from strawberry.extensions.runner import SchemaExtensionsRunner
|
45
47
|
from strawberry.printer import print_schema
|
46
48
|
from strawberry.schema.schema_converter import GraphQLCoreConverter
|
47
|
-
from strawberry.schema.types.scalar import DEFAULT_SCALAR_REGISTRY
|
48
49
|
from strawberry.schema.validation_rules.one_of import OneOfInputValidationRule
|
49
50
|
from strawberry.types.base import (
|
50
51
|
StrawberryObjectDefinition,
|
@@ -62,21 +63,12 @@ from strawberry.utils.aio import aclosing
|
|
62
63
|
from strawberry.utils.await_maybe import await_maybe
|
63
64
|
|
64
65
|
from . import compat
|
65
|
-
from ._graphql_core import (
|
66
|
-
GraphQLExecutionContext,
|
67
|
-
GraphQLIncrementalExecutionResults,
|
68
|
-
ResultType,
|
69
|
-
execute,
|
70
|
-
experimental_execute_incrementally,
|
71
|
-
incremental_execution_directives,
|
72
|
-
subscribe,
|
73
|
-
)
|
74
66
|
from .base import BaseSchema
|
75
67
|
from .config import StrawberryConfig
|
76
68
|
from .exceptions import InvalidOperationTypeError
|
77
69
|
|
78
70
|
if TYPE_CHECKING:
|
79
|
-
from collections.abc import Iterable
|
71
|
+
from collections.abc import Iterable, Mapping
|
80
72
|
from typing_extensions import TypeAlias
|
81
73
|
|
82
74
|
from graphql import ExecutionContext as GraphQLExecutionContext
|
@@ -99,7 +91,6 @@ OriginSubscriptionResult = Union[
|
|
99
91
|
AsyncIterator[OriginalExecutionResult],
|
100
92
|
]
|
101
93
|
|
102
|
-
|
103
94
|
DEFAULT_ALLOWED_OPERATION_TYPES = {
|
104
95
|
OperationType.QUERY,
|
105
96
|
OperationType.MUTATION,
|
@@ -159,7 +150,7 @@ class Schema(BaseSchema):
|
|
159
150
|
execution_context_class: Optional[type[GraphQLExecutionContext]] = None,
|
160
151
|
config: Optional[StrawberryConfig] = None,
|
161
152
|
scalar_overrides: Optional[
|
162
|
-
|
153
|
+
Mapping[object, Union[type, ScalarWrapper, ScalarDefinition]],
|
163
154
|
] = None,
|
164
155
|
schema_directives: Iterable[object] = (),
|
165
156
|
) -> None:
|
@@ -207,18 +198,12 @@ class Schema(BaseSchema):
|
|
207
198
|
self.execution_context_class = execution_context_class
|
208
199
|
self.config = config or StrawberryConfig()
|
209
200
|
|
210
|
-
SCALAR_OVERRIDES_DICT_TYPE = dict[
|
211
|
-
object, Union["ScalarWrapper", "ScalarDefinition"]
|
212
|
-
]
|
213
|
-
|
214
|
-
scalar_registry: SCALAR_OVERRIDES_DICT_TYPE = {**DEFAULT_SCALAR_REGISTRY}
|
215
|
-
if scalar_overrides:
|
216
|
-
# TODO: check that the overrides are valid
|
217
|
-
scalar_registry.update(cast("SCALAR_OVERRIDES_DICT_TYPE", scalar_overrides))
|
218
|
-
|
219
201
|
self.schema_converter = GraphQLCoreConverter(
|
220
|
-
self.config,
|
202
|
+
self.config,
|
203
|
+
scalar_overrides=scalar_overrides or {}, # type: ignore
|
204
|
+
get_fields=self.get_fields,
|
221
205
|
)
|
206
|
+
|
222
207
|
self.directives = directives
|
223
208
|
self.schema_directives = list(schema_directives)
|
224
209
|
|
@@ -270,16 +255,11 @@ class Schema(BaseSchema):
|
|
270
255
|
graphql_types.append(graphql_type)
|
271
256
|
|
272
257
|
try:
|
273
|
-
directives = specified_directives + tuple(graphql_directives)
|
274
|
-
|
275
|
-
if self.config.enable_experimental_incremental_execution:
|
276
|
-
directives = tuple(directives) + tuple(incremental_execution_directives)
|
277
|
-
|
278
258
|
self._schema = GraphQLSchema(
|
279
259
|
query=query_type,
|
280
260
|
mutation=mutation_type,
|
281
261
|
subscription=subscription_type if subscription else None,
|
282
|
-
directives=
|
262
|
+
directives=specified_directives + tuple(graphql_directives),
|
283
263
|
types=graphql_types,
|
284
264
|
extensions={
|
285
265
|
GraphQLCoreConverter.DEFINITION_BACKREF: self,
|
@@ -457,16 +437,12 @@ class Schema(BaseSchema):
|
|
457
437
|
async def _handle_execution_result(
|
458
438
|
self,
|
459
439
|
context: ExecutionContext,
|
460
|
-
result:
|
440
|
+
result: Union[GraphQLExecutionResult, ExecutionResult],
|
461
441
|
extensions_runner: SchemaExtensionsRunner,
|
462
442
|
*,
|
463
443
|
# TODO: can we remove this somehow, see comment in execute
|
464
444
|
skip_process_errors: bool = False,
|
465
445
|
) -> ExecutionResult:
|
466
|
-
# TODO: handle this, also, why do we have both GraphQLExecutionResult and ExecutionResult?
|
467
|
-
if isinstance(result, GraphQLIncrementalExecutionResults):
|
468
|
-
return result
|
469
|
-
|
470
446
|
# Set errors on the context so that it's easier
|
471
447
|
# to access in extensions
|
472
448
|
if result.errors:
|
@@ -507,17 +483,6 @@ class Schema(BaseSchema):
|
|
507
483
|
extensions_runner = self.create_extensions_runner(execution_context, extensions)
|
508
484
|
middleware_manager = self._get_middleware_manager(extensions)
|
509
485
|
|
510
|
-
execute_function = execute
|
511
|
-
|
512
|
-
if self.config.enable_experimental_incremental_execution:
|
513
|
-
execute_function = experimental_execute_incrementally
|
514
|
-
|
515
|
-
if execute_function is None:
|
516
|
-
raise RuntimeError(
|
517
|
-
"Incremental execution is enabled but experimental_execute_incrementally is not available, "
|
518
|
-
"please install graphql-core>=3.3.0"
|
519
|
-
)
|
520
|
-
|
521
486
|
try:
|
522
487
|
async with extensions_runner.operation():
|
523
488
|
# Note: In graphql-core the schema would be validated here but in
|
@@ -536,7 +501,7 @@ class Schema(BaseSchema):
|
|
536
501
|
async with extensions_runner.executing():
|
537
502
|
if not execution_context.result:
|
538
503
|
result = await await_maybe(
|
539
|
-
|
504
|
+
execute(
|
540
505
|
self._schema,
|
541
506
|
execution_context.graphql_document,
|
542
507
|
root_value=execution_context.root_value,
|
@@ -552,9 +517,7 @@ class Schema(BaseSchema):
|
|
552
517
|
result = execution_context.result
|
553
518
|
# Also set errors on the execution_context so that it's easier
|
554
519
|
# to access in extensions
|
555
|
-
|
556
|
-
# TODO: maybe here use the first result from incremental execution if it exists
|
557
|
-
if isinstance(result, GraphQLExecutionResult) and result.errors:
|
520
|
+
if result.errors:
|
558
521
|
execution_context.errors = result.errors
|
559
522
|
|
560
523
|
# Run the `Schema.process_errors` function here before
|
@@ -604,16 +567,6 @@ class Schema(BaseSchema):
|
|
604
567
|
extensions_runner = self.create_extensions_runner(execution_context, extensions)
|
605
568
|
middleware_manager = self._get_middleware_manager(extensions)
|
606
569
|
|
607
|
-
execute_function = execute
|
608
|
-
|
609
|
-
if self.config.enable_experimental_incremental_execution:
|
610
|
-
execute_function = experimental_execute_incrementally
|
611
|
-
|
612
|
-
if execute_function is None:
|
613
|
-
raise RuntimeError(
|
614
|
-
"Incremental execution is enabled but experimental_execute_incrementally is not available, "
|
615
|
-
"please install graphql-core>=3.3.0"
|
616
|
-
)
|
617
570
|
try:
|
618
571
|
with extensions_runner.operation():
|
619
572
|
# Note: In graphql-core the schema would be validated here but in
|
@@ -655,7 +608,7 @@ class Schema(BaseSchema):
|
|
655
608
|
|
656
609
|
with extensions_runner.executing():
|
657
610
|
if not execution_context.result:
|
658
|
-
result =
|
611
|
+
result = execute(
|
659
612
|
self._schema,
|
660
613
|
execution_context.graphql_document,
|
661
614
|
root_value=execution_context.root_value,
|
@@ -23,6 +23,7 @@ from graphql import (
|
|
23
23
|
GraphQLEnumValue,
|
24
24
|
GraphQLError,
|
25
25
|
GraphQLField,
|
26
|
+
GraphQLID,
|
26
27
|
GraphQLInputField,
|
27
28
|
GraphQLInputObjectType,
|
28
29
|
GraphQLInterfaceType,
|
@@ -30,6 +31,7 @@ from graphql import (
|
|
30
31
|
GraphQLNamedType,
|
31
32
|
GraphQLNonNull,
|
32
33
|
GraphQLObjectType,
|
34
|
+
GraphQLScalarType,
|
33
35
|
GraphQLType,
|
34
36
|
GraphQLUnionType,
|
35
37
|
Undefined,
|
@@ -48,7 +50,12 @@ from strawberry.exceptions import (
|
|
48
50
|
UnresolvedFieldTypeError,
|
49
51
|
)
|
50
52
|
from strawberry.extensions.field_extension import build_field_extension_resolvers
|
51
|
-
from strawberry.
|
53
|
+
from strawberry.relay.types import GlobalID
|
54
|
+
from strawberry.schema.types.scalar import (
|
55
|
+
DEFAULT_SCALAR_REGISTRY,
|
56
|
+
_get_scalar_definition,
|
57
|
+
_make_scalar_type,
|
58
|
+
)
|
52
59
|
from strawberry.types.arguments import StrawberryArgument, convert_arguments
|
53
60
|
from strawberry.types.base import (
|
54
61
|
StrawberryList,
|
@@ -64,7 +71,7 @@ from strawberry.types.enum import EnumDefinition
|
|
64
71
|
from strawberry.types.field import UNRESOLVED
|
65
72
|
from strawberry.types.lazy_type import LazyType
|
66
73
|
from strawberry.types.private import is_private
|
67
|
-
from strawberry.types.scalar import ScalarWrapper
|
74
|
+
from strawberry.types.scalar import ScalarWrapper, scalar
|
68
75
|
from strawberry.types.union import StrawberryUnion
|
69
76
|
from strawberry.types.unset import UNSET
|
70
77
|
from strawberry.utils.await_maybe import await_maybe
|
@@ -73,14 +80,13 @@ from . import compat
|
|
73
80
|
from .types.concrete_type import ConcreteType
|
74
81
|
|
75
82
|
if TYPE_CHECKING:
|
76
|
-
from collections.abc import Awaitable
|
83
|
+
from collections.abc import Awaitable, Mapping
|
77
84
|
|
78
85
|
from graphql import (
|
79
86
|
GraphQLInputType,
|
80
87
|
GraphQLNullableType,
|
81
88
|
GraphQLOutputType,
|
82
89
|
GraphQLResolveInfo,
|
83
|
-
GraphQLScalarType,
|
84
90
|
)
|
85
91
|
|
86
92
|
from strawberry.directive import StrawberryDirective
|
@@ -186,7 +192,7 @@ def get_arguments(
|
|
186
192
|
info: Info,
|
187
193
|
kwargs: Any,
|
188
194
|
config: StrawberryConfig,
|
189
|
-
scalar_registry:
|
195
|
+
scalar_registry: Mapping[object, Union[ScalarWrapper, ScalarDefinition]],
|
190
196
|
) -> tuple[list[Any], dict[str, Any]]:
|
191
197
|
# TODO: An extension might have changed the resolver arguments,
|
192
198
|
# but we need them here since we are calling it.
|
@@ -243,14 +249,42 @@ class GraphQLCoreConverter:
|
|
243
249
|
def __init__(
|
244
250
|
self,
|
245
251
|
config: StrawberryConfig,
|
246
|
-
|
252
|
+
scalar_overrides: Mapping[object, Union[ScalarWrapper, ScalarDefinition]],
|
247
253
|
get_fields: Callable[[StrawberryObjectDefinition], list[StrawberryField]],
|
248
254
|
) -> None:
|
249
255
|
self.type_map: dict[str, ConcreteType] = {}
|
250
256
|
self.config = config
|
251
|
-
self.scalar_registry =
|
257
|
+
self.scalar_registry = self._get_scalar_registry(scalar_overrides)
|
252
258
|
self.get_fields = get_fields
|
253
259
|
|
260
|
+
def _get_scalar_registry(
|
261
|
+
self,
|
262
|
+
scalar_overrides: Mapping[object, Union[ScalarWrapper, ScalarDefinition]],
|
263
|
+
) -> Mapping[object, Union[ScalarWrapper, ScalarDefinition]]:
|
264
|
+
scalar_registry = {**DEFAULT_SCALAR_REGISTRY}
|
265
|
+
|
266
|
+
global_id_name = "GlobalID" if self.config.relay_use_legacy_global_id else "ID"
|
267
|
+
|
268
|
+
scalar_registry[GlobalID] = _get_scalar_definition(
|
269
|
+
scalar(
|
270
|
+
GlobalID,
|
271
|
+
name=global_id_name,
|
272
|
+
description=GraphQLID.description,
|
273
|
+
parse_literal=lambda v, vars=None: GlobalID.from_id( # noqa: A006
|
274
|
+
GraphQLID.parse_literal(v, vars)
|
275
|
+
),
|
276
|
+
parse_value=GlobalID.from_id,
|
277
|
+
serialize=str,
|
278
|
+
specified_by_url=("https://relay.dev/graphql/objectidentification.htm"),
|
279
|
+
)
|
280
|
+
)
|
281
|
+
|
282
|
+
if scalar_overrides:
|
283
|
+
# TODO: check that the overrides are valid
|
284
|
+
scalar_registry.update(scalar_overrides) # type: ignore
|
285
|
+
|
286
|
+
return scalar_registry
|
287
|
+
|
254
288
|
def from_argument(self, argument: StrawberryArgument) -> GraphQLArgument:
|
255
289
|
argument_type = cast(
|
256
290
|
"GraphQLInputType", self.from_maybe_optional(argument.type)
|
@@ -783,13 +817,21 @@ class GraphQLCoreConverter:
|
|
783
817
|
|
784
818
|
scalar_name = self.config.name_converter.from_type(scalar_definition)
|
785
819
|
|
820
|
+
from strawberry.relay import GlobalID
|
821
|
+
|
786
822
|
if scalar_name not in self.type_map:
|
823
|
+
if scalar is GlobalID and hasattr(GraphQLNamedType, "reserved_types"):
|
824
|
+
GraphQLNamedType.reserved_types.pop("ID")
|
825
|
+
|
787
826
|
implementation = (
|
788
827
|
scalar_definition.implementation
|
789
828
|
if scalar_definition.implementation is not None
|
790
829
|
else _make_scalar_type(scalar_definition)
|
791
830
|
)
|
792
831
|
|
832
|
+
if scalar is GlobalID and hasattr(GraphQLNamedType, "reserved_types"):
|
833
|
+
GraphQLNamedType.reserved_types["ID"] = implementation
|
834
|
+
|
793
835
|
self.type_map[scalar_name] = ConcreteType(
|
794
836
|
definition=scalar_definition, implementation=implementation
|
795
837
|
)
|
@@ -799,7 +841,17 @@ class GraphQLCoreConverter:
|
|
799
841
|
# TODO: the other definition might not be a scalar, we should
|
800
842
|
# handle this case better, since right now we assume it is a scalar
|
801
843
|
|
802
|
-
|
844
|
+
# special case to allow GlobalID to be used as an ID scalar
|
845
|
+
# TODO: we need to find a better way to handle this, might be
|
846
|
+
# worth reworking our scalar implementation.
|
847
|
+
if (
|
848
|
+
hasattr(other_definition, "origin")
|
849
|
+
and hasattr(scalar_definition, "origin")
|
850
|
+
and other_definition.origin == GlobalID
|
851
|
+
and scalar_definition.origin == GraphQLID
|
852
|
+
):
|
853
|
+
pass
|
854
|
+
elif other_definition != scalar_definition:
|
803
855
|
other_definition = cast("ScalarDefinition", other_definition)
|
804
856
|
|
805
857
|
raise ScalarAlreadyRegisteredError(scalar_definition, other_definition)
|
@@ -12,10 +12,9 @@ from graphql import (
|
|
12
12
|
)
|
13
13
|
|
14
14
|
from strawberry.file_uploads.scalars import Upload
|
15
|
-
from strawberry.relay.types import GlobalID
|
16
15
|
from strawberry.scalars import ID
|
17
16
|
from strawberry.schema.types import base_scalars
|
18
|
-
from strawberry.types.scalar import ScalarDefinition
|
17
|
+
from strawberry.types.scalar import ScalarDefinition
|
19
18
|
|
20
19
|
|
21
20
|
def _make_scalar_type(definition: ScalarDefinition) -> GraphQLScalarType:
|
@@ -41,6 +40,7 @@ def _make_scalar_definition(scalar_type: GraphQLScalarType) -> ScalarDefinition:
|
|
41
40
|
parse_literal=scalar_type.parse_literal,
|
42
41
|
parse_value=scalar_type.parse_value,
|
43
42
|
implementation=scalar_type,
|
43
|
+
origin=scalar_type,
|
44
44
|
)
|
45
45
|
|
46
46
|
|
@@ -62,22 +62,9 @@ DEFAULT_SCALAR_REGISTRY: dict[object, ScalarDefinition] = {
|
|
62
62
|
datetime.datetime: _get_scalar_definition(base_scalars.DateTime),
|
63
63
|
datetime.time: _get_scalar_definition(base_scalars.Time),
|
64
64
|
decimal.Decimal: _get_scalar_definition(base_scalars.Decimal),
|
65
|
-
# We can't wrap GlobalID with @scalar because it has custom attributes/methods
|
66
|
-
GlobalID: _get_scalar_definition(
|
67
|
-
scalar(
|
68
|
-
GlobalID,
|
69
|
-
name="GlobalID",
|
70
|
-
description=GraphQLID.description,
|
71
|
-
parse_literal=lambda v, vars=None: GlobalID.from_id( # noqa: A006
|
72
|
-
GraphQLID.parse_literal(v, vars)
|
73
|
-
),
|
74
|
-
parse_value=GlobalID.from_id,
|
75
|
-
serialize=str,
|
76
|
-
specified_by_url=("https://relay.dev/graphql/objectidentification.htm"),
|
77
|
-
)
|
78
|
-
),
|
79
65
|
}
|
80
66
|
|
67
|
+
|
81
68
|
__all__ = [
|
82
69
|
"DEFAULT_SCALAR_REGISTRY",
|
83
70
|
"_get_scalar_definition",
|
strawberry/static/graphiql.html
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
<!
|
1
|
+
<!DOCTYPE html>
|
2
2
|
<html>
|
3
3
|
<head>
|
4
4
|
<title>Strawberry GraphiQL</title>
|
@@ -61,8 +61,8 @@
|
|
61
61
|
<link
|
62
62
|
crossorigin
|
63
63
|
rel="stylesheet"
|
64
|
-
href="https://unpkg.com/graphiql@3.
|
65
|
-
integrity="sha384-
|
64
|
+
href="https://unpkg.com/graphiql@3.0.9/graphiql.min.css"
|
65
|
+
integrity="sha384-yz3/sqpuplkA7msMo0FE4ekg0xdwdvZ8JX9MVZREsxipqjU4h8IRfmAMRcb1QpUy"
|
66
66
|
/>
|
67
67
|
|
68
68
|
<link
|
@@ -77,8 +77,8 @@
|
|
77
77
|
<div id="graphiql" class="graphiql-container">Loading...</div>
|
78
78
|
<script
|
79
79
|
crossorigin
|
80
|
-
src="https://unpkg.com/graphiql@3.
|
81
|
-
integrity="sha384-
|
80
|
+
src="https://unpkg.com/graphiql@3.0.9/graphiql.min.js"
|
81
|
+
integrity="sha384-Mjte+vxCWz1ZYCzszGHiJqJa5eAxiqI4mc3BErq7eDXnt+UGLXSEW7+i0wmfPiji"
|
82
82
|
></script>
|
83
83
|
<script
|
84
84
|
crossorigin
|
strawberry/types/arguments.py
CHANGED
@@ -147,7 +147,7 @@ class StrawberryArgument:
|
|
147
147
|
def convert_argument(
|
148
148
|
value: object,
|
149
149
|
type_: Union[StrawberryType, type],
|
150
|
-
scalar_registry:
|
150
|
+
scalar_registry: Mapping[object, Union[ScalarWrapper, ScalarDefinition]],
|
151
151
|
config: StrawberryConfig,
|
152
152
|
) -> object:
|
153
153
|
# TODO: move this somewhere else and make it first class
|
@@ -207,7 +207,7 @@ def convert_argument(
|
|
207
207
|
def convert_arguments(
|
208
208
|
value: dict[str, Any],
|
209
209
|
arguments: list[StrawberryArgument],
|
210
|
-
scalar_registry:
|
210
|
+
scalar_registry: Mapping[object, Union[ScalarWrapper, ScalarDefinition]],
|
211
211
|
config: StrawberryConfig,
|
212
212
|
) -> dict[str, Any]:
|
213
213
|
"""Converts a nested dictionary to a dictionary of actual types.
|
@@ -25,7 +25,7 @@ from strawberry.exceptions import (
|
|
25
25
|
ConflictingArgumentsError,
|
26
26
|
MissingArgumentsAnnotationsError,
|
27
27
|
)
|
28
|
-
from strawberry.parent import StrawberryParent
|
28
|
+
from strawberry.parent import StrawberryParent, resolve_parent_forward_arg
|
29
29
|
from strawberry.types.arguments import StrawberryArgument
|
30
30
|
from strawberry.types.base import StrawberryType, has_object_definition
|
31
31
|
from strawberry.types.info import Info
|
@@ -118,10 +118,17 @@ class ReservedType(NamedTuple):
|
|
118
118
|
try:
|
119
119
|
evaled_annotation = annotation.evaluate()
|
120
120
|
except NameError:
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
121
|
+
# If this is a strawberry.Parent using ForwardRef, we will fail to
|
122
|
+
# evaluate at this moment, but at least knowing that it is a reserved
|
123
|
+
# type is enough for now
|
124
|
+
# We might want to revisit this in the future, maybe by postponing
|
125
|
+
# this check to when the schema is actually being created
|
126
|
+
evaled_annotation = resolve_parent_forward_arg(
|
127
|
+
annotation.annotation
|
128
|
+
)
|
129
|
+
|
130
|
+
if self.is_reserved_type(evaled_annotation):
|
131
|
+
type_parameters.append(parameter)
|
125
132
|
|
126
133
|
if len(type_parameters) > 1:
|
127
134
|
raise ConflictingArgumentsError(
|
strawberry/types/scalar.py
CHANGED
@@ -43,6 +43,7 @@ class ScalarDefinition(StrawberryType):
|
|
43
43
|
parse_value: Optional[Callable]
|
44
44
|
parse_literal: Optional[Callable]
|
45
45
|
directives: Iterable[object] = ()
|
46
|
+
origin: Optional[GraphQLScalarType | type] = None
|
46
47
|
|
47
48
|
# Optionally store the GraphQLScalarType instance so that we don't get
|
48
49
|
# duplicates
|
@@ -115,6 +116,7 @@ def _process_scalar(
|
|
115
116
|
parse_literal=parse_literal,
|
116
117
|
parse_value=parse_value,
|
117
118
|
directives=directives,
|
119
|
+
origin=cls, # type: ignore[arg-type]
|
118
120
|
_source_file=_source_file,
|
119
121
|
_source_line=_source_line,
|
120
122
|
)
|
strawberry/utils/typing.py
CHANGED
@@ -304,11 +304,13 @@ def eval_type(
|
|
304
304
|
localns: Optional[dict] = None,
|
305
305
|
) -> type:
|
306
306
|
"""Evaluates a type, resolving forward references."""
|
307
|
+
from strawberry.parent import StrawberryParent
|
307
308
|
from strawberry.types.auto import StrawberryAuto
|
308
309
|
from strawberry.types.lazy_type import StrawberryLazyReference
|
309
310
|
from strawberry.types.private import StrawberryPrivate
|
310
311
|
|
311
312
|
globalns = globalns or {}
|
313
|
+
|
312
314
|
# If this is not a string, maybe its args are (e.g. list["Foo"])
|
313
315
|
if isinstance(type_, ForwardRef):
|
314
316
|
ast_obj = cast("ast.Expr", ast.parse(type_.__forward_arg__).body[0])
|
@@ -355,6 +357,7 @@ def eval_type(
|
|
355
357
|
)
|
356
358
|
args = (type_arg, *remaining_args)
|
357
359
|
break
|
360
|
+
|
358
361
|
if isinstance(arg, StrawberryAuto):
|
359
362
|
remaining_args = [
|
360
363
|
a for a in args[1:] if not isinstance(a, StrawberryAuto)
|
@@ -362,6 +365,21 @@ def eval_type(
|
|
362
365
|
args = (args[0], arg, *remaining_args)
|
363
366
|
break
|
364
367
|
|
368
|
+
if isinstance(arg, StrawberryParent):
|
369
|
+
remaining_args = [
|
370
|
+
a for a in args[1:] if not isinstance(a, StrawberryParent)
|
371
|
+
]
|
372
|
+
try:
|
373
|
+
type_arg = (
|
374
|
+
eval_type(args[0], globalns, localns)
|
375
|
+
if isinstance(args[0], ForwardRef)
|
376
|
+
else args[0]
|
377
|
+
)
|
378
|
+
except (NameError, TypeError):
|
379
|
+
type_arg = args[0]
|
380
|
+
args = (type_arg, arg, *remaining_args)
|
381
|
+
break
|
382
|
+
|
365
383
|
# If we have only a StrawberryLazyReference and no more annotations,
|
366
384
|
# we need to return the argument directly because Annotated
|
367
385
|
# will raise an error if trying to instantiate it with only
|
{strawberry_graphql-0.267.0.dev1746643548.dist-info → strawberry_graphql-0.268.1.dist-info}/RECORD
RENAMED
@@ -1,10 +1,10 @@
|
|
1
|
-
strawberry/__init__.py,sha256
|
1
|
+
strawberry/__init__.py,sha256=-K---AYIgHvBVYF_9oovgEPNBbymXH673bntlV9sOeU,1491
|
2
2
|
strawberry/__main__.py,sha256=3U77Eu21mJ-LY27RG-JEnpbh6Z63wGOom4i-EoLtUcY,59
|
3
3
|
strawberry/aiohttp/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
4
|
strawberry/aiohttp/test/__init__.py,sha256=4xxdUZtIISSOwjrcnmox7AvT4WWjowCm5bUuPdQneMg,71
|
5
5
|
strawberry/aiohttp/test/client.py,sha256=8FKZTnvawxYpgEICOri-34O3wHRHLhRpjH_Ktp2EupQ,1801
|
6
6
|
strawberry/aiohttp/views.py,sha256=AQVBbZTBa127TbQRwoBelTHrVdZnJeGdMYcTfNmoaSc,7887
|
7
|
-
strawberry/annotation.py,sha256=
|
7
|
+
strawberry/annotation.py,sha256=iqSXtJ4pTTLDZRPyil0f-yzpcCm8UYRiwvFWkD5LgpQ,13498
|
8
8
|
strawberry/asgi/__init__.py,sha256=psdKl_52LGkxKKbzZlmwNGZ9jz2FLyLSC7fUhys4FqY,8169
|
9
9
|
strawberry/asgi/test/__init__.py,sha256=4xxdUZtIISSOwjrcnmox7AvT4WWjowCm5bUuPdQneMg,71
|
10
10
|
strawberry/asgi/test/client.py,sha256=kp2O5znHWuAB5VVYO8p4XPSTEDDXBSjNz5WHqW0r6GM,1473
|
@@ -130,8 +130,8 @@ strawberry/file_uploads/scalars.py,sha256=NRDeB7j8aotqIkz9r62ISTf4DrxQxEZYUuHsX5
|
|
130
130
|
strawberry/file_uploads/utils.py,sha256=-c6TbqUI-Dkb96hWCrZabh6TL2OabBuQNkCarOqgDm4,1181
|
131
131
|
strawberry/flask/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
132
132
|
strawberry/flask/views.py,sha256=MCvAsNgTZLU8RvTYKWfnLU2w7Wv1ZZpxW9W3TyTZuPY,6355
|
133
|
-
strawberry/http/__init__.py,sha256=
|
134
|
-
strawberry/http/async_base_view.py,sha256=
|
133
|
+
strawberry/http/__init__.py,sha256=BV_JpUwNongW38UzFstM72hDXNUjSxdJm_M96pDFU1c,1122
|
134
|
+
strawberry/http/async_base_view.py,sha256=9micSD_KpoB8oBHAPlcTpt44bVABDYScvyfHa3NP4rE,16352
|
135
135
|
strawberry/http/base.py,sha256=Lz-u5SWg2uQp3l5GMKZDPQuJOR42LXHgjV1PZHwiapE,2373
|
136
136
|
strawberry/http/exceptions.py,sha256=9E2dreS1crRoJVUEPuHyx23NcDELDHNzkAOa-rGv-8I,348
|
137
137
|
strawberry/http/ides.py,sha256=WjU0nsMDgr3Bd1ebWkUEkO2d1hk0dI16mLqXyCHqklA,613
|
@@ -142,11 +142,11 @@ strawberry/http/types.py,sha256=H0wGOdCO-5tNKZM_6cAtNRwZAjoEXnAC5N0Q7b70AtU,398
|
|
142
142
|
strawberry/http/typevars.py,sha256=Uu6NkKe3h7o29ZWwldq6sJy4ioSSeXODTCDRvY2hUpE,489
|
143
143
|
strawberry/litestar/__init__.py,sha256=zsXzg-mglCGUVO9iNXLm-yadoDSCK7k-zuyRqyvAh1w,237
|
144
144
|
strawberry/litestar/controller.py,sha256=DSbjl7QGCY_TX77EomqDvtH8-ZK6wfhL81IUEFa-JJs,14124
|
145
|
-
strawberry/parent.py,sha256=
|
145
|
+
strawberry/parent.py,sha256=JYFp-HGCgwbH2oB4uLSiIO4cVsoPaxX6lfYmxOKPkSg,1362
|
146
146
|
strawberry/permission.py,sha256=dSRJMjSCmTlXfvfC24kCSrAk0txTjYKTJ5ZVU5IW91Y,7537
|
147
147
|
strawberry/printer/__init__.py,sha256=DmepjmgtkdF5RxK_7yC6qUyRWn56U-9qeZMbkztYB9w,62
|
148
148
|
strawberry/printer/ast_from_value.py,sha256=Tkme60qlykbN2m3dNPNMOe65X-wj6EmcDQwgQv7gUkc,4987
|
149
|
-
strawberry/printer/printer.py,sha256=
|
149
|
+
strawberry/printer/printer.py,sha256=49u3QwttTGvh13HXZtbTnkZzBwL1k5SLf8rXQLiTpl4,18814
|
150
150
|
strawberry/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
151
151
|
strawberry/quart/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
152
152
|
strawberry/quart/views.py,sha256=Hjm93A9j9fy--DQVhsPQ_PakqYtajyWeuH7wUnSLYoA,4449
|
@@ -160,29 +160,27 @@ strawberry/sanic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,
|
|
160
160
|
strawberry/sanic/context.py,sha256=qN7I9K_qIqgdbG_FbDl8XMb9aM1PyjIxSo8IAg2Uq8o,844
|
161
161
|
strawberry/sanic/utils.py,sha256=XjUVBFuBWfECBCZbx_YtrjQnFTUyIGTo7aISIeB22Gc,1007
|
162
162
|
strawberry/sanic/views.py,sha256=F5ZrKt-R3135evKLfhQuPd1isOexI0Lrzevm_6Te4Eg,7069
|
163
|
-
strawberry/scalars.py,sha256=
|
163
|
+
strawberry/scalars.py,sha256=CGkG8CIfurXiYhidmW3qwy6M5BF_Mhih3wAEcWx_iBU,2278
|
164
164
|
strawberry/schema/__init__.py,sha256=u1QCyDVQExUVDA20kyosKPz3TS5HMCN2NrXclhiFAL4,92
|
165
|
-
strawberry/schema/_graphql_core.py,sha256=XHsNZLkCyiH55jANK4XJIjq6VCMhN_MgZBEFWEYj5Jc,1237
|
166
165
|
strawberry/schema/base.py,sha256=q5UAw6do4Ele5Cf8dNAouiPjNmZoCBNFqh5Vl05caCI,3864
|
167
|
-
strawberry/schema/compat.py,sha256=
|
168
|
-
strawberry/schema/config.py,sha256=
|
166
|
+
strawberry/schema/compat.py,sha256=xNpOEDfi-MODpplMGaKuKeQIVcr-tcAaKaU3TlBc1Zs,1873
|
167
|
+
strawberry/schema/config.py,sha256=KeZ1Pc1gvYK0fOx9Aghx7m0Av8sWexycl3HJGFgHPvg,969
|
169
168
|
strawberry/schema/exceptions.py,sha256=rqVNb_oYrKM0dHPgvAemqCG6Um282LPPu4zwQ5cZqs4,584
|
170
169
|
strawberry/schema/name_converter.py,sha256=xFOXEgqldFkxXRkIQvsJN1dPkWbEUaIrTYNOMYSEVwQ,6945
|
171
|
-
strawberry/schema/schema.py,sha256=
|
172
|
-
strawberry/schema/schema_converter.py,sha256=
|
170
|
+
strawberry/schema/schema.py,sha256=rDfNclXSRHqn3NNGzPAovZoVeMh0VC5wVCCUprwZJV8,34215
|
171
|
+
strawberry/schema/schema_converter.py,sha256=u12Og8eUX8SNMtJB6LYkj9zEpoQs-rDOXpN7tU8JG7k,39785
|
173
172
|
strawberry/schema/types/__init__.py,sha256=oHO3COWhL3L1KLYCJNY1XFf5xt2GGtHiMC-UaYbFfnA,68
|
174
173
|
strawberry/schema/types/base_scalars.py,sha256=JRUq0WjEkR9dFewstZnqnZKp0uOEipo4UXNF5dzRf4M,1971
|
175
174
|
strawberry/schema/types/concrete_type.py,sha256=axIyFZgdwNv-XYkiqX67464wuFX6Vp0jYATwnBZSUvM,750
|
176
|
-
strawberry/schema/types/scalar.py,sha256=
|
175
|
+
strawberry/schema/types/scalar.py,sha256=bg9AumdmYUBuvaKoEZtP9YKJ7lwMtDMCWFTsZQwpdQY,2375
|
177
176
|
strawberry/schema/validation_rules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
178
177
|
strawberry/schema/validation_rules/one_of.py,sha256=fPuYzCyLT7p9y7dHF_sWTImArTQaEhyF664lZijB1Gw,2629
|
179
178
|
strawberry/schema_codegen/__init__.py,sha256=mN4Qmu5Iakht6nHpRpt9hCs8e--oTPlVtDJZJpzgHR4,24364
|
180
179
|
strawberry/schema_directive.py,sha256=CbjdX54EIeWGkJu4SgiLR8mph5_8wyNsgJk2oLoQK_0,2023
|
181
180
|
strawberry/schema_directives.py,sha256=KGKFWCODjm1Ah9qNV_bBwbic7Mld4qLWnWQkev-PG8A,175
|
182
181
|
strawberry/static/apollo-sandbox.html,sha256=2XzkbE0dqsFHqehE-jul9_J9TFOpwA6Ylrlo0Kdx_9w,973
|
183
|
-
strawberry/static/graphiql.html,sha256=
|
182
|
+
strawberry/static/graphiql.html,sha256=BkiqZlC63f1sHBDs_UpMzcibcNrHKh7K41Sp23yttfo,4257
|
184
183
|
strawberry/static/pathfinder.html,sha256=0DPx9AmJ2C_sJstFXnWOz9k5tVQHeHaK7qdVY4lAlmk,1547
|
185
|
-
strawberry/streamable.py,sha256=ylfMt5lfX7RRKGi86wWokvIgYQk5jZCvQVc3shK0epk,645
|
186
184
|
strawberry/subscriptions/__init__.py,sha256=1VGmiCzFepqRFyCikagkUoHHdoTG3XYlFu9GafoQMws,170
|
187
185
|
strawberry/subscriptions/protocols/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
188
186
|
strawberry/subscriptions/protocols/graphql_transport_ws/__init__.py,sha256=wN6dkMu6WiaIZTE19PGoN9xXpIN_RdDE_q7F7ZgjCxk,138
|
@@ -197,7 +195,7 @@ strawberry/tools/__init__.py,sha256=pdGpZx8wpq03VfUZJyF9JtYxZhGqzzxCiipsalWxJX4,
|
|
197
195
|
strawberry/tools/create_type.py,sha256=--DgfZOmXJBKGcVxehNISyvpw1HzwFvRtUUPc0634MA,2056
|
198
196
|
strawberry/tools/merge_types.py,sha256=hUMRRNM28FyPp70jRA3d4svv9WoEBjaNpihBt3DaY0I,1023
|
199
197
|
strawberry/types/__init__.py,sha256=baWEdDkkmCcITOhkg2hNUOenrNV1OYdxGE5qgvIRwwU,351
|
200
|
-
strawberry/types/arguments.py,sha256=
|
198
|
+
strawberry/types/arguments.py,sha256=Ut4H60a7SRuPtCUAa6gS6gJigaNqhCSesCPoeb0xDYE,9706
|
201
199
|
strawberry/types/auto.py,sha256=WZ2cQAI8nREUigBzpzFqIKGjJ_C2VqpAPNe8vPjTciM,3007
|
202
200
|
strawberry/types/base.py,sha256=tZSqxtrxXa1Y964HS2uakCbCgLyGO9A4WpODiegWzF8,15122
|
203
201
|
strawberry/types/cast.py,sha256=fx86MkLW77GIximBAwUk5vZxSGwDqUA6XicXvz8EXwQ,916
|
@@ -205,7 +203,7 @@ strawberry/types/enum.py,sha256=IcCz0FLswJtDC_bU8aG1cjreawcqHywAzzVRBZUSAqs,6229
|
|
205
203
|
strawberry/types/execution.py,sha256=Ylc0lH0nyHyQW509mVqBh2sIN5qpf4cJtt8QhVmWGgI,3749
|
206
204
|
strawberry/types/field.py,sha256=vxb7JvkHfRmDCYsjhDmVnO2lMbtSOteQm3jQUeSFu6g,21605
|
207
205
|
strawberry/types/fields/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
208
|
-
strawberry/types/fields/resolver.py,sha256=
|
206
|
+
strawberry/types/fields/resolver.py,sha256=b6lxfw6AMOUFWm7vs7a9KzNkpR8b_S110DoIosrrWDQ,14679
|
209
207
|
strawberry/types/graphql.py,sha256=gXKzawwKiow7hvoJhq5ApNJOMUCnKmvTiHaKY5CK1Lw,867
|
210
208
|
strawberry/types/info.py,sha256=bPP7XTQQScmskJcmVv36iqLAWpdGmF2nhYjI1pJ-csI,4709
|
211
209
|
strawberry/types/lazy_type.py,sha256=dlP9VcMjZc9sdgriiQGzOZa0TToB6Ee7zpIP8h7TLC0,5079
|
@@ -214,7 +212,7 @@ strawberry/types/mutation.py,sha256=cg-_O2WWnZ-GSwOIv0toSdxlGeY2lhBBxZ24AifJuSM,
|
|
214
212
|
strawberry/types/nodes.py,sha256=RwZB43OT9BS3Cqjgq4AazqOfyq_y0GD2ysC86EDBv5U,5134
|
215
213
|
strawberry/types/object_type.py,sha256=SZOzxaS318079G-pr-1PM5iMoTddxdw8KD4cI67IhzI,15579
|
216
214
|
strawberry/types/private.py,sha256=DhJs50XVGtOXlxWZFkRpMxQ5_6oki0-x_WQsV1bGUxk,518
|
217
|
-
strawberry/types/scalar.py,sha256=
|
215
|
+
strawberry/types/scalar.py,sha256=vUWGwAYgcfY26jQUdBJ1tGOvrBq92V0p9L8AWXM7bkk,6384
|
218
216
|
strawberry/types/type_resolver.py,sha256=fH2ZOK4dAGgu8AMPi-JAXe_kEAbvvw2MCYXqbpx-kTc,6529
|
219
217
|
strawberry/types/union.py,sha256=rwZoJcMdUxJBlYMwx3ONByv6BylhvXT0Bflem6xzMM4,10090
|
220
218
|
strawberry/types/unset.py,sha256=7DVK-WWxVLo41agvavTvIbphE42BmY8UpGolXfasIvw,1682
|
@@ -230,9 +228,9 @@ strawberry/utils/inspect.py,sha256=-aFT65PkQ9KXo5w8Q2uveBJ8jEpi40sTqRipRQVdYR8,3
|
|
230
228
|
strawberry/utils/logging.py,sha256=U1cseHGquN09YFhFmRkiphfASKCyK0HUZREImPgVb0c,746
|
231
229
|
strawberry/utils/operation.py,sha256=s7ajvLg_q6v2mg47kEMQPjO_J-XluMKTCwo4d47mGvE,1195
|
232
230
|
strawberry/utils/str_converters.py,sha256=-eH1Cl16IO_wrBlsGM-km4IY0IKsjhjnSNGRGOwQjVM,897
|
233
|
-
strawberry/utils/typing.py,sha256=
|
234
|
-
strawberry_graphql-0.
|
235
|
-
strawberry_graphql-0.
|
236
|
-
strawberry_graphql-0.
|
237
|
-
strawberry_graphql-0.
|
238
|
-
strawberry_graphql-0.
|
231
|
+
strawberry/utils/typing.py,sha256=SDvX-Du-9HAV3-XXjqi7Q5f5qPDDFd_gASIITiwBQT4,14073
|
232
|
+
strawberry_graphql-0.268.1.dist-info/LICENSE,sha256=m-XnIVUKqlG_AWnfi9NReh9JfKhYOB-gJfKE45WM1W8,1072
|
233
|
+
strawberry_graphql-0.268.1.dist-info/METADATA,sha256=0KP8VbWiBIyL4DP__ItZildr2PoqR_WjXmRoTc_9PDE,7679
|
234
|
+
strawberry_graphql-0.268.1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
235
|
+
strawberry_graphql-0.268.1.dist-info/entry_points.txt,sha256=Nk7-aT3_uEwCgyqtHESV9H6Mc31cK-VAvhnQNTzTb4k,49
|
236
|
+
strawberry_graphql-0.268.1.dist-info/RECORD,,
|
@@ -1,46 +0,0 @@
|
|
1
|
-
from typing import Union
|
2
|
-
|
3
|
-
from graphql.execution import ExecutionContext as GraphQLExecutionContext
|
4
|
-
from graphql.execution import ExecutionResult as GraphQLExecutionResult
|
5
|
-
from graphql.execution import execute, subscribe
|
6
|
-
|
7
|
-
from strawberry.types import ExecutionResult
|
8
|
-
|
9
|
-
try:
|
10
|
-
from graphql import (
|
11
|
-
ExperimentalIncrementalExecutionResults as GraphQLIncrementalExecutionResults,
|
12
|
-
)
|
13
|
-
from graphql.execution import experimental_execute_incrementally
|
14
|
-
from graphql.type.directives import (
|
15
|
-
GraphQLDeferDirective,
|
16
|
-
GraphQLStreamDirective,
|
17
|
-
)
|
18
|
-
|
19
|
-
incremental_execution_directives = (
|
20
|
-
GraphQLDeferDirective,
|
21
|
-
GraphQLStreamDirective,
|
22
|
-
)
|
23
|
-
|
24
|
-
except ImportError:
|
25
|
-
GraphQLIncrementalExecutionResults = type(None)
|
26
|
-
|
27
|
-
incremental_execution_directives = []
|
28
|
-
experimental_execute_incrementally = None
|
29
|
-
|
30
|
-
|
31
|
-
# TODO: give this a better name, maybe also a better place
|
32
|
-
ResultType = Union[
|
33
|
-
GraphQLExecutionResult,
|
34
|
-
GraphQLIncrementalExecutionResults,
|
35
|
-
ExecutionResult,
|
36
|
-
]
|
37
|
-
|
38
|
-
__all__ = [
|
39
|
-
"GraphQLExecutionContext",
|
40
|
-
"GraphQLIncrementalExecutionResults",
|
41
|
-
"ResultType",
|
42
|
-
"execute",
|
43
|
-
"experimental_execute_incrementally",
|
44
|
-
"incremental_execution_directives",
|
45
|
-
"subscribe",
|
46
|
-
]
|
strawberry/streamable.py
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
from collections.abc import AsyncGenerator
|
2
|
-
from typing import Annotated, TypeVar
|
3
|
-
|
4
|
-
|
5
|
-
class StrawberryStreamable: ...
|
6
|
-
|
7
|
-
|
8
|
-
T = TypeVar("T")
|
9
|
-
|
10
|
-
Streamable = Annotated[AsyncGenerator[T, None], StrawberryStreamable()]
|
11
|
-
"""Represents a list that can be streamed using @stream.
|
12
|
-
|
13
|
-
Example:
|
14
|
-
|
15
|
-
```python
|
16
|
-
import strawberry
|
17
|
-
from dataclasses import dataclass
|
18
|
-
|
19
|
-
|
20
|
-
@strawberry.type
|
21
|
-
class Comment:
|
22
|
-
id: strawberry.ID
|
23
|
-
content: str
|
24
|
-
|
25
|
-
|
26
|
-
@strawberry.type
|
27
|
-
class Article:
|
28
|
-
@strawberry.field
|
29
|
-
@staticmethod
|
30
|
-
async def comments() -> strawberry.Streamable[Comment]:
|
31
|
-
for comment in fetch_comments():
|
32
|
-
yield comment
|
33
|
-
```
|
34
|
-
"""
|
35
|
-
|
36
|
-
__all__ = ["Streamable"]
|
{strawberry_graphql-0.267.0.dev1746643548.dist-info → strawberry_graphql-0.268.1.dist-info}/LICENSE
RENAMED
File without changes
|
{strawberry_graphql-0.267.0.dev1746643548.dist-info → strawberry_graphql-0.268.1.dist-info}/WHEEL
RENAMED
File without changes
|
File without changes
|