Compare commits

...

3 Commits

Author SHA1 Message Date
Priec
42181499fe canvas has more advanced suggestions for the textarea now 2026-04-25 22:18:51 +02:00
Priec
36249739d3 sync 2026-04-23 00:10:58 +02:00
Priec
bbd7c29681 frontend using steel engine 2026-04-22 18:20:14 +02:00
8 changed files with 187 additions and 22 deletions

26
Cargo.lock generated
View File

@@ -493,7 +493,7 @@ checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a"
[[package]]
name = "canvas"
version = "0.5.10"
version = "0.6.0"
dependencies = [
"anyhow",
"async-trait",
@@ -585,7 +585,7 @@ dependencies = [
[[package]]
name = "client"
version = "0.5.10"
version = "0.6.0"
dependencies = [
"anyhow",
"async-trait",
@@ -599,9 +599,12 @@ dependencies = [
"prost 0.13.5",
"prost-types 0.13.5",
"ratatui",
"regex",
"rstest",
"serde",
"serde_json",
"steel-core",
"steel-decimal",
"strum 0.27.2",
"strum_macros 0.27.2",
"time",
@@ -611,7 +614,6 @@ dependencies = [
"tonic",
"tracing",
"tracing-subscriber",
"tui-textarea",
"unicode-segmentation",
"unicode-width 0.2.0",
"uuid",
@@ -638,7 +640,7 @@ dependencies = [
[[package]]
name = "common"
version = "0.5.10"
version = "0.6.0"
dependencies = [
"prost 0.13.5",
"prost-build 0.14.1",
@@ -3092,7 +3094,7 @@ checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b"
[[package]]
name = "search"
version = "0.5.10"
version = "0.6.0"
dependencies = [
"anyhow",
"common",
@@ -3191,7 +3193,7 @@ dependencies = [
[[package]]
name = "server"
version = "0.5.10"
version = "0.6.0"
dependencies = [
"anyhow",
"bcrypt",
@@ -4411,18 +4413,6 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e78122066b0cb818b8afd08f7ed22f7fdbc3e90815035726f0840d0d26c0747a"
[[package]]
name = "tui-textarea"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a5318dd619ed73c52a9417ad19046724effc1287fb75cdcc4eca1d6ac1acbae"
dependencies = [
"crossterm",
"ratatui",
"regex",
"unicode-width 0.2.0",
]
[[package]]
name = "typed-arena"
version = "2.0.2"

View File

@@ -5,7 +5,7 @@ resolver = "2"
[workspace.package]
# TODO: idk how to do the name, fix later
# name = "komp_ac"
version = "0.5.10"
version = "0.6.2"
edition = "2021"
license = "GPL-3.0-or-later"
authors = ["Filip Priečinský <filippriec@gmail.com>"]

2
canvas

Submodule canvas updated: 172bbdf876...812ac2a428

2
client

Submodule client updated: 1703a1d045...2494066140

View File

@@ -33,6 +33,15 @@ service TableScript {
// - UPSERTS into table_scripts on (table_definitions_id, target_column)
// and saves a normalized dependency list into script_dependencies
rpc PostTableScript(PostTableScriptRequest) returns (TableScriptResponse);
// 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
rpc GetTableScripts(GetTableScriptsRequest) returns (GetTableScriptsResponse);
}
// Request to create or update a script bound to a specific table and column.
@@ -99,3 +108,32 @@ message TableScriptResponse {
// - Warning if many dependencies may affect performance
string warnings = 2;
}
message GetTableScriptsRequest {
// Required. Profile (schema) name.
string profile_name = 1;
// Required. Table name within the profile.
string table_name = 2;
}
message GetTableScriptsResponse {
repeated StoredTableScript scripts = 1;
}
message StoredTableScript {
int64 id = 1;
string target_column = 2;
string target_column_type = 3;
string script = 4;
string description = 5;
repeated ScriptDependency dependencies = 6;
}
message ScriptDependency {
string target_table = 1;
string dependency_type = 2;
string column = 3;
int64 index = 4;
string query_fragment = 5;
}

Binary file not shown.

View File

@@ -68,6 +68,48 @@ pub struct TableScriptResponse {
#[prost(string, tag = "2")]
pub warnings: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::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 {
#[prost(message, repeated, tag = "1")]
pub scripts: ::prost::alloc::vec::Vec<StoredTableScript>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StoredTableScript {
#[prost(int64, tag = "1")]
pub id: i64,
#[prost(string, tag = "2")]
pub target_column: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub target_column_type: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub script: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub description: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "6")]
pub dependencies: ::prost::alloc::vec::Vec<ScriptDependency>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ScriptDependency {
#[prost(string, tag = "1")]
pub target_table: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub dependency_type: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub column: ::prost::alloc::string::String,
#[prost(int64, tag = "4")]
pub index: i64,
#[prost(string, tag = "5")]
pub query_fragment: ::prost::alloc::string::String,
}
/// Generated client implementations.
pub mod table_script_client {
#![allow(
@@ -217,6 +259,42 @@ pub mod table_script_client {
);
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
pub async fn get_table_scripts(
&mut self,
request: impl tonic::IntoRequest<super::GetTableScriptsRequest>,
) -> std::result::Result<
tonic::Response<super::GetTableScriptsResponse>,
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_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
}
}
}
/// Generated server implementations.
@@ -256,6 +334,20 @@ pub mod table_script_server {
tonic::Response<super::TableScriptResponse>,
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
async fn get_table_scripts(
&self,
request: tonic::Request<super::GetTableScriptsRequest>,
) -> std::result::Result<
tonic::Response<super::GetTableScriptsResponse>,
tonic::Status,
>;
}
/// Manages column-computation scripts for user-defined tables.
/// Each script belongs to a single table (table_definition_id) and populates
@@ -390,6 +482,51 @@ pub mod table_script_server {
};
Box::pin(fut)
}
"/komp_ac.table_script.TableScript/GetTableScripts" => {
#[allow(non_camel_case_types)]
struct GetTableScriptsSvc<T: TableScript>(pub Arc<T>);
impl<
T: TableScript,
> tonic::server::UnaryService<super::GetTableScriptsRequest>
for GetTableScriptsSvc<T> {
type Response = super::GetTableScriptsResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::GetTableScriptsRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TableScript>::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::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(

2
server

Submodule server updated: d21e08c823...6b0c3e63b4