
    Cj                        S SK Jr  S SKJrJrJrJrJrJr  SSK	J
r
Jr  SSKJr  SSKJrJrJrJrJr  SSKJr  SSKJr  SS	KJrJ r   SS
KJrJr  SSKJr  SS/r       SS\S\S\S\S\\\ \4      S\\    S\\   S\\   S\!S\\\   \4   4S jjr"      SS\S\S\S\S\\\ \4      S\\    S\\   S\!S\\\   \4   4S jjr#S\S\\   4S jr$g)     )isawaitable)AnyAsyncIterableAsyncIteratorDictOptionalUnion   )GraphQLErrorlocated_error)collect_fields) assert_valid_execution_argumentsexecuteget_field_defExecutionContextExecutionResult)get_argument_values)DocumentNode)Pathinspect)GraphQLFieldResolverGraphQLSchema   )MapAsyncIterator	subscribecreate_source_event_streamNschemadocument
root_valuecontext_valuevariable_valuesoperation_namefield_resolversubscribe_field_resolvermax_coercion_errorsreturnc	           
         ^ ^^^^^#    [        T TUTTTUU5      I Sh  vN n	[        U	[        5      (       a  U	$ S[        S[        4UUUUU U4S jjn
[	        X5      $  N?7f)a4  Create a GraphQL subscription.

Implements the "Subscribe" algorithm described in the GraphQL spec.

Returns a coroutine object which yields either an AsyncIterator (if successful) or
an ExecutionResult (client error). The coroutine will raise an exception if a server
error occurs.

If the client-provided arguments to this function do not result in a compliant
subscription, a GraphQL Response (ExecutionResult) with descriptive errors and no
data will be returned.

If the source stream could not be created due to faulty subscription resolver logic
or underlying systems, the coroutine object will yield a single ExecutionResult
containing ``errors`` and no ``data``.

If the operation succeeded, the coroutine will yield an AsyncIterator, which yields
a stream of ExecutionResults representing the response stream.
Npayloadr&   c           	      j   >#    [        TTU TTTT5      n[        U5      (       a
  UI Sh  vN $ U$  N7f)a  Map source to response.

For each payload yielded from a subscription, map it over the normal GraphQL
:func:`~graphql.execute` function, with ``payload`` as the ``root_value``.
This implements the "MapSourceToResponseEvent" algorithm described in the
GraphQL specification. The :func:`~graphql.execute` function provides the
"ExecuteSubscriptionEvent" algorithm, as it is nearly identical to the
"ExecuteQuery" algorithm, for which :func:`~graphql.execute` is also used.
N)r   r   )r(   resultr    r   r#   r"   r   r!   s     m/home/rurouni/.local/share/pipx/venvs/strix-agent/lib/python3.13/site-packages/graphql/execution/subscribe.pymap_source_to_response)subscribe.<locals>.map_source_to_responseH   sB      
  +622V|>>|s   '313)r   
isinstancer   r   r   )r   r   r   r    r!   r"   r#   r$   r%   result_or_streamr,   s   `` ````    r+   r   r      sr     < 8 	 	 "O44?c ?o ? ?, ,EEG	s   A AA A c                 d  #    [        XU5        [        R                  " U UUUUUUUS9n[        U[        5      (       a
  [        SUS9$  [        U5      I Sh  vN n	[        U	[        5      (       d  [        S[        U	5       S35      eU	$  N3! [         a  n
[        SU
/S9s Sn
A
$ Sn
A
ff = f7f)a  Create source event stream

Implements the "CreateSourceEventStream" algorithm described in the GraphQL
specification, resolving the subscription source event stream.

Returns a coroutine that yields an AsyncIterable.

If the client-provided arguments to this function do not result in a compliant
subscription, a GraphQL Response (ExecutionResult) with descriptive errors and no
data will be returned.

If the source stream could not be created due to faulty subscription resolver logic
or underlying systems, the coroutine object will yield a single ExecutionResult
containing ``errors`` and no ``data``.

A source event stream represents a sequence of events, each of which triggers a
GraphQL execution for that event.

This may be useful when hosting the stateful subscription service in a different
process or machine than the stateless GraphQL execution engine, or otherwise
separating these two steps. For more on this, see the "Supporting Subscriptions
at Scale" information in the GraphQL spec.
)r$   r%   N)dataerrorsz8Subscription field must return AsyncIterable. Received: .)r   r   buildr.   listr   execute_subscriptionr   	TypeErrorr   r   )r   r   r   r    r!   r"   r$   r%   contextevent_streamerrors              r+   r   r   a   s     F %VG $$!9/	G '4  D99:1':: ,66%l34A7   ;  :D%99:sH   AB0
B B2B B0B 
B-
B("B-#B0(B--B0r8   c                 X  #    U R                   nUR                  nUc  [        SU R                  5      e[	        UU R
                  U R                  UU R                  R                  5      n[        [        UR                  5       5      5      u  pE[        XUS   5      nU(       d)  US   R                  R                  n[        SU S3U5      e[        S XBR                  5      nU R                  XeX(5      n	 [!        XeS   U R                  5      n
UR"                  =(       d    U R$                  nU" U R&                  U	40 U
D6nU R)                  U5      (       a
  UI S h  vN n[+        U[,        5      (       a  UeU$  N! [,         a  n[/        XUR1                  5       5      eS nAff = f7f)Nz;Schema is not configured to execute subscription operation.r   zThe subscription field 'z' is not defined.)r   subscription_typer   	operationr   	fragmentsr!   selection_setnextiteritemsr   namevaluer   build_resolve_infor   r   r$   r   is_awaitabler.   	Exceptionr   as_list)r8   r   	root_typeroot_fieldsresponse_namefield_nodes	field_def
field_namepathinfoargs
resolve_fnr9   r:   s                 r+   r6   r6      s    ^^F((II
 	

 !''K "&d;+<+<+>&?!@MfQ@I ^((..
&zl2CDk
 	
 m^^4D%%iiND
@ #9!ng>U>UV ((LG,L,L
!'"4"4dCdC--!--LlI..	 .
  @E??@s=   C4F*7A'E> E<E> ;F*<E> >
F'F""F''F*)NNNNNN2   )NNNNNrS   )%r   r   typingr   r   r   r   r   r	   r:   r   r   execution.collect_fieldsr   execution.executer   r   r   r   r   execution.valuesr   languager   pyutilsr   typer   r   map_async_iteratorr   __all__strintr   r   r6        r+   <module>ra      s     0 5  3 # # 6 04
5 04$(59?C!AFAFAF AF 	AF
 d38n-AF SMAF 12AF '';<AF AF =)?:;AFN 04$(?C!C:C:C: C: 	C:
 d38n-C: SMC: '';<C: C: =./C:L1@(8 1@]3=O 1@r`   