diff --git a/client b/client index c617cd36..819a4b63 160000 --- a/client +++ b/client @@ -1 +1 @@ -Subproject commit c617cd362de2a0fff4208103ca1ae912cc9ab164 +Subproject commit 819a4b6300c34e749efc14a25eca92e2c5c61e78 diff --git a/common/proto/table_definition.proto b/common/proto/table_definition.proto index 35a71436..37342892 100644 --- a/common/proto/table_definition.proto +++ b/common/proto/table_definition.proto @@ -27,6 +27,10 @@ service TableDefinition { // This provides a tree-like overview of table relationships. rpc GetProfileTree(komp_ac.common.Empty) returns (ProfileTreeResponse); + // Lists the tables visible in one data-entry scope. When profile_name is + // absent, only global tables are returned. + rpc GetTableCatalog(GetTableCatalogRequest) returns (GetTableCatalogResponse); + // Lists every column type a table may declare, along with the SQL type it // maps to. Pure data retrieval - no business logic. rpc ListColumnTypes(komp_ac.common.Empty) returns (ListColumnTypesResponse); @@ -260,6 +264,15 @@ message ProfileTreeResponse { repeated Profile profiles = 1; } +message GetTableCatalogRequest { + // Selected profile. Omit this field to request the global-only scope. + optional string profile_name = 1; +} + +message GetTableCatalogResponse { + repeated ProfileTreeResponse.Table tables = 1; +} + // Request to fetch all tables, columns and scripts for a profile. message GetProfileDetailsRequest { // Profile (schema) name to fetch details for. diff --git a/common/src/proto/descriptor.bin b/common/src/proto/descriptor.bin index 5ede8012..b5beab0d 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_definition.rs b/common/src/proto/komp_ac.table_definition.rs index c8c6d77f..cd1b0a52 100644 --- a/common/src/proto/komp_ac.table_definition.rs +++ b/common/src/proto/komp_ac.table_definition.rs @@ -234,6 +234,17 @@ pub mod profile_tree_response { pub tables: ::prost::alloc::vec::Vec, } } +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct GetTableCatalogRequest { + /// Selected profile. Omit this field to request the global-only scope. + #[prost(string, optional, tag = "1")] + pub profile_name: ::core::option::Option<::prost::alloc::string::String>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetTableCatalogResponse { + #[prost(message, repeated, tag = "1")] + pub tables: ::prost::alloc::vec::Vec, +} /// Request to fetch all tables, columns and scripts for a profile. #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct GetProfileDetailsRequest { @@ -750,6 +761,37 @@ pub mod table_definition_client { ); self.inner.unary(req, path, codec).await } + /// Lists the tables visible in one data-entry scope. When profile_name is + /// absent, only global tables are returned. + pub async fn get_table_catalog( + &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_definition.TableDefinition/GetTableCatalog", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "komp_ac.table_definition.TableDefinition", + "GetTableCatalog", + ), + ); + self.inner.unary(req, path, codec).await + } /// Lists every column type a table may declare, along with the SQL type it /// maps to. Pure data retrieval - no business logic. pub async fn list_column_types( @@ -985,6 +1027,15 @@ pub mod table_definition_server { tonic::Response, tonic::Status, >; + /// Lists the tables visible in one data-entry scope. When profile_name is + /// absent, only global tables are returned. + async fn get_table_catalog( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; /// Lists every column type a table may declare, along with the SQL type it /// maps to. Pure data retrieval - no business logic. async fn list_column_types( @@ -1309,6 +1360,52 @@ pub mod table_definition_server { }; Box::pin(fut) } + "/komp_ac.table_definition.TableDefinition/GetTableCatalog" => { + #[allow(non_camel_case_types)] + struct GetTableCatalogSvc(pub Arc); + impl< + T: TableDefinition, + > tonic::server::UnaryService + for GetTableCatalogSvc { + type Response = super::GetTableCatalogResponse; + 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_catalog(&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 = GetTableCatalogSvc(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_definition.TableDefinition/ListColumnTypes" => { #[allow(non_camel_case_types)] struct ListColumnTypesSvc(pub Arc); diff --git a/server b/server index 2bfe955a..32b38e5a 160000 --- a/server +++ b/server @@ -1 +1 @@ -Subproject commit 2bfe955a8d4a65736ecbc0ea7513689819812c3d +Subproject commit 32b38e5a5bb6a3e1a794ecb7fdcf426cbb2dec27