// This file is @generated by prost-build. /// Request to create or update a script bound to a specific table and column. #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct PostTableScriptRequest { /// Required. The metadata ID from table_definitions.id that identifies the /// table this script belongs to. The table must exist; its schema determines /// where referenced tables/columns are validated and where dependencies are stored. #[prost(int64, tag = "1")] pub table_definition_id: i64, /// Required. The target column in the target table that this script computes. /// Must be an existing user-defined column in that table (not a system column). /// System columns are reserved: "id", "deleted", "created_at", "row_revision". /// The column's data type must NOT be one of the prohibited target types: /// BIGINT, DATE, TIMESTAMPTZ /// Note: BOOLEAN targets are allowed (values are converted to Steel #true/#false). #[prost(string, tag = "2")] pub target_column: ::prost::alloc::string::String, /// Required. The script in the Steel DSL (S-expression style). /// Syntax requirements: /// /// * Non-empty, must start with '(' /// * Balanced parentheses /// /// Referencing data: /// /// * Structured table/column access (enforces link constraints): /// (steel_get_column "table_name" "column_name") /// • current-table references are read directly from the active row /// • other tables require an explicit link from the source table /// (table_definition_links) or the request fails /// * Related collections use allowlisted aggregate shorthand: /// @sum(table.column), @min(table.column), @max(table.column), /// @count(table.column), @count_distinct(table.column), /// @any(table.boolean), @all(table.boolean), /// @count_rows(table via anchor), @exists(table via anchor) /// Every related aggregate requires the `via anchor` clause. The related /// table must be reachable through that anchor by an unambiguous FK path; /// the path may span multiple FK hops. /// * Raw SQL access is not supported; steel_query_sql is rejected /// /// Math operations: /// /// * The script is transformed by steel_decimal; supported math forms include: /// +, -, \*, /, ^, \*\*, pow, sqrt, >, \<, =, >=, \<=, min, max, abs, round, /// ln, log, log10, exp, sin, cos, tan /// * Columns of the following types CANNOT be used inside math expressions: /// BIGINT, TEXT, BOOLEAN, DATE, TIMESTAMPTZ /// /// Dependency tracking and cycles: /// /// * Dependencies are extracted from steel_get_column calls and stored /// in script_dependencies with context /// * Cycles across tables are rejected (self-dependency is allowed) #[prost(string, tag = "3")] pub script: ::prost::alloc::string::String, /// Optional. Free-text description stored alongside the script (no functional effect). #[prost(string, tag = "4")] pub description: ::prost::alloc::string::String, } /// Response after creating or updating a script. #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct TableScriptResponse { /// The ID of the script record in table_scripts (new or existing on upsert). #[prost(int64, tag = "1")] pub id: i64, /// Human-readable warnings concatenated into a single string. Possible messages: /// /// * Warning if the script references itself (may affect first population) /// * Info about number of structured linked-table accesses /// * Warning if many dependencies may affect performance #[prost(string, tag = "2")] pub warnings: ::prost::alloc::string::String, } #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct GetTableScriptsRequest { /// Required. Profile (schema) name. #[prost(string, tag = "1")] pub profile_name: ::prost::alloc::string::String, /// Required. Table name within the profile. #[prost(string, tag = "2")] pub table_name: ::prost::alloc::string::String, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetTableScriptsResponse { /// Scripts and dependency allowlists used to configure the client Steel runtime. #[prost(message, repeated, tag = "1")] pub scripts: ::prost::alloc::vec::Vec, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct StoredTableScript { /// Persistent script identifier. #[prost(int64, tag = "1")] pub id: i64, /// Display-name key of the current-table field populated by this script. #[prost(string, tag = "2")] pub target_column: ::prost::alloc::string::String, /// Logical type used by the client to validate and convert the result. #[prost(string, tag = "3")] pub target_column_type: ::prost::alloc::string::String, /// Validated and transformed Steel expression executed by the client for /// immediate feedback and by the server for authoritative persistence. #[prost(string, tag = "4")] pub script: ::prost::alloc::string::String, #[prost(string, tag = "5")] pub description: ::prost::alloc::string::String, /// Complete allowlist of data inputs that may be exposed to this script. #[prost(message, repeated, tag = "6")] pub dependencies: ::prost::alloc::vec::Vec, /// Whether changes to dependency rows trigger authoritative server propagation. #[prost(bool, tag = "7")] pub recompute_on_dependency_change: bool, } #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct ScriptDependency { /// Logical table name referenced by the script. #[prost(string, tag = "1")] pub target_table: ::prost::alloc::string::String, /// Normalized dependency kind, such as column_access or related_aggregate. #[prost(string, tag = "2")] pub dependency_type: ::prost::alloc::string::String, /// Logical column name. Empty for aggregates that operate on rows only. #[prost(string, tag = "3")] pub column: ::prost::alloc::string::String, /// Aggregate operation name, such as sum, count_rows, or exists; empty for /// column_access dependencies. #[prost(string, tag = "5")] pub operation: ::prost::alloc::string::String, /// Relationship table used to match the owner row to the related collection. #[prost(string, tag = "6")] pub via_table: ::prost::alloc::string::String, } /// Identifies the active form row whose external Steel inputs must be hydrated. #[derive(Clone, PartialEq, ::prost::Message)] pub struct HydrateScriptDependenciesRequest { /// Required profile/database schema containing the scripted table. #[prost(string, tag = "1")] pub profile_name: ::prost::alloc::string::String, /// Required logical name of the table owning the scripts. #[prost(string, tag = "2")] pub table_name: ::prost::alloc::string::String, /// Persisted owner-row ID, or zero for a new unsaved row. #[prost(int64, tag = "3")] pub row_id: i64, /// Complete current client form snapshot keyed by logical column name. /// It contains unsaved current-table values and related foreign keys such as /// "customer_id". The server uses it to resolve related rows and new-row /// aggregate semantics; it is not an arbitrary dependency request. #[prost(map = "string, string", tag = "4")] pub row_data: ::std::collections::HashMap< ::prost::alloc::string::String, ::prost::alloc::string::String, >, } /// One declared cross-table column input for the client Steel context. #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct HydratedColumnValue { /// Logical related-table name used by steel_get_column. #[prost(string, tag = "1")] pub target_table: ::prost::alloc::string::String, /// Related row from which the value was loaded. #[prost(int64, tag = "2")] pub row_id: i64, /// Logical column name used by steel_get_column. #[prost(string, tag = "3")] pub column: ::prost::alloc::string::String, /// String-encoded database value. An empty string represents NULL/empty input. #[prost(string, tag = "4")] pub value: ::prost::alloc::string::String, /// Logical database type used to create a typed client ScriptValue. #[prost(string, tag = "5")] pub field_type: ::prost::alloc::string::String, /// Related table's base currency for MONEY values; otherwise empty. #[prost(string, tag = "6")] pub base_currency: ::prost::alloc::string::String, } /// One declared related-collection aggregate input for the client Steel context. #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct HydratedAggregateValue { /// Normalized aggregate operation: sum, min, max, count, count_distinct, /// any, all, count_rows, or exists. #[prost(string, tag = "1")] pub operation: ::prost::alloc::string::String, /// Logical table whose related rows were aggregated. #[prost(string, tag = "2")] pub target_table: ::prost::alloc::string::String, /// Logical aggregated column; empty for count_rows and exists. #[prost(string, tag = "3")] pub column: ::prost::alloc::string::String, /// Relationship anchor used to distinguish aggregate dependency paths. #[prost(string, tag = "4")] pub via_table: ::prost::alloc::string::String, /// String-encoded aggregate result. #[prost(string, tag = "5")] pub value: ::prost::alloc::string::String, /// Logical source-column type; empty for row-only aggregates. #[prost(string, tag = "6")] pub field_type: ::prost::alloc::string::String, /// Aggregate table's base currency for MONEY values; otherwise empty. #[prost(string, tag = "7")] pub base_currency: ::prost::alloc::string::String, } /// Complete external dependency snapshot for client-side Steel execution. #[derive(Clone, PartialEq, ::prost::Message)] pub struct HydrateScriptDependenciesResponse { /// Exact related-column inputs declared by stored scripts. #[prost(message, repeated, tag = "1")] pub columns: ::prost::alloc::vec::Vec, /// Exact related aggregate inputs declared by stored scripts. #[prost(message, repeated, tag = "2")] pub aggregates: ::prost::alloc::vec::Vec, } /// Generated client implementations. pub mod table_script_client { #![allow( unused_variables, dead_code, missing_docs, clippy::wildcard_imports, clippy::let_unit_value, )] use tonic::codegen::*; use tonic::codegen::http::Uri; /// Manages column-computation scripts for user-defined tables and supplies the /// dependency data used by the client-side Steel runtime. /// Each script belongs to a single table (table_definition_id) and populates /// exactly one target column in that table. The server: /// /// * Validates script syntax (non-empty, balanced parentheses, starts with '(') /// * Validates the target column (exists, not a system column, allowed type) /// * Validates column/type usage inside math expressions /// * Validates referenced tables/columns against the schema /// * Enforces link constraints for structured access (see notes below) /// * Analyzes dependencies and prevents cycles across the schema /// * Transforms the script to decimal-safe math (steel_decimal) /// * Upserts into table_scripts and records dependencies in script_dependencies /// * Hydrates external column and aggregate inputs requested by the client /// /// The client fetches stored scripts and their declared dependencies, builds a /// restricted Steel context, and executes scripts for immediate form feedback. /// Current-table values come from the client's active row snapshot. External /// values must come from HydrateScriptDependencies; the client must not query /// arbitrary database data from inside the Steel VM. /// /// Server-side persistence remains authoritative and recalculates affected rows. /// Script creation and update are transactional. #[derive(Debug, Clone)] pub struct TableScriptClient { inner: tonic::client::Grpc, } impl TableScriptClient { /// 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 TableScriptClient 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, ) -> TableScriptClient> 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, { TableScriptClient::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 } /// Create or update a script for a specific table and target column. /// /// Behavior: /// /// * Fetches the table by table_definition_id (must exist) /// * Validates "script" (syntax), "target_column" (exists and type rules), /// and all referenced tables/columns (must exist in same schema) /// * Validates math operations: prohibits using certain data types in math /// * Enforces link constraints for structured table access: /// • Allowed always: self-references (same table) /// • Structured access via steel_get_column /// requires an explicit link in table_definition_links /// * Rejects raw SQL access; steel_query_sql is not part of the supported DSL /// * Detects and rejects circular dependencies across all scripts in the schema /// (self-references are allowed and not treated as cycles) /// * Transforms the script to decimal-safe operations (steel_decimal) /// * UPSERTS into table_scripts on (table_definitions_id, target_column) /// and saves a normalized dependency list into script_dependencies pub async fn post_table_script( &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_prost::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/komp_ac.table_script.TableScript/PostTableScript", ); let mut req = request.into_request(); req.extensions_mut() .insert( GrpcMethod::new( "komp_ac.table_script.TableScript", "PostTableScript", ), ); self.inner.unary(req, path, codec).await } /// Fetch all stored scripts for a specific table. /// /// Behavior: /// /// * Resolves the table from (profile_name, table_name) /// * Returns the stored, transformed script from table_scripts /// * Includes normalized dependency metadata from script_dependencies /// * Returns an empty scripts list when the table has no scripts /// /// Client use: /// /// * Registers each client-evaluable script with the computed-field runtime /// * Uses dependencies as the allowlist for values exposed to the Steel VM /// * Uses target_column_type to validate and convert the script result pub async fn get_table_scripts( &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_prost::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/komp_ac.table_script.TableScript/GetTableScripts", ); let mut req = request.into_request(); req.extensions_mut() .insert( GrpcMethod::new( "komp_ac.table_script.TableScript", "GetTableScripts", ), ); self.inner.unary(req, path, codec).await } /// Build the external data snapshot needed to execute a table's scripts in /// the client-side Steel runtime. /// /// The server derives the required inputs from stored script_dependencies; /// callers do not choose arbitrary tables or columns. Direct related-column /// reads and related aggregates are evaluated through SQLx in one read-only /// PostgreSQL snapshot. Returned values include logical type and currency /// metadata so the client can create correctly typed ScriptValues. /// /// Current-table column values are intentionally not returned. The client /// supplies those directly from row_data so unsaved edits participate in /// immediate calculations. The response replaces the client's previous /// script dependency cache as one complete hydration snapshot. pub async fn hydrate_script_dependencies( &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_prost::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/komp_ac.table_script.TableScript/HydrateScriptDependencies", ); let mut req = request.into_request(); req.extensions_mut() .insert( GrpcMethod::new( "komp_ac.table_script.TableScript", "HydrateScriptDependencies", ), ); self.inner.unary(req, path, codec).await } } } /// Generated server implementations. pub mod table_script_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 TableScriptServer. #[async_trait] pub trait TableScript: std::marker::Send + std::marker::Sync + 'static { /// Create or update a script for a specific table and target column. /// /// Behavior: /// /// * Fetches the table by table_definition_id (must exist) /// * Validates "script" (syntax), "target_column" (exists and type rules), /// and all referenced tables/columns (must exist in same schema) /// * Validates math operations: prohibits using certain data types in math /// * Enforces link constraints for structured table access: /// • Allowed always: self-references (same table) /// • Structured access via steel_get_column /// requires an explicit link in table_definition_links /// * Rejects raw SQL access; steel_query_sql is not part of the supported DSL /// * Detects and rejects circular dependencies across all scripts in the schema /// (self-references are allowed and not treated as cycles) /// * Transforms the script to decimal-safe operations (steel_decimal) /// * UPSERTS into table_scripts on (table_definitions_id, target_column) /// and saves a normalized dependency list into script_dependencies async fn post_table_script( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; /// Fetch all stored scripts for a specific table. /// /// Behavior: /// /// * Resolves the table from (profile_name, table_name) /// * Returns the stored, transformed script from table_scripts /// * Includes normalized dependency metadata from script_dependencies /// * Returns an empty scripts list when the table has no scripts /// /// Client use: /// /// * Registers each client-evaluable script with the computed-field runtime /// * Uses dependencies as the allowlist for values exposed to the Steel VM /// * Uses target_column_type to validate and convert the script result async fn get_table_scripts( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; /// Build the external data snapshot needed to execute a table's scripts in /// the client-side Steel runtime. /// /// The server derives the required inputs from stored script_dependencies; /// callers do not choose arbitrary tables or columns. Direct related-column /// reads and related aggregates are evaluated through SQLx in one read-only /// PostgreSQL snapshot. Returned values include logical type and currency /// metadata so the client can create correctly typed ScriptValues. /// /// Current-table column values are intentionally not returned. The client /// supplies those directly from row_data so unsaved edits participate in /// immediate calculations. The response replaces the client's previous /// script dependency cache as one complete hydration snapshot. async fn hydrate_script_dependencies( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; } /// Manages column-computation scripts for user-defined tables and supplies the /// dependency data used by the client-side Steel runtime. /// Each script belongs to a single table (table_definition_id) and populates /// exactly one target column in that table. The server: /// /// * Validates script syntax (non-empty, balanced parentheses, starts with '(') /// * Validates the target column (exists, not a system column, allowed type) /// * Validates column/type usage inside math expressions /// * Validates referenced tables/columns against the schema /// * Enforces link constraints for structured access (see notes below) /// * Analyzes dependencies and prevents cycles across the schema /// * Transforms the script to decimal-safe math (steel_decimal) /// * Upserts into table_scripts and records dependencies in script_dependencies /// * Hydrates external column and aggregate inputs requested by the client /// /// The client fetches stored scripts and their declared dependencies, builds a /// restricted Steel context, and executes scripts for immediate form feedback. /// Current-table values come from the client's active row snapshot. External /// values must come from HydrateScriptDependencies; the client must not query /// arbitrary database data from inside the Steel VM. /// /// Server-side persistence remains authoritative and recalculates affected rows. /// Script creation and update are transactional. #[derive(Debug)] pub struct TableScriptServer { inner: Arc, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, max_decoding_message_size: Option, max_encoding_message_size: Option, } impl TableScriptServer { 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 TableScriptServer where T: TableScript, 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_script.TableScript/PostTableScript" => { #[allow(non_camel_case_types)] struct PostTableScriptSvc(pub Arc); impl< T: TableScript, > tonic::server::UnaryService for PostTableScriptSvc { type Response = super::TableScriptResponse; 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 { ::post_table_script(&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 = PostTableScriptSvc(inner); let codec = tonic_prost::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_script.TableScript/GetTableScripts" => { #[allow(non_camel_case_types)] struct GetTableScriptsSvc(pub Arc); impl< T: TableScript, > tonic::server::UnaryService for GetTableScriptsSvc { type Response = super::GetTableScriptsResponse; 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_scripts(&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 = GetTableScriptsSvc(inner); let codec = tonic_prost::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_script.TableScript/HydrateScriptDependencies" => { #[allow(non_camel_case_types)] struct HydrateScriptDependenciesSvc(pub Arc); impl< T: TableScript, > tonic::server::UnaryService< super::HydrateScriptDependenciesRequest, > for HydrateScriptDependenciesSvc { type Response = super::HydrateScriptDependenciesResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request< super::HydrateScriptDependenciesRequest, >, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::hydrate_script_dependencies( &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 = HydrateScriptDependenciesSvc(inner); let codec = tonic_prost::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 TableScriptServer { 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_script.TableScript"; impl tonic::server::NamedService for TableScriptServer { const NAME: &'static str = SERVICE_NAME; } }