Ë
    ó©Ñh¨
  ã                   ó|   — d dl Z d dlZd dlmZmZ d dlmZ d dlmZm	Z	 d dl
mZmZ  G d„ de«      Z G d„ d	e«      Zy)
é    N)ÚOptionalÚType)ÚAsyncCallbackManagerForToolRun)Ú	BaseModelÚField)ÚAINBaseToolÚOperationTypec                   ón   — e Zd ZU dZ ed«      Zeed<    edd¬«      Ze	ed<    edd¬«      Z
ee	   ed	<   y)
Ú
RuleSchemazSchema for owner operations..Útypez-Path on the blockchain where the rule applies)ÚdescriptionÚpathNz#eval string to determine permissionÚeval)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r	   Ú__annotations__r   Ústrr   r   © ó    úf/var/www/html/eduruby.in/venv/lib/python3.12/site-packages/langchain_community/tools/ainetwork/rule.pyr   r      s;   … Ù&á ›*€Dˆ-Ó$ÙcÐ'VÔW€Dˆ#ÓWÙ Ð2WÔX€Dˆ(3‰-ÔXr   r   c                   óp   — e Zd ZU dZdZeed<   dZeed<   eZ	e
e   ed<   	 	 dded	ed
ee   dee   def
d„Zy)Ú
AINRuleOpszTool for owner operations.Ú
AINruleOpsÚnameaò  
Covers the write `rule` for the AINetwork Blockchain database. The SET type specifies write permissions using the `eval` variable as a JavaScript eval string.
In order to AINvalueOps with SET at the path, the execution result of the `eval` string must be true.

## Path Rules
1. Allowed characters for directory: `[a-zA-Z_0-9]`
2. Use `$<key>` for template variables as directory.

## Eval String Special Variables
- auth.addr: Address of the writer for the path
- newData: New data for the path
- data: Current data for the path
- currentTime: Time in seconds
- lastBlockNumber: Latest processed block number

## Eval String Functions
- getValue(<path>)
- getRule(<path>)
- getOwner(<path>)
- getFunction(<path>)
- evalRule(<path>, <value to set>, auth, currentTime)
- evalOwner(<path>, 'write_owner', auth)

## SET Example
- type: SET
- path: /apps/langchain_project_1/$from/$to/$img
- eval: auth.addr===$from&&!getValue('/apps/image_db/'+$img)

## GET Example
- type: GET
- path: /apps/langchain_project_1
r   Úargs_schemaNr   r   r   Úrun_managerÚreturnc              ƒ   ó^  K  — ddl m} 	 |t        j                  u rV|€t	        d«      ‚| j
                  j                  j                  |«      j                   |dd|ii¬«      ¬«      ƒ d {  –—† }n]|t        j                  u r<| j
                  j                  j                  |«      j                  «       ƒ d {  –—† }nt	        d|› d	«      ‚t        j                  |d
¬«      S 7 Œy7 Œ-# t        $ r7}t        j                  |«      j                   › dt#        |«      › cY d }~S d }~ww xY w­w)Nr   )ÚValueOnlyTransactionInputz%'eval' is required for SET operation.z.ruleÚwrite)Úvalue)ÚtransactionInputzUnsupported 'type': ú.F)Úensure_asciiz: )Ú	ain.typesr!   r	   ÚSETÚ
ValueErrorÚ	interfaceÚdbÚrefÚsetRuleÚGETÚgetRuleÚjsonÚdumpsÚ	ExceptionÚbuiltinsr   r   r   )Úselfr   r   r   r   r!   ÚresÚes           r   Ú_arunzAINRuleOps._arun9   s  è ø€ õ 	8ð	<Ø”}×(Ñ(Ñ(Ø<Ü$Ð%LÓMÐMà ŸN™N×-Ñ-×1Ñ1°$Ó7×?Ñ?Ù%>Ø&¨°$¨Ð8ô&ð @ó ÷ ‘ð
 œ×*Ñ*Ñ*Ø ŸN™N×-Ñ-×1Ñ1°$Ó7×?Ñ?ÓA×A‘ä Ð#7¸°v¸QÐ!?Ó@Ð@Ü—:‘:˜c°Ô6Ð6ðøð Bùô ò 	<Ü—m‘m AÓ&×/Ñ/Ð0°´3°q³6°(Ð;Õ;ûð	<üsZ   ‚D-ŠA"C* Á,C&Á-AC* Â:C(Â;*C* Ã%D-Ã&C* Ã(C* Ã*	D*Ã3,D%ÄD*Ä D-Ä%D*Ä*D-)NN)r   r   r   r   r   r   r   r   r   r   r   r   r	   r   r   r7   r   r   r   r   r      su   … Ù$à€Dˆ#Óð€Kó ð@ $.€Ki‘Ó-ð #Ø@Dñ<àð<ð ð<ð s‰mð	<ð
 Ð<Ñ=ð<ð 
ô<r   r   )r3   r0   Útypingr   r   Úlangchain_core.callbacksr   Úpydanticr   r   Ú(langchain_community.tools.ainetwork.baser   r	   r   r   r   r   r   ú<module>r<      s1   ðÛ Û ß !å Cß %ç OôYô Yô?<õ ?<r   