o
    tBh                     @   s   d dl mZmZ ddlmZmZmZ ddlmZm	Z	m
Z
mZ ddlmZ ddgZ				dd
ededede	fddZ								ddeeef dedededede	fddZdS )    )castUnion   )DocumentNodeSourceparse)GraphQLObjectTypeGraphQLSchemaGraphQLSchemaKwargsspecified_directives   )extend_schema_implbuild_ast_schemabuild_schemaFdocument_astassume_validassume_valid_sdlreturnc                 C   s  t | ts	td|s|sddlm} ||  tddddddi dddd
}t|| |}|d s^|d	 p4dD ](}|j}|d
krFtt	||d< q5|dkrRtt	||d< q5|dkr]tt	||d< q5|d }t
dd |D }	g }
tD ]}|j|	vr{|
| qo|
r|t|
 |d< tdi |S )a  Build a GraphQL Schema from a given AST.

    This takes the ast of a schema document produced by the parse function in
    src/language/parser.py.

    If no schema definition is provided, then it will look for types named Query,
    Mutation and Subscription.

    Given that AST it constructs a GraphQLSchema. The resulting schema has no
    resolve methods, so execution will use default resolvers.

    When building a schema from a GraphQL service's introspection result, it might
    be safe to assume the schema is valid. Set ``assume_valid`` to ``True`` to assume
    the produced schema is valid. Set ``assume_valid_sdl`` to ``True`` to assume it is
    already a valid SDL document.
    z Must provide valid Document AST.r   )assert_valid_sdlN F)
querymutationsubscriptiondescriptiontypes
directives
extensionsast_nodeextension_ast_nodesr   r   r   Queryr   Mutationr   Subscriptionr   r   c                 s   s    | ]}|j V  qd S )N)name).0	directiver   r   y/var/www/html/riverr-enterprise-integrations-main/venv/lib/python3.10/site-packages/graphql/utilities/build_ast_schema.py	<genexpr>L   s    z#build_ast_schema.<locals>.<genexpr>)
isinstancer   	TypeErrorvalidation.validater   r
   r   r"   r   r   setr   appendtupler	   )r   r   r   r   empty_schema_kwargsschema_kwargstype_	type_namer   directive_namesmissing_directivesr$   r   r   r%   r      sL   


sourceno_locationallow_legacy_fragment_variablesc                 C   s   t t| ||d||dS )z6Build a GraphQLSchema directly from a source document.)r4   r5   )r   r   )r   r   )r3   r   r   r4   r5   r   r   r%   r   W   s   N)FF)FFFF)typingr   r   languager   r   r   typer   r	   r
   r   extend_schemar   __all__boolr   strr   r   r   r   r%   <module>   sF    
G
