
    gh                     <   S SK Jr  S SKrS SKJrJr  S SKJrJrJr  S SK	J
r
  S SKJr  S SKJr  S SKJrJrJrJr   \" S	5      rS SKJr  \(       a&  S SKJrJrJrJr  S SKJrJrJrJ r   S SK!J"r"  S SK#J$r$J%r%   " S S\5      r&S r'S r(S r)g! \ a	    \" S
5      ef = f)    )import_moduleN)
get_clientcapture_event)_check_minimum_versionDidNotEnableIntegration)ignore_logger)request_body_within_bounds)should_send_default_pii)capture_internal_exceptionsensure_integration_enabledevent_from_exceptionpackage_versionzariadne.graphqlzariadne is not installed)TYPE_CHECKING)AnyDictListOptional)GraphQLErrorGraphQLResultGraphQLSchemaQueryParser)DocumentNode)EventEventProcessorc                   (    \ rS rSrSr\S 5       rSrg)AriadneIntegration    ariadnec                  d    [        S5      n [        [        U 5        [        S5        [	        5         g )Nr   )r   r   r   r	   _patch_graphql)versions    b/home/kali/devsecops-assessor/venv/lib/python3.13/site-packages/sentry_sdk/integrations/ariadne.py
setup_onceAriadneIntegration.setup_once#   s'     "),17;i      N)__name__
__module____qualname____firstlineno__
identifierstaticmethodr$   __static_attributes__r'   r&   r#   r   r       s    J r&   r   c                  B  ^^^ [         R                  m[         R                  m[         R                  m[	        [
        T5      U4S j5       n [	        [
        T5      U4S j5       n[	        [
        T5      U4S j5       nU [         l        U[         l        U[         l        g )Nc                 x   > [        U5      n[        R                  " 5       R                  U5        T" XU5      nU$ )N)_make_request_event_processor
sentry_sdkget_isolation_scopeadd_event_processor)context_valuequery_parserdataevent_processorresultold_parse_querys        r#   _sentry_patched_parse_query3_patch_graphql.<locals>._sentry_patched_parse_query4   s7     8=&&(<<_M dCr&   c           	        > T	" U /UQ70 UD6n[        US   5      n[        R                  " 5       R                  U5        [	        5       nUR                  5       (       aO  [        5          U  H4  n[        UUR                  [        R                  SS.S9u  px[        XxS9  M6     S S S 5        U$ U$ ! , (       d  f       U$ = fN   F)typehandled)client_options	mechanism)hint)_make_response_event_processorr2   r3   r4   r   	is_activer   r   optionsr   r,   r   )
errorsargskwargsr9   r8   clienterroreventrD   old_handle_errorss
            r#   %_sentry_patched_handle_graphql_errors=_patch_graphql.<locals>._sentry_patched_handle_graphql_errors=   s     #6;D;F;8C&&(<<_M,.#E"6'-~~$6$A$A',##KE "%3 $ / v /. s   );B00
B?c           	        > T	" U /UQ70 UD6n[        US   5      n[        R                  " 5       R                  U5        [	        5       nUR                  5       (       ab  [        5          U R                  =(       d    /  H4  n[        UUR                  [        R                  SS.S9u  px[        XxS9  M6     S S S 5        U$ U$ ! , (       d  f       U$ = fr>   )rE   r2   r3   r4   r   rF   r   rH   r   rG   r   r,   r   )
r9   rI   rJ   query_resultr8   rK   rL   rM   rD   old_handle_query_results
            r#   #_sentry_patched_handle_query_result;_patch_graphql.<locals>._sentry_patched_handle_query_resultU   s     /vGGG8aI&&(<<_M,.#]]0b0E"6'-~~$6$A$A',##KE "%3 1 / | /. s   )AC
C)ariadne_graphqlparse_queryhandle_graphql_errorshandle_query_resultr   r   )r;   rO   rT   rN   rS   r:   s      @@@r#   r!   r!   .   s    %11O'==-AA 2OD E   24EF G.   24KL M. #>O,QO)*MO'r&   c                    ^  U 4S jnU$ )z*Add request data and api_target to events.c                   > [        T[        5      (       d  U $ [        5           [        TR	                  S5      =(       d    0 R	                  SS5      5      n[        5       (       a6  [        [        5       U5      (       a  U R                  S0 5      nSUS'   TUS'   O,U R	                  S0 5      R	                  S5      (       a  U S   S	 S S S 5        U $ ! [
        [        4 a    U s sS S S 5        $ f = f! , (       d  f       U $ = f)NheaderszContent-Lengthr   requestgraphql
api_targetr7   )
isinstancedictr   intget	TypeError
ValueErrorr   r
   r   
setdefault)rM   rD   content_lengthrequest_infor7   s       r#   inner,_make_request_event_processor.<locals>.innerv   s    $%%L(*!$XXi(.B334DaH" '((-Gn. .  %//	2>-6\*'+V$9b)--f55)$V,! +$  z*  +*
 +*$ s/   C43CA1C4C1%C40C11C44
Dr'   )r7   ri   s   ` r#   r1   r1   r   s    2 Lr&   c                    ^  U 4S jnU$ )z2Add response data to the event's response context.c                    > [        5          [        5       (       a/  TR                  S5      (       a  U R                  S0 5      nST0US'   S S S 5        U $ ! , (       d  f       U $ = f)NrH   contextsr7   response)r   r   rc   rf   )rM   rD   rm   rn   s      r#   ri   -_make_response_event_processor.<locals>.inner   s_    (*&((X\\(-C-C ++J;H($ +  +* s   ?A
A$r'   )rn   ri   s   ` r#   rE   rE      s    	 Lr&   )*	importlibr   r2   r   r   sentry_sdk.integrationsr   r   r   sentry_sdk.integrations.loggingr	   $sentry_sdk.integrations._wsgi_commonr
   sentry_sdk.scoper   sentry_sdk.utilsr   r   r   r   rV   ImportErrortypingr   r   r   r   r   ariadne.typesr   r   r   r   graphql.language.astr   sentry_sdk._typesr   r   r   r!   r1   rE   r'   r&   r#   <module>r{      s    #  0 U U 9 K 4 3 $$56O !00UU17 ANH@}  3
1
223s   B B