
    fi                     4   d dl mZ d dlZd dlmZ d dlmZmZmZ d dl	m
Z
 d dlmZmZmZmZ 	 d dlmZ n# e$ r  ed          w xY wd d	lmZ er(d d
lmZ d dlmZmZmZ d dlmZ d dlmZ d dlm Z  d dl!m"Z"  G d de          Z#d Z$d Z%ed             Z&dS )    )contextmanagerN)OP)_check_minimum_versionDidNotEnableIntegration)should_send_default_pii)capture_internal_exceptionsensure_integration_enabledevent_from_exceptionpackage_version)schemazgraphene is not installed)TYPE_CHECKING)	Generator)AnyDictUnion)Source)ExecutionResult)GraphQLSchema)Eventc                   (    e Zd ZdZed             ZdS )GrapheneIntegrationgraphenec                  j    t          d          } t          t          |            t                       d S )Nr   )r   r   r   _patch_graphql)versions    p/var/www/html/Pagina-Ingenieria-Requisitos/venv/lib/python3.11/site-packages/sentry_sdk/integrations/graphene.py
setup_oncezGrapheneIntegration.setup_once!   s4     "*--2G<<<    N)__name__
__module____qualname__
identifierstaticmethodr    r   r   r   r      s2        J  \  r   r   c                      t           j        t           j        t          t                    fd            } fd}| t           _        |t           _        d S )Nc           	         t          j                    }|                    t                     t	          | ||          5   
| |g|R i |}d d d            n# 1 swxY w Y   t                      5  t          j                    }|j        pg D ]?}t          ||j	        t          j        dd          \  }}	t          j        ||	           @	 d d d            n# 1 swxY w Y   |S NF)typehandled)client_options	mechanism)hint)
sentry_sdkget_isolation_scopeadd_event_processor_event_processorgraphql_spanr	   
get_clienterrorsr   optionsr   r#   capture_event)r   sourceargskwargsscoperesultclienterroreventr-   old_graphql_syncs             r   _sentry_patched_graphql_syncz4_patch_graphql.<locals>._sentry_patched_graphql_sync/   s    .00!!"2333&&&11 	G 	G%%ffFtFFFvFFF	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G )** 	; 	;*,,F," 	; 	;2#)> 3 >#(   t (T:::::	;	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; s%    AA!A3ACC!$C!c           	      d  K   t          j                                        t                    }| | |g|R i | d {V S t          j                    }|                    t                     t          | ||          5   | |g|R i | d {V }d d d            n# 1 swxY w Y   t                      5  t          j                    }|j	        pg D ]?}t          ||j        t          j        dd          \  }	}
t          j        |	|
           @	 d d d            n# 1 swxY w Y   |S r(   )r.   r3   get_integrationr   r/   r0   r1   r2   r	   r4   r   r5   r#   r6   )r   r7   r8   r9   integrationr:   r;   r<   r=   r>   r-   old_graphql_asyncs              r   _sentry_patched_graphql_asyncz5_patch_graphql.<locals>._sentry_patched_graphql_asyncG   s      +--==>QRR**66KDKKKFKKKKKKKKK.00!!"2333&&&11 	N 	N,,VVMdMMMfMMMMMMMMF	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	N 	N )** 	; 	;*,,F," 	; 	;2#)> 3 >#(   t (T:::::	;	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; s%   B""B&)B&;AD%%D),D))graphene_schemagraphql_syncgraphqlr
   r   )r@   rE   rD   r?   s     @@r   r   r   *   sy    &3'/ 35EFF    GF.    6 $@O ;Or   c                     t                      r|                     di           }d|d<   n2|                     di                               d          r	| d         d= | S )NrequestrH   
api_targetdata)r   
setdefaultget)r>   r-   request_infos      r   r1   r1   f   sh       %''	266%.\""	9b	!	!	%	%f	-	- %)V$Lr   c              #     K   |                     d          }d}t          j        }|                                                    d          rd}t          j        }n5|                                                    d          rd}t          j        }t          j        ||ddd           t          j	                    }|j
        r|j
                            ||	          }nt          j        ||	          }|                    d
|           |                    d|           |                    d|           	 d V  |                                 d S # |                                 w xY w)Noperation_namequerymutationsubscription)rQ   operation_typezgraphql.operation)rL   category)crumb)opnamezgraphql.documentzgraphql.operation.namezgraphql.operation.type)rN   r   GRAPHQL_QUERYstrip
startswithGRAPHQL_MUTATIONGRAPHQL_SUBSCRIPTIONr.   add_breadcrumbget_current_scopespanstart_child
start_spanset_datafinish)r   r7   r9   rQ   rU   rX   r:   _graphql_spans           r   r2   r2   r   s      ZZ 011NN		B||~~  ,, %# 		"	">	2	2 %'$ #1"0  ,
 
    (**Ez J
..">.JJ"-.III-v6663^DDD3^DDDs   <E E,)'
contextlibr   r.   sentry_sdk.constsr   sentry_sdk.integrationsr   r   r   sentry_sdk.scoper   sentry_sdk.utilsr	   r
   r   r   graphene.typesr   rF   ImportErrortypingr   collections.abcr   r   r   r   graphene.language.sourcer   graphql.executionr   graphql.typer   sentry_sdk._typesr   r   r   r1   r2   r%   r   r   <module>rt      s   % % % % % %                 U U U U U U U U U U 4 4 4 4 4 4           48888888 4 4 4
,2
3
334 !           ())))))''''''''''//////111111******''''''	 	 	 	 	+ 	 	 	9< 9< 9<x	 	 	 $ $ $ $ $s	   5 A