hyf

Context-aware query service for Radroots
git clone https://radroots.dev/git/hyf.git
Log | Files | Refs | README | LICENSE

match_input.mojo (941B)


      1 from std.collections import List
      2 
      3 
      4 def validate_match_scope(
      5     trusted_tenant: String, snapshot_tenant: String
      6 ) raises:
      7     if String(trusted_tenant).strip().byte_length() == 0:
      8         raise Error("match requires a trusted tenant")
      9     if snapshot_tenant != trusted_tenant:
     10         raise Error("snapshot is outside the authorized tenant scope")
     11 
     12 
     13 def validate_supplied_lots(lot_keys: List[String]) raises -> List[String]:
     14     var unique = List[String]()
     15     for key in lot_keys:
     16         if String(key).strip().byte_length() == 0:
     17             raise Error("supplied lot key must not be empty")
     18         for existing in unique:
     19             if existing == key:
     20                 raise Error("duplicate supplied lot revision: " + key)
     21         unique.append(String(key))
     22     if len(unique) == 0:
     23         raise Error("matching requires at least one supplied lot")
     24     return unique^
     25 
     26 
     27 def caller_name_is_authentication() -> Bool:
     28     return False