// This file is @generated by prost-build. /// Request validation rules for a table #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetTableValidationRequest { #[prost(string, tag = "1")] pub profile_name: ::prost::alloc::string::String, #[prost(string, tag = "2")] pub table_name: ::prost::alloc::string::String, } /// Response with field-level validations for the whole table. /// If a field is omitted, no validation configuration exists for that field. #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct TableValidationResponse { #[prost(message, repeated, tag = "1")] pub fields: ::prost::alloc::vec::Vec, } /// Field-level validation definition stored on the server and distributed to clients. #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct FieldValidation { /// MUST match your frontend FormState.dataKey for the column #[prost(string, tag = "1")] pub data_key: ::prost::alloc::string::String, /// Validation 1: length and counting rules. #[prost(message, optional, tag = "10")] pub limits: ::core::option::Option, /// Validation 2: position-based character constraints. #[prost(message, optional, tag = "11")] pub pattern: ::core::option::Option, /// Exact-value whitelist. #[prost(message, optional, tag = "12")] pub allowed_values: ::core::option::Option, /// Client-side hint that this field participates in external/asynchronous validation UI. #[prost(bool, tag = "13")] pub external_validation_enabled: bool, /// Client-side formatter metadata. This is intentionally data-only, not executable code. #[prost(message, optional, tag = "14")] pub formatter: ::core::option::Option, /// Client-side display mask metadata. The server stores raw data without mask literals. #[prost(message, optional, tag = "3")] pub mask: ::core::option::Option, /// Field must be provided / treated as required by clients and server enforcement layers. #[prost(bool, tag = "4")] pub required: bool, /// Once locked, this field's validation config cannot be changed. #[prost(bool, tag = "15")] #[serde(default)] pub locked: bool, } /// Character limit validation (Validation 1). /// These rules map directly to canvas CharacterLimits. #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct CharacterLimits { /// When zero, the field is considered "not set". If both min/max are zero, /// the server should avoid sending this FieldValidation (no validation). #[prost(uint32, tag = "1")] pub min: u32, #[prost(uint32, tag = "2")] pub max: u32, /// Optional warning threshold; when unset, no warning threshold is applied. #[prost(uint32, optional, tag = "3")] pub warn_at: ::core::option::Option, /// defaults to CHARS if unspecified #[prost(enumeration = "CountMode", tag = "4")] pub count_mode: i32, } /// Mask for pretty display only. /// /// This is not a validation rule by itself. It exists so clients can render and /// navigate masked input while still storing raw values server-side. #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DisplayMask { /// e.g., "(###) ###-####" or "####-##-##" #[prost(string, tag = "1")] pub pattern: ::prost::alloc::string::String, /// e.g., "#" #[prost(string, tag = "2")] pub input_char: ::prost::alloc::string::String, /// e.g., "_" #[prost(string, optional, tag = "3")] pub template_char: ::core::option::Option<::prost::alloc::string::String>, } /// Which positions a pattern rule applies to. /// This exists instead of a string syntax like "0-3" so the server can validate /// the structure directly and clients do not need to parse a DSL. #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct PatternPosition { #[prost(enumeration = "PatternPositionKind", tag = "1")] pub kind: i32, #[prost(uint32, tag = "2")] pub single: u32, #[prost(uint32, tag = "3")] pub start: u32, #[prost(uint32, tag = "4")] pub end: u32, #[prost(uint32, repeated, tag = "5")] pub positions: ::prost::alloc::vec::Vec, } /// What type of character constraint a pattern rule applies. /// This mirrors the typed character filters used by canvas. #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct CharacterConstraint { #[prost(enumeration = "CharacterConstraintKind", tag = "1")] pub kind: i32, /// Used when kind == CHARACTER_CONSTRAINT_EXACT. #[prost(string, optional, tag = "2")] pub exact: ::core::option::Option<::prost::alloc::string::String>, /// Used when kind == CHARACTER_CONSTRAINT_ONE_OF. #[prost(string, repeated, tag = "3")] pub one_of: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, /// Used when kind == CHARACTER_CONSTRAINT_REGEX. #[prost(string, optional, tag = "4")] pub regex: ::core::option::Option<::prost::alloc::string::String>, } /// One position-based validation rule, similar to canvas PositionFilter. #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct PatternRule { #[prost(message, optional, tag = "1")] pub position: ::core::option::Option, #[prost(message, optional, tag = "2")] pub constraint: ::core::option::Option, } /// Client-side formatter metadata. /// The formatter "type" is intended to be resolved by a client-side formatter registry. #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct CustomFormatter { /// Formatter type identifier; handled client‑side. /// Examples: "PSCFormatter", "PhoneFormatter", "CreditCardFormatter", "DateFormatter" #[prost(string, tag = "1")] pub r#type: ::prost::alloc::string::String, #[prost(message, repeated, tag = "2")] pub options: ::prost::alloc::vec::Vec, #[prost(string, optional, tag = "3")] pub description: ::core::option::Option<::prost::alloc::string::String>, } #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct FormatterOption { #[prost(string, tag = "1")] pub key: ::prost::alloc::string::String, #[prost(string, tag = "2")] pub value: ::prost::alloc::string::String, } /// Exact-value whitelist configuration. /// This maps to canvas AllowedValues semantics. #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct AllowedValues { #[prost(string, repeated, tag = "1")] pub values: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, #[prost(bool, tag = "2")] pub allow_empty: bool, #[prost(bool, tag = "3")] pub case_insensitive: bool, } /// Collection of pattern rules for one field. #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct PatternRules { /// All rules that make up the validation logic #[prost(message, repeated, tag = "1")] pub rules: ::prost::alloc::vec::Vec, /// Optional human‑readable description for UI/debug purposes #[prost(string, optional, tag = "2")] pub description: ::core::option::Option<::prost::alloc::string::String>, } #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct UpdateFieldValidationRequest { #[prost(string, tag = "1")] pub profile_name: ::prost::alloc::string::String, #[prost(string, tag = "2")] pub table_name: ::prost::alloc::string::String, #[prost(string, tag = "3")] pub data_key: ::prost::alloc::string::String, #[prost(message, optional, tag = "4")] pub validation: ::core::option::Option, } #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct UpdateFieldValidationResponse { #[prost(bool, tag = "1")] pub success: bool, #[prost(string, tag = "2")] pub message: ::prost::alloc::string::String, } #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ReplaceTableValidationRequest { #[prost(string, tag = "1")] pub profile_name: ::prost::alloc::string::String, #[prost(string, tag = "2")] pub table_name: ::prost::alloc::string::String, /// Full replacement set. Fields omitted here are removed from the stored config. #[prost(message, repeated, tag = "3")] pub fields: ::prost::alloc::vec::Vec, } #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ReplaceTableValidationResponse { #[prost(bool, tag = "1")] pub success: bool, #[prost(string, tag = "2")] pub message: ::prost::alloc::string::String, } #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ValidationRuleDefinition { #[prost(int64, optional, tag = "4")] pub id: ::core::option::Option, #[prost(string, tag = "1")] pub name: ::prost::alloc::string::String, #[prost(string, optional, tag = "2")] pub description: ::core::option::Option<::prost::alloc::string::String>, /// Reusable rule fragment. dataKey is ignored by the server for reusable rules. #[prost(message, optional, tag = "3")] pub validation: ::core::option::Option, } #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ValidationSetRuleItem { #[prost(int32, tag = "1")] pub position: i32, #[prost(string, optional, tag = "2")] pub name: ::core::option::Option<::prost::alloc::string::String>, #[prost(string, optional, tag = "3")] pub description: ::core::option::Option<::prost::alloc::string::String>, #[prost(oneof = "validation_set_rule_item::Source", tags = "10, 11, 12")] pub source: ::core::option::Option, } /// Nested message and enum types in `ValidationSetRuleItem`. pub mod validation_set_rule_item { #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Source { #[prost(string, tag = "10")] GlobalRuleName(::prost::alloc::string::String), #[prost(message, tag = "11")] InlineValidation(super::FieldValidation), #[prost(int64, tag = "12")] GlobalRuleId(i64), } } #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ValidationSetDefinition { #[prost(string, tag = "1")] pub name: ::prost::alloc::string::String, #[prost(string, optional, tag = "2")] pub description: ::core::option::Option<::prost::alloc::string::String>, /// Ordered set items. #[prost(message, repeated, tag = "5")] pub rule_items: ::prost::alloc::vec::Vec, /// Server-resolved snapshot of all set items in order. #[prost(message, optional, tag = "4")] pub resolved_validation: ::core::option::Option, } #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct UpsertValidationRuleRequest { #[prost(string, tag = "1")] pub profile_name: ::prost::alloc::string::String, #[prost(message, optional, tag = "2")] pub rule: ::core::option::Option, } #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct UpsertValidationRuleResponse { #[prost(bool, tag = "1")] pub success: bool, #[prost(string, tag = "2")] pub message: ::prost::alloc::string::String, } #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ListValidationRulesRequest { #[prost(string, tag = "1")] pub profile_name: ::prost::alloc::string::String, } #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ListValidationRulesResponse { #[prost(message, repeated, tag = "1")] pub rules: ::prost::alloc::vec::Vec, } #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DeleteValidationRuleRequest { #[prost(string, tag = "1")] pub profile_name: ::prost::alloc::string::String, #[prost(string, tag = "2")] pub name: ::prost::alloc::string::String, } #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DeleteValidationRuleResponse { #[prost(bool, tag = "1")] pub success: bool, #[prost(string, tag = "2")] pub message: ::prost::alloc::string::String, } #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct UpsertValidationSetRequest { #[prost(string, tag = "1")] pub profile_name: ::prost::alloc::string::String, #[prost(message, optional, tag = "2")] pub set: ::core::option::Option, } #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct UpsertValidationSetResponse { #[prost(bool, tag = "1")] pub success: bool, #[prost(string, tag = "2")] pub message: ::prost::alloc::string::String, } #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ListValidationSetsRequest { #[prost(string, tag = "1")] pub profile_name: ::prost::alloc::string::String, } #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ListValidationSetsResponse { #[prost(message, repeated, tag = "1")] pub sets: ::prost::alloc::vec::Vec, } #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DeleteValidationSetRequest { #[prost(string, tag = "1")] pub profile_name: ::prost::alloc::string::String, #[prost(string, tag = "2")] pub name: ::prost::alloc::string::String, } #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DeleteValidationSetResponse { #[prost(bool, tag = "1")] pub success: bool, #[prost(string, tag = "2")] pub message: ::prost::alloc::string::String, } #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ApplyValidationSetRequest { #[prost(string, tag = "1")] pub profile_name: ::prost::alloc::string::String, #[prost(string, tag = "2")] pub table_name: ::prost::alloc::string::String, #[prost(string, tag = "3")] pub data_key: ::prost::alloc::string::String, #[prost(string, tag = "4")] pub set_name: ::prost::alloc::string::String, } #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ApplyValidationSetResponse { #[prost(bool, tag = "1")] pub success: bool, #[prost(string, tag = "2")] pub message: ::prost::alloc::string::String, #[prost(message, optional, tag = "3")] pub validation: ::core::option::Option, } #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct LockFieldValidationRequest { #[prost(string, tag = "1")] pub profile_name: ::prost::alloc::string::String, #[prost(string, tag = "2")] pub table_name: ::prost::alloc::string::String, #[prost(string, tag = "3")] pub data_key: ::prost::alloc::string::String, } #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct LockFieldValidationResponse { #[prost(bool, tag = "1")] pub success: bool, #[prost(string, tag = "2")] pub message: ::prost::alloc::string::String, } /// Character length counting mode #[derive(serde::Serialize, serde::Deserialize)] #[serde(rename_all = "SCREAMING_SNAKE_CASE")] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum CountMode { /// default: same as CHARS Unspecified = 0, Chars = 1, Bytes = 2, DisplayWidth = 3, } impl CountMode { /// String value of the enum field names used in the ProtoBuf definition. /// /// The values are not transformed in any way and thus are considered stable /// (if the ProtoBuf definition does not change) and safe for programmatic use. pub fn as_str_name(&self) -> &'static str { match self { Self::Unspecified => "COUNT_MODE_UNSPECIFIED", Self::Chars => "CHARS", Self::Bytes => "BYTES", Self::DisplayWidth => "DISPLAY_WIDTH", } } /// Creates an enum from field names used in the ProtoBuf definition. pub fn from_str_name(value: &str) -> ::core::option::Option { match value { "COUNT_MODE_UNSPECIFIED" => Some(Self::Unspecified), "CHARS" => Some(Self::Chars), "BYTES" => Some(Self::Bytes), "DISPLAY_WIDTH" => Some(Self::DisplayWidth), _ => None, } } } #[derive(serde::Serialize, serde::Deserialize)] #[serde(rename_all = "SCREAMING_SNAKE_CASE")] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum PatternPositionKind { Unspecified = 0, PatternPositionSingle = 1, PatternPositionRange = 2, PatternPositionFrom = 3, PatternPositionMultiple = 4, } impl PatternPositionKind { /// String value of the enum field names used in the ProtoBuf definition. /// /// The values are not transformed in any way and thus are considered stable /// (if the ProtoBuf definition does not change) and safe for programmatic use. pub fn as_str_name(&self) -> &'static str { match self { Self::Unspecified => "PATTERN_POSITION_KIND_UNSPECIFIED", Self::PatternPositionSingle => "PATTERN_POSITION_SINGLE", Self::PatternPositionRange => "PATTERN_POSITION_RANGE", Self::PatternPositionFrom => "PATTERN_POSITION_FROM", Self::PatternPositionMultiple => "PATTERN_POSITION_MULTIPLE", } } /// Creates an enum from field names used in the ProtoBuf definition. pub fn from_str_name(value: &str) -> ::core::option::Option { match value { "PATTERN_POSITION_KIND_UNSPECIFIED" => Some(Self::Unspecified), "PATTERN_POSITION_SINGLE" => Some(Self::PatternPositionSingle), "PATTERN_POSITION_RANGE" => Some(Self::PatternPositionRange), "PATTERN_POSITION_FROM" => Some(Self::PatternPositionFrom), "PATTERN_POSITION_MULTIPLE" => Some(Self::PatternPositionMultiple), _ => None, } } } #[derive(serde::Serialize, serde::Deserialize)] #[serde(rename_all = "SCREAMING_SNAKE_CASE")] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum CharacterConstraintKind { Unspecified = 0, CharacterConstraintAlphabetic = 1, CharacterConstraintNumeric = 2, CharacterConstraintAlphanumeric = 3, CharacterConstraintExact = 4, CharacterConstraintOneOf = 5, CharacterConstraintRegex = 6, } impl CharacterConstraintKind { /// String value of the enum field names used in the ProtoBuf definition. /// /// The values are not transformed in any way and thus are considered stable /// (if the ProtoBuf definition does not change) and safe for programmatic use. pub fn as_str_name(&self) -> &'static str { match self { Self::Unspecified => "CHARACTER_CONSTRAINT_KIND_UNSPECIFIED", Self::CharacterConstraintAlphabetic => "CHARACTER_CONSTRAINT_ALPHABETIC", Self::CharacterConstraintNumeric => "CHARACTER_CONSTRAINT_NUMERIC", Self::CharacterConstraintAlphanumeric => "CHARACTER_CONSTRAINT_ALPHANUMERIC", Self::CharacterConstraintExact => "CHARACTER_CONSTRAINT_EXACT", Self::CharacterConstraintOneOf => "CHARACTER_CONSTRAINT_ONE_OF", Self::CharacterConstraintRegex => "CHARACTER_CONSTRAINT_REGEX", } } /// Creates an enum from field names used in the ProtoBuf definition. pub fn from_str_name(value: &str) -> ::core::option::Option { match value { "CHARACTER_CONSTRAINT_KIND_UNSPECIFIED" => Some(Self::Unspecified), "CHARACTER_CONSTRAINT_ALPHABETIC" => { Some(Self::CharacterConstraintAlphabetic) } "CHARACTER_CONSTRAINT_NUMERIC" => Some(Self::CharacterConstraintNumeric), "CHARACTER_CONSTRAINT_ALPHANUMERIC" => { Some(Self::CharacterConstraintAlphanumeric) } "CHARACTER_CONSTRAINT_EXACT" => Some(Self::CharacterConstraintExact), "CHARACTER_CONSTRAINT_ONE_OF" => Some(Self::CharacterConstraintOneOf), "CHARACTER_CONSTRAINT_REGEX" => Some(Self::CharacterConstraintRegex), _ => None, } } } /// Generated client implementations. pub mod table_validation_service_client { #![allow( unused_variables, dead_code, missing_docs, clippy::wildcard_imports, clippy::let_unit_value, )] use tonic::codegen::*; use tonic::codegen::http::Uri; /// Service for storing and fetching field-validation definitions. #[derive(Debug, Clone)] pub struct TableValidationServiceClient { inner: tonic::client::Grpc, } impl TableValidationServiceClient { /// Attempt to create a new client by connecting to a given endpoint. pub async fn connect(dst: D) -> Result where D: TryInto, D::Error: Into, { let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; Ok(Self::new(conn)) } } impl TableValidationServiceClient where T: tonic::client::GrpcService, T::Error: Into, T::ResponseBody: Body + std::marker::Send + 'static, ::Error: Into + std::marker::Send, { pub fn new(inner: T) -> Self { let inner = tonic::client::Grpc::new(inner); Self { inner } } pub fn with_origin(inner: T, origin: Uri) -> Self { let inner = tonic::client::Grpc::with_origin(inner, origin); Self { inner } } pub fn with_interceptor( inner: T, interceptor: F, ) -> TableValidationServiceClient> where F: tonic::service::Interceptor, T::ResponseBody: Default, T: tonic::codegen::Service< http::Request, Response = http::Response< >::ResponseBody, >, >, , >>::Error: Into + std::marker::Send + std::marker::Sync, { TableValidationServiceClient::new( InterceptedService::new(inner, interceptor), ) } /// Compress requests with the given encoding. /// /// This requires the server to support it otherwise it might respond with an /// error. #[must_use] pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { self.inner = self.inner.send_compressed(encoding); self } /// Enable decompressing responses. #[must_use] pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { self.inner = self.inner.accept_compressed(encoding); self } /// Limits the maximum size of a decoded message. /// /// Default: `4MB` #[must_use] pub fn max_decoding_message_size(mut self, limit: usize) -> Self { self.inner = self.inner.max_decoding_message_size(limit); self } /// Limits the maximum size of an encoded message. /// /// Default: `usize::MAX` #[must_use] pub fn max_encoding_message_size(mut self, limit: usize) -> Self { self.inner = self.inner.max_encoding_message_size(limit); self } pub async fn get_table_validation( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/komp_ac.table_validation.TableValidationService/GetTableValidation", ); let mut req = request.into_request(); req.extensions_mut() .insert( GrpcMethod::new( "komp_ac.table_validation.TableValidationService", "GetTableValidation", ), ); self.inner.unary(req, path, codec).await } /// Upsert a single field validation definition. pub async fn update_field_validation( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/komp_ac.table_validation.TableValidationService/UpdateFieldValidation", ); let mut req = request.into_request(); req.extensions_mut() .insert( GrpcMethod::new( "komp_ac.table_validation.TableValidationService", "UpdateFieldValidation", ), ); self.inner.unary(req, path, codec).await } /// Replace the full validation definition set for a table in one transaction. pub async fn replace_table_validation( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/komp_ac.table_validation.TableValidationService/ReplaceTableValidation", ); let mut req = request.into_request(); req.extensions_mut() .insert( GrpcMethod::new( "komp_ac.table_validation.TableValidationService", "ReplaceTableValidation", ), ); self.inner.unary(req, path, codec).await } /// Reusable named rule fragments. pub async fn upsert_validation_rule( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/komp_ac.table_validation.TableValidationService/UpsertValidationRule", ); let mut req = request.into_request(); req.extensions_mut() .insert( GrpcMethod::new( "komp_ac.table_validation.TableValidationService", "UpsertValidationRule", ), ); self.inner.unary(req, path, codec).await } pub async fn list_validation_rules( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/komp_ac.table_validation.TableValidationService/ListValidationRules", ); let mut req = request.into_request(); req.extensions_mut() .insert( GrpcMethod::new( "komp_ac.table_validation.TableValidationService", "ListValidationRules", ), ); self.inner.unary(req, path, codec).await } pub async fn delete_validation_rule( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/komp_ac.table_validation.TableValidationService/DeleteValidationRule", ); let mut req = request.into_request(); req.extensions_mut() .insert( GrpcMethod::new( "komp_ac.table_validation.TableValidationService", "DeleteValidationRule", ), ); self.inner.unary(req, path, codec).await } /// Reusable named sets composed from rules. pub async fn upsert_validation_set( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/komp_ac.table_validation.TableValidationService/UpsertValidationSet", ); let mut req = request.into_request(); req.extensions_mut() .insert( GrpcMethod::new( "komp_ac.table_validation.TableValidationService", "UpsertValidationSet", ), ); self.inner.unary(req, path, codec).await } pub async fn list_validation_sets( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/komp_ac.table_validation.TableValidationService/ListValidationSets", ); let mut req = request.into_request(); req.extensions_mut() .insert( GrpcMethod::new( "komp_ac.table_validation.TableValidationService", "ListValidationSets", ), ); self.inner.unary(req, path, codec).await } pub async fn delete_validation_set( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/komp_ac.table_validation.TableValidationService/DeleteValidationSet", ); let mut req = request.into_request(); req.extensions_mut() .insert( GrpcMethod::new( "komp_ac.table_validation.TableValidationService", "DeleteValidationSet", ), ); self.inner.unary(req, path, codec).await } /// Snapshot a reusable set onto a concrete table field. pub async fn apply_validation_set( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/komp_ac.table_validation.TableValidationService/ApplyValidationSet", ); let mut req = request.into_request(); req.extensions_mut() .insert( GrpcMethod::new( "komp_ac.table_validation.TableValidationService", "ApplyValidationSet", ), ); self.inner.unary(req, path, codec).await } /// Permanently lock one field's validation config. pub async fn lock_field_validation( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/komp_ac.table_validation.TableValidationService/LockFieldValidation", ); let mut req = request.into_request(); req.extensions_mut() .insert( GrpcMethod::new( "komp_ac.table_validation.TableValidationService", "LockFieldValidation", ), ); self.inner.unary(req, path, codec).await } } } /// Generated server implementations. pub mod table_validation_service_server { #![allow( unused_variables, dead_code, missing_docs, clippy::wildcard_imports, clippy::let_unit_value, )] use tonic::codegen::*; /// Generated trait containing gRPC methods that should be implemented for use with TableValidationServiceServer. #[async_trait] pub trait TableValidationService: std::marker::Send + std::marker::Sync + 'static { async fn get_table_validation( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; /// Upsert a single field validation definition. async fn update_field_validation( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; /// Replace the full validation definition set for a table in one transaction. async fn replace_table_validation( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; /// Reusable named rule fragments. async fn upsert_validation_rule( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; async fn list_validation_rules( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; async fn delete_validation_rule( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; /// Reusable named sets composed from rules. async fn upsert_validation_set( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; async fn list_validation_sets( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; async fn delete_validation_set( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; /// Snapshot a reusable set onto a concrete table field. async fn apply_validation_set( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; /// Permanently lock one field's validation config. async fn lock_field_validation( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; } /// Service for storing and fetching field-validation definitions. #[derive(Debug)] pub struct TableValidationServiceServer { inner: Arc, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, max_decoding_message_size: Option, max_encoding_message_size: Option, } impl TableValidationServiceServer { pub fn new(inner: T) -> Self { Self::from_arc(Arc::new(inner)) } pub fn from_arc(inner: Arc) -> Self { Self { inner, accept_compression_encodings: Default::default(), send_compression_encodings: Default::default(), max_decoding_message_size: None, max_encoding_message_size: None, } } pub fn with_interceptor( inner: T, interceptor: F, ) -> InterceptedService where F: tonic::service::Interceptor, { InterceptedService::new(Self::new(inner), interceptor) } /// Enable decompressing requests with the given encoding. #[must_use] pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { self.accept_compression_encodings.enable(encoding); self } /// Compress responses with the given encoding, if the client supports it. #[must_use] pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { self.send_compression_encodings.enable(encoding); self } /// Limits the maximum size of a decoded message. /// /// Default: `4MB` #[must_use] pub fn max_decoding_message_size(mut self, limit: usize) -> Self { self.max_decoding_message_size = Some(limit); self } /// Limits the maximum size of an encoded message. /// /// Default: `usize::MAX` #[must_use] pub fn max_encoding_message_size(mut self, limit: usize) -> Self { self.max_encoding_message_size = Some(limit); self } } impl tonic::codegen::Service> for TableValidationServiceServer where T: TableValidationService, B: Body + std::marker::Send + 'static, B::Error: Into + std::marker::Send + 'static, { type Response = http::Response; type Error = std::convert::Infallible; type Future = BoxFuture; fn poll_ready( &mut self, _cx: &mut Context<'_>, ) -> Poll> { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { match req.uri().path() { "/komp_ac.table_validation.TableValidationService/GetTableValidation" => { #[allow(non_camel_case_types)] struct GetTableValidationSvc(pub Arc); impl< T: TableValidationService, > tonic::server::UnaryService for GetTableValidationSvc { type Response = super::TableValidationResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::get_table_validation( &inner, request, ) .await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = GetTableValidationSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/komp_ac.table_validation.TableValidationService/UpdateFieldValidation" => { #[allow(non_camel_case_types)] struct UpdateFieldValidationSvc( pub Arc, ); impl< T: TableValidationService, > tonic::server::UnaryService for UpdateFieldValidationSvc { type Response = super::UpdateFieldValidationResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::update_field_validation( &inner, request, ) .await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = UpdateFieldValidationSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/komp_ac.table_validation.TableValidationService/ReplaceTableValidation" => { #[allow(non_camel_case_types)] struct ReplaceTableValidationSvc( pub Arc, ); impl< T: TableValidationService, > tonic::server::UnaryService for ReplaceTableValidationSvc { type Response = super::ReplaceTableValidationResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::replace_table_validation( &inner, request, ) .await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = ReplaceTableValidationSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/komp_ac.table_validation.TableValidationService/UpsertValidationRule" => { #[allow(non_camel_case_types)] struct UpsertValidationRuleSvc( pub Arc, ); impl< T: TableValidationService, > tonic::server::UnaryService for UpsertValidationRuleSvc { type Response = super::UpsertValidationRuleResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::upsert_validation_rule( &inner, request, ) .await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = UpsertValidationRuleSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/komp_ac.table_validation.TableValidationService/ListValidationRules" => { #[allow(non_camel_case_types)] struct ListValidationRulesSvc(pub Arc); impl< T: TableValidationService, > tonic::server::UnaryService for ListValidationRulesSvc { type Response = super::ListValidationRulesResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::list_validation_rules( &inner, request, ) .await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = ListValidationRulesSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/komp_ac.table_validation.TableValidationService/DeleteValidationRule" => { #[allow(non_camel_case_types)] struct DeleteValidationRuleSvc( pub Arc, ); impl< T: TableValidationService, > tonic::server::UnaryService for DeleteValidationRuleSvc { type Response = super::DeleteValidationRuleResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::delete_validation_rule( &inner, request, ) .await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = DeleteValidationRuleSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/komp_ac.table_validation.TableValidationService/UpsertValidationSet" => { #[allow(non_camel_case_types)] struct UpsertValidationSetSvc(pub Arc); impl< T: TableValidationService, > tonic::server::UnaryService for UpsertValidationSetSvc { type Response = super::UpsertValidationSetResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::upsert_validation_set( &inner, request, ) .await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = UpsertValidationSetSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/komp_ac.table_validation.TableValidationService/ListValidationSets" => { #[allow(non_camel_case_types)] struct ListValidationSetsSvc(pub Arc); impl< T: TableValidationService, > tonic::server::UnaryService for ListValidationSetsSvc { type Response = super::ListValidationSetsResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::list_validation_sets( &inner, request, ) .await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = ListValidationSetsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/komp_ac.table_validation.TableValidationService/DeleteValidationSet" => { #[allow(non_camel_case_types)] struct DeleteValidationSetSvc(pub Arc); impl< T: TableValidationService, > tonic::server::UnaryService for DeleteValidationSetSvc { type Response = super::DeleteValidationSetResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::delete_validation_set( &inner, request, ) .await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = DeleteValidationSetSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/komp_ac.table_validation.TableValidationService/ApplyValidationSet" => { #[allow(non_camel_case_types)] struct ApplyValidationSetSvc(pub Arc); impl< T: TableValidationService, > tonic::server::UnaryService for ApplyValidationSetSvc { type Response = super::ApplyValidationSetResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::apply_validation_set( &inner, request, ) .await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = ApplyValidationSetSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/komp_ac.table_validation.TableValidationService/LockFieldValidation" => { #[allow(non_camel_case_types)] struct LockFieldValidationSvc(pub Arc); impl< T: TableValidationService, > tonic::server::UnaryService for LockFieldValidationSvc { type Response = super::LockFieldValidationResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::lock_field_validation( &inner, request, ) .await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = LockFieldValidationSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } _ => { Box::pin(async move { let mut response = http::Response::new( tonic::body::Body::default(), ); let headers = response.headers_mut(); headers .insert( tonic::Status::GRPC_STATUS, (tonic::Code::Unimplemented as i32).into(), ); headers .insert( http::header::CONTENT_TYPE, tonic::metadata::GRPC_CONTENT_TYPE, ); Ok(response) }) } } } } impl Clone for TableValidationServiceServer { fn clone(&self) -> Self { let inner = self.inner.clone(); Self { inner, accept_compression_encodings: self.accept_compression_encodings, send_compression_encodings: self.send_compression_encodings, max_decoding_message_size: self.max_decoding_message_size, max_encoding_message_size: self.max_encoding_message_size, } } } /// Generated gRPC service name pub const SERVICE_NAME: &str = "komp_ac.table_validation.TableValidationService"; impl tonic::server::NamedService for TableValidationServiceServer { const NAME: &'static str = SERVICE_NAME; } }