
    lhS                     .   d dl Z d dlmZmZmZ d dlmZmZmZ d dl	m
Z
 	 d dlZd dlmZmZmZmZ d dlmZmZ d dlmZ d d	lmZ er%d d
lmZmZmZmZ d dlmZmZ ee ee eedf   f   f   Z! G d de      Z"d Z#d Z$d Z%d Z&d Z'y# e$ r	  ed      w xY w)    N)event_from_exceptionensure_integration_enabledparse_version)_check_minimum_versionDidNotEnableIntegration)should_send_default_pii)	print_astget_operation_astDocumentNodeVariableDefinitionNode)	TransportAsyncTransport)TransportQueryErrorzgql is not installed)TYPE_CHECKING)AnyDictTupleUnion)EventEventProcessor.c                        e Zd ZdZed        Zy)GQLIntegrationgqlc                  j    t        t        j                        } t        t        |        t                y )N)r   r   __version__r   r   _patch_execute)gql_versions    m/var/www/pru.catia.catastroantioquia-mas.com/tasa/lib/python3.12/site-packages/sentry_sdk/integrations/gql.py
setup_oncezGQLIntegration.setup_once$   s"     $COO4~{;    N)__name__
__module____qualname__
identifierstaticmethodr     r!   r   r   r   !   s    J r!   r   c                     	 t        |       }dt        |       i}|4|j                  |d<   |j                  |j                  j                  |d<   |S # t
        t        f$ r t               cY S w xY w)Nquery	variablesoperationName)r   r
   variable_definitionsnamevalueAttributeError	TypeErrordict)documentoperation_astdatas      r   _data_from_documentr5   -   sx    )(38,-$ - B BD!!-(5(:(:(@(@_%I& vs   AA A.-A.c                 :    	 | j                   S # t        $ r Y yw xY w)zg
    The RequestsHTTPTransport allows defining the HTTP method; all
    other transports use POST.
    POST)methodr/   )	transports    r   _transport_methodr:   =   s%     s    	c                 h    | i S dt        |       i}	 | j                  |d<   |S # t        $ r Y |S w xY w)Nr8   url)r:   r<   r/   )r9   request_infos     r   _request_info_from_transportr>   I   sV    	 	#I.L'mmU   s   $ 	11c                      t         j                  j                  t        t              fd       } | t         j                  _        y )Nc                 0   t        j                         }|j                  t        | |             	  | |g|i |S # t        $ rM}t        |t        j                         j                  ddd      \  }}t        j                  ||       |d }~ww xY w)Nr   F)typehandled)client_options	mechanism)	
sentry_sdkget_isolation_scopeadd_event_processor_make_gql_event_processorr   r   
get_clientoptionscapture_event)	selfr2   argskwargsscopeeeventhintreal_executes	           r   sentry_patched_executez._patch_execute.<locals>.sentry_patched_execute^   s     ..0!!";D("KL
	h@@@@" 	.)446>>#(U;KE4 $$UD1G	s   ? 	BABB)r   Clientexecuter   r   )rT   rS   s    @r   r   r   Z   s9    ::%%L= >" 0CJJr!   c                       fd}|S )Nc                 t   	 |d   d   j                   }| j                  di       }|j	                  ddit        j                               t               rHt              |d<   | j                  di       }|j                  di       }|j	                  d	|i|d
       | S # t        t        f$ r d }Y w xY w)Nexc_info   request
api_targetgraphqlr4   contextsresponseerrors)r4   rA   )	r`   r/   KeyError
setdefaultupdater>   r9   r	   r5   )rQ   rR   r`   r[   r^   r_   clientr2   s         r   	processorz,_make_gql_event_processor.<locals>.processoru   s    	*%a(//F ""9b1i.v/?/?@	
 #$1(;GFO''
B7H**:r:HOO%v.$ - ) 	F	s   B# #B76B7r'   )rd   r2   re   s   `` r   rH   rH   s   s    8 r!   )(rE   sentry_sdk.utilsr   r   r   sentry_sdk.integrationsr   r   r   sentry_sdk.scoper	   r   r]   r
   r   r   r   gql.transportr   r   gql.transport.exceptionsr   ImportErrortypingr   r   r   r   r   sentry_sdk._typesr   r   strEventDataTyper   r5   r:   r>   r   rH   r'   r!   r   <module>rp      s      V U 4/  8< !..7eC/Es/J)K$KLLMM	[ 	 	"02}  /
-
../s   B B