diff --git a/client b/client index 6da324a..07c6efc 160000 --- a/client +++ b/client @@ -1 +1 @@ -Subproject commit 6da324a924df6c2a4917c2085e83816e9b464702 +Subproject commit 07c6efcc22a738dd422ddb19883737e2953e92f1 diff --git a/common/proto/table_script.proto b/common/proto/table_script.proto index 7cb680a..6dc01ff 100644 --- a/common/proto/table_script.proto +++ b/common/proto/table_script.proto @@ -42,6 +42,9 @@ service TableScript { // - Includes normalized dependency metadata from script_dependencies // - Returns an empty scripts list when the table has no scripts rpc GetTableScripts(GetTableScriptsRequest) returns (GetTableScriptsResponse); + + rpc GetScriptDependencyValues(GetScriptDependencyValuesRequest) + returns (GetScriptDependencyValuesResponse); } // Request to create or update a script bound to a specific table and column. @@ -140,3 +143,22 @@ message ScriptDependency { // Relationship table used to match the owner row to the related collection. string via_table = 6; } + +message GetScriptDependencyValuesRequest { + string profile_name = 1; + string table_name = 2; + int64 row_id = 3; + map row_data = 4; +} + +message ScriptDependencyValue { + string operation = 1; + string target_table = 2; + string column = 3; + string via_table = 4; + string value = 5; +} + +message GetScriptDependencyValuesResponse { + repeated ScriptDependencyValue values = 1; +} diff --git a/common/src/proto/descriptor.bin b/common/src/proto/descriptor.bin index d174007..2f4c5cf 100644 Binary files a/common/src/proto/descriptor.bin and b/common/src/proto/descriptor.bin differ diff --git a/common/src/proto/komp_ac.table_script.rs b/common/src/proto/komp_ac.table_script.rs index ca5cd46..e7a0596 100644 --- a/common/src/proto/komp_ac.table_script.rs +++ b/common/src/proto/komp_ac.table_script.rs @@ -119,6 +119,38 @@ pub struct ScriptDependency { #[prost(string, tag = "6")] pub via_table: ::prost::alloc::string::String, } +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetScriptDependencyValuesRequest { + #[prost(string, tag = "1")] + pub profile_name: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub table_name: ::prost::alloc::string::String, + #[prost(int64, tag = "3")] + pub row_id: i64, + #[prost(map = "string, string", tag = "4")] + pub row_data: ::std::collections::HashMap< + ::prost::alloc::string::String, + ::prost::alloc::string::String, + >, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct ScriptDependencyValue { + #[prost(string, tag = "1")] + pub operation: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub target_table: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub column: ::prost::alloc::string::String, + #[prost(string, tag = "4")] + pub via_table: ::prost::alloc::string::String, + #[prost(string, tag = "5")] + pub value: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetScriptDependencyValuesResponse { + #[prost(message, repeated, tag = "1")] + pub values: ::prost::alloc::vec::Vec, +} /// Generated client implementations. pub mod table_script_client { #![allow( @@ -307,6 +339,35 @@ pub mod table_script_client { ); self.inner.unary(req, path, codec).await } + pub async fn get_script_dependency_values( + &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/GetScriptDependencyValues", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "komp_ac.table_script.TableScript", + "GetScriptDependencyValues", + ), + ); + self.inner.unary(req, path, codec).await + } } } /// Generated server implementations. @@ -362,6 +423,13 @@ pub mod table_script_server { tonic::Response, tonic::Status, >; + async fn get_script_dependency_values( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; } /// Manages column-computation scripts for user-defined tables. /// Each script belongs to a single table (table_definition_id) and populates @@ -542,6 +610,58 @@ pub mod table_script_server { }; Box::pin(fut) } + "/komp_ac.table_script.TableScript/GetScriptDependencyValues" => { + #[allow(non_camel_case_types)] + struct GetScriptDependencyValuesSvc(pub Arc); + impl< + T: TableScript, + > tonic::server::UnaryService< + super::GetScriptDependencyValuesRequest, + > for GetScriptDependencyValuesSvc { + type Response = super::GetScriptDependencyValuesResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + super::GetScriptDependencyValuesRequest, + >, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::get_script_dependency_values( + &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 = GetScriptDependencyValuesSvc(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( diff --git a/server b/server index 1bbb78b..a7af82a 160000 --- a/server +++ b/server @@ -1 +1 @@ -Subproject commit 1bbb78b494af32a13b6ab039d635df1cdae3cf6e +Subproject commit a7af82a5dd8c3cc349e5d5de3325d339799cfffb