
    aj                        d dl mZmZmZmZmZ d dlmZmZ d dl	m
Z
mZmZmZmZmZmZmZ g dZ G d de      Z	 ddeeegef   d	ee   d
efdZ G d de      Zdedeeef   d
efdZded
efdZ	 	 ddee   deeeegef      d
efdZy)    )AnyCallable
NamedTupleOptionalUnion)base64unbase64)GraphQLArgumentGraphQLNonNull	GraphQLIDGraphQLFieldGraphQLInterfaceTypeGraphQLListGraphQLResolveInfoGraphQLTypeResolver)from_global_idglobal_id_fieldnode_definitionsto_global_idGraphQLNodeDefinitionsResolvedGlobalIdc                   ,    e Zd ZU eed<   eed<   eed<   y)r   node_interface
node_fieldnodes_fieldN)__name__
__module____qualname__r   __annotations__r        d/var/www/html/myl_app/scheduler-service/venv/lib/python3.12/site-packages/graphql_relay/node/node.pyr   r      s    ((r!   r   Nfetch_by_idtype_resolverreturnc                 6    t        ddd |      }t        |ddt        t        t              d      i fd	
      }t        t        t        |            ddt        t        t        t        t                          d      i fd
      }t        |||      S )a  
    Given a function to map from an ID to an underlying object, and a function
    to map from an underlying object to the concrete GraphQLObjectType it
    corresponds to, constructs a `Node` interface that objects can implement,
    and a field object to be used as a `node` root field.

    If the type_resolver is omitted, object resolution on the interface will be
    handled with the `is_type_of` method on object types, as with any GraphQL
    interface without a provided `resolve_type` method.
    NodezAn object with an IDc                  :    dt        t        t              d      iS )NidzThe id of the object.description)r   r   r   r    r!   r"   <lambda>z"node_definitions.<locals>.<lambda>2   s    ,y)7N
 r!   )r+   fieldsresolve_typezFetches an object given its IDr)   The ID of an objectr*   c                      ||      S Nr    )_objinfor)   r#   s      r"   r,   z"node_definitions.<locals>.<lambda>C   s    {2t'< r!   )r+   argsresolvezFetches objects given their IDsidszThe IDs of objectsc                 <    |D cg c]  } ||       c}S c c}w r1   r    )r2   r3   r6   id_r#   s       r"   r,   z"node_definitions.<locals>.<lambda>O   s    3(OCS$)?(O (Os   )r   r   r
   r   r   r   r   )r#   r$   r   r   r   s   `    r"   r   r   !   s     **

 #	N 4/y)7L

 =	J {>235?{>)+DEF0
 P
K ".*kJJr!   c                   "    e Zd ZU eed<   eed<   y)r   typer)   N)r   r   r   strr   r    r!   r"   r   r   U   s    
IGr!   r   type_r8   c                 H    t        |  dt        j                  |             S )z
    Takes a type name and an ID specific to that type name, and returns a
    "global ID" that is unique among all types.
    :)r   r   	serialize)r<   r8   s     r"   r   r   [   s&    
 UG1Y0056788r!   	global_idc                 h    t        |       } d| vrt        d|       S t        | j                  dd       S )zp
    Takes the "global ID" created by to_global_id, and returns the type name and ID
    used to create it.
    r>       )r	   r   split)r@   s    r"   r   r   c   s9    
 #I
)I..Y__S!455r!   	type_name
id_fetcherc                 z     dt         dt        dt         dt        f fd}t        t	        t
              d|      S )a<  
    Creates the configuration for an id field on a node, using `to_global_id` to
    construct the ID from the provided typename. The type-specific ID is fetched
    by calling id_fetcher on the object, or if not provided, by accessing the `id`
    attribute of the object, or the `id` if the object is a dict.
    objr3   _argsr%   c                     xs |j                   j                  }r	 | |      n t        | t              r| d   n| j                  }t        ||      S )Nr)   )parent_typename
isinstancedictr)   r   )rH   r3   rI   r<   r8   rF   rE   s        r"   r5   z global_id_field.<locals>.resolvey   sT    2T--22  sD!)#t4#d)#&& 	
 E3''r!   r/   )r+   r5   )r   r   r;   r   r   r   )rE   rF   r5   s   `` r"   r   r   n   sA    (S ( 2 (S (S ( y!/Dg r!   r1   )NN)typingr   r   r   r   r   graphql_relay.utils.base64r   r	   graphqlr
   r   r   r   r   r   r   r   __all__r   r;   r   r   intr   r   r   r    r!   r"   <module>rT      s    = = 7	 	 	Z  481K3 23S891K/01K 1Khz 9 9%S/ 9c 96c 6&6 6  $EI}3(:";S"@AB r!   