Compare commits

..

14 Commits

Author SHA1 Message Date
Priec
ee509b6041 server pg backup 2026-06-29 01:00:18 +02:00
Priec
293165d4a2 translations at client are done now 2026-06-27 16:43:50 +02:00
Priec
999886834d import 2026-06-22 21:59:16 +02:00
Priec
0853b12df4 cursor api fixed, forms page is ready 2026-06-22 17:41:57 +02:00
Priec
a8c49575d3 chore: update submodule pointers for v0.8.12 (canvas, pages) and v0.8.13 (client) 2026-06-22 16:56:14 +02:00
Priec
670f9575ee theme finished partly 2026-06-19 23:00:50 +02:00
Priec
fa2d03b19e version v0.8.8 bump - closer to stabilizing pages api and implementing more features soon 2026-06-17 23:06:03 +02:00
Priec
32d593de55 better readme, finally working everything 2026-06-10 22:28:59 +02:00
Priec
9b6e594d2f common build.rs migration bug fixed 2026-06-10 19:49:41 +02:00
Priec
617f18f331 working upgraded 2026-06-10 18:08:19 +02:00
Priec
5481d1cb13 moving towards upgraded crates 2026-06-10 17:22:42 +02:00
Priec
40ad0db13f bumping up versions safely 2026-06-10 13:44:51 +02:00
Priec
ed1d4be61b flake update and resolver update 2026-06-10 13:39:19 +02:00
Priec
394cd863e4 edition 2024 2026-06-10 13:26:51 +02:00
27 changed files with 3773 additions and 1763 deletions

3680
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,12 +1,12 @@
[workspace]
members = ["client", "server", "common", "search", "tui-canvas", "tui-canvas/tui-canvas-validation-core", "tui-pages" ]
resolver = "2"
resolver = "3"
[workspace.package]
# TODO: idk how to do the name, fix later
# name = "komp_ac"
version = "0.8.1"
edition = "2021"
version = "0.8.12"
edition = "2024"
license = "GPL-3.0-or-later"
authors = ["Filip Priečinský <filippriec@gmail.com>"]
description = "Poriadny uctovnicky software."
@@ -20,36 +20,46 @@ categories = ["command-line-interface"]
[workspace.dependencies]
# Async and gRPC
tokio = { version = "1.44.2", features = ["full"] }
tonic = "0.13.0"
prost = "0.13.5"
async-trait = "0.1.88"
prost-types = "0.13.0"
tokio = { version = "1.52.3", features = ["full"] }
tonic = "0.14.6"
prost = "0.14.4"
async-trait = "0.1.89"
prost-types = "0.14.4"
# Data Handling & Serialization
serde = { version = "1.0.219", features = ["derive"] }
serde_json = "1.0.140"
time = "0.3.41"
serde = { version = "1.0.228", features = ["derive"] }
serde_json = "1.0.150"
time = "0.3.47"
# Utilities & Error Handling
anyhow = "1.0.98"
anyhow = "1.0.102"
dotenvy = "0.15.7"
lazy_static = "1.5.0"
tracing = "0.1.41"
tracing = "0.1.44"
# Search crate
tantivy = "0.24.1"
tantivy = "0.26.1"
# Steel_decimal crate
rust_decimal = { version = "1.37.2", features = ["maths", "serde"] }
rust_decimal_macros = "1.37.1"
thiserror = "2.0.12"
regex = "1.11.1"
rust_decimal = { version = "1.42.0", features = ["maths", "serde"] }
rust_decimal_macros = "1.40.0"
thiserror = "2.0.18"
regex = "1.12.4"
# Canvas crate
ratatui = { version = "0.29.0", features = ["crossterm"] }
crossterm = "0.28.1"
toml = "0.8.20"
unicode-width = "0.2.0"
ratatui = { version = "0.30.1", features = ["crossterm"] }
crossterm = "0.29.0"
toml = "1.1.2"
unicode-width = "0.2.2"
# Fuzzy matching (picker)
nucleo = "0.5.0"
common = { path = "./common" }
# Build against the in-tree tui-pages / tui-canvas (the source for the published
# crates) so local fixes take effect without a crates.io release. The published
# versions remain the declared dependency; this only redirects the source.
[patch.crates-io]
tui-pages = { path = "tui-pages" }
tui-canvas = { path = "tui-canvas" }

View File

@@ -1,20 +1,38 @@
# Hey
# komp_ac
This is only work in progress, until release 1.0.0 this is for development use cases only.
TUI accounting system. Client/server application with two extracted open-source
libraries.
I run development like this:
## Crates
| Crate | What | Published |
|-------|------|-----------|
| `client` | TUI application, uses `tui-pages` + `tui-canvas` | No - GPLv3 |
| `server` | Backend, gRPC services | No - AGPLv3 |
| `common` | Shared protobuf types | No - GPLv3 |
| `search` | Full-text search (Tantivy) | No - AGPLv3 |
| [`tui-pages`](https://crates.io/crates/tui-pages) | Multi-page TUI navigation framework | Yes — MIT, [docs](https://tui-pages.farmeris.sk) |
| [`tui-canvas`](https://crates.io/crates/tui-canvas) | Form / textarea / text input TUI widgets | Yes — MIT |
| `tui-canvas-validation-core` | Validation primitives for `tui-canvas` | Yes — MIT |
## Development
Server and client:
Server:
```
cargo watch -x 'run --package server -- server'
```
Client:
```
cargo watch --why -x 'run --package server -- server'
cargo watch -x 'run --package client -- client'
```
Client with tracing:
```
cargo run --package client --features ui-debug -- client
cargo watch -x 'run --package client --features ui-debug -- client'
```
## License
Application code (server, search): AGPL-3.0-or-later.
Application code (client, common): GPL-3.0-or-later.
Libraries (tui-canvas, tui-pages, tui-canvas-validation-core): MIT.

2
client

Submodule client updated: 3515acae03...89e87d71ab

View File

@@ -7,14 +7,16 @@ license.workspace = true
[dependencies]
prost-types = { workspace = true }
tonic = "0.13.0"
prost = "0.13.5"
serde = { version = "1.0.219", features = ["derive"] }
tonic = "0.14.6"
prost = "0.14.4"
serde = { version = "1.0.228", features = ["derive"] }
# Search
tantivy = { workspace = true }
serde_json.workspace = true
tonic-prost = "0.14.6"
[build-dependencies]
tonic-build = { version = "0.13.0", features = ["prost-build"] }
prost-build = "0.14.1"
tonic-build = { version = "0.14.6" }
prost-build = "0.14.4"
tonic-prost-build = "0.14.6"

View File

@@ -1,5 +1,5 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
tonic_build::configure()
tonic_prost_build::configure()
.build_server(true)
.file_descriptor_set_path("src/proto/descriptor.bin")
.out_dir("src/proto")
@@ -206,6 +206,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
"proto/common.proto",
"proto/adresar.proto",
"proto/auth.proto",
"proto/backup.proto",
"proto/search.proto",
"proto/search2.proto",
"proto/table_definition.proto",
@@ -217,5 +218,30 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
],
&["proto"],
)?;
// Scope build-script reruns to the actual inputs. Without this, the script
// emits no `rerun-if-changed` directives, so Cargo reruns it whenever any
// file in the package changes. Since codegen writes into `src/proto/`, that
// self-write retriggers the script on every build (an infinite loop under
// `cargo watch`). tonic_build 0.13 emitted these automatically; 0.14
// (tonic_prost_build) no longer does.
println!("cargo:rerun-if-changed=build.rs");
for proto in [
"proto/common.proto",
"proto/adresar.proto",
"proto/auth.proto",
"proto/backup.proto",
"proto/search.proto",
"proto/search2.proto",
"proto/table_definition.proto",
"proto/table_script.proto",
"proto/table_structure.proto",
"proto/table_validation.proto",
"proto/tables_data.proto",
"proto/uctovnictvo.proto",
] {
println!("cargo:rerun-if-changed={proto}");
}
Ok(())
}

67
common/proto/backup.proto Normal file
View File

@@ -0,0 +1,67 @@
syntax = "proto3";
package komp_ac.backup;
import "common.proto";
service BackupService {
rpc StartBackup(StartBackupRequest) returns (BackupOperationResponse);
rpc StartCheck(komp_ac.common.Empty) returns (BackupOperationResponse);
rpc GetBackupInfo(komp_ac.common.Empty) returns (BackupInfoResponse);
rpc GetOperationStatus(GetOperationStatusRequest) returns (BackupOperationResponse);
rpc RestoreLatest(RestoreLatestRequest) returns (BackupOperationResponse);
rpc RestoreTarget(RestoreTargetRequest) returns (BackupOperationResponse);
}
enum BackupType {
BACKUP_TYPE_UNSPECIFIED = 0;
BACKUP_TYPE_FULL = 1;
BACKUP_TYPE_DIFF = 2;
BACKUP_TYPE_INCR = 3;
}
enum OperationKind {
OPERATION_KIND_UNSPECIFIED = 0;
OPERATION_KIND_BACKUP = 1;
OPERATION_KIND_CHECK = 2;
OPERATION_KIND_RESTORE = 3;
}
enum OperationStatus {
OPERATION_STATUS_UNSPECIFIED = 0;
OPERATION_STATUS_RUNNING = 1;
OPERATION_STATUS_SUCCEEDED = 2;
OPERATION_STATUS_FAILED = 3;
}
message StartBackupRequest {
BackupType backup_type = 1;
}
message RestoreLatestRequest {
string confirmation = 1;
}
message RestoreTargetRequest {
string confirmation = 1;
string target_type = 2;
string target = 3;
}
message GetOperationStatusRequest {
string operation_id = 1;
}
message BackupOperationResponse {
string operation_id = 1;
OperationKind kind = 2;
OperationStatus status = 3;
string message = 4;
string output = 5;
int64 started_at_unix_seconds = 6;
int64 finished_at_unix_seconds = 7;
}
message BackupInfoResponse {
bool success = 1;
string output = 2;
}

View File

@@ -10,6 +10,9 @@ pub mod proto {
pub mod auth {
include!("proto/komp_ac.auth.rs");
}
pub mod backup {
include!("proto/komp_ac.backup.rs");
}
pub mod common {
include!("proto/komp_ac.common.rs");
}

Binary file not shown.

View File

@@ -1,15 +1,15 @@
// This file is @generated by prost-build.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetAdresarRequest {
#[prost(int64, tag = "1")]
pub id: i64,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DeleteAdresarRequest {
#[prost(int64, tag = "1")]
pub id: i64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PostAdresarRequest {
#[prost(string, tag = "1")]
pub firma: ::prost::alloc::string::String,
@@ -42,7 +42,7 @@ pub struct PostAdresarRequest {
#[prost(string, tag = "15")]
pub fax: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AdresarResponse {
#[prost(int64, tag = "1")]
pub id: i64,
@@ -77,7 +77,7 @@ pub struct AdresarResponse {
#[prost(string, tag = "16")]
pub fax: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PutAdresarRequest {
#[prost(int64, tag = "1")]
pub id: i64,
@@ -112,7 +112,7 @@ pub struct PutAdresarRequest {
#[prost(string, tag = "16")]
pub fax: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DeleteAdresarResponse {
#[prost(bool, tag = "1")]
pub success: bool,
@@ -223,7 +223,7 @@ pub mod adresar_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.adresar.Adresar/PostAdresar",
);
@@ -247,7 +247,7 @@ pub mod adresar_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.adresar.Adresar/GetAdresar",
);
@@ -271,7 +271,7 @@ pub mod adresar_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.adresar.Adresar/PutAdresar",
);
@@ -295,7 +295,7 @@ pub mod adresar_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.adresar.Adresar/DeleteAdresar",
);
@@ -319,7 +319,7 @@ pub mod adresar_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.adresar.Adresar/GetAdresarCount",
);
@@ -343,7 +343,7 @@ pub mod adresar_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.adresar.Adresar/GetAdresarByPosition",
);
@@ -506,7 +506,7 @@ pub mod adresar_server {
let inner = self.inner.clone();
let fut = async move {
let method = PostAdresarSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
@@ -551,7 +551,7 @@ pub mod adresar_server {
let inner = self.inner.clone();
let fut = async move {
let method = GetAdresarSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
@@ -596,7 +596,7 @@ pub mod adresar_server {
let inner = self.inner.clone();
let fut = async move {
let method = PutAdresarSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
@@ -641,7 +641,7 @@ pub mod adresar_server {
let inner = self.inner.clone();
let fut = async move {
let method = DeleteAdresarSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
@@ -686,7 +686,7 @@ pub mod adresar_server {
let inner = self.inner.clone();
let fut = async move {
let method = GetAdresarCountSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
@@ -734,7 +734,7 @@ pub mod adresar_server {
let inner = self.inner.clone();
let fut = async move {
let method = GetAdresarByPositionSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,

View File

@@ -1,5 +1,5 @@
// This file is @generated by prost-build.
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct RegisterRequest {
#[prost(string, tag = "1")]
pub username: ::prost::alloc::string::String,
@@ -12,7 +12,7 @@ pub struct RegisterRequest {
#[prost(string, tag = "5")]
pub role: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AuthResponse {
/// UUID in string format
#[prost(string, tag = "1")]
@@ -27,7 +27,7 @@ pub struct AuthResponse {
#[prost(string, tag = "4")]
pub role: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct LoginRequest {
/// Can be username or email
#[prost(string, tag = "1")]
@@ -35,7 +35,7 @@ pub struct LoginRequest {
#[prost(string, tag = "2")]
pub password: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct LoginResponse {
/// JWT token
#[prost(string, tag = "1")]
@@ -158,7 +158,7 @@ pub mod auth_service_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.auth.AuthService/Register",
);
@@ -179,7 +179,7 @@ pub mod auth_service_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.auth.AuthService/Login",
);
@@ -318,7 +318,7 @@ pub mod auth_service_server {
let inner = self.inner.clone();
let fut = async move {
let method = RegisterSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
@@ -361,7 +361,7 @@ pub mod auth_service_server {
let inner = self.inner.clone();
let fut = async move {
let method = LoginSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,

View File

@@ -0,0 +1,833 @@
// This file is @generated by prost-build.
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct StartBackupRequest {
#[prost(enumeration = "BackupType", tag = "1")]
pub backup_type: i32,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct RestoreLatestRequest {
#[prost(string, tag = "1")]
pub confirmation: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct RestoreTargetRequest {
#[prost(string, tag = "1")]
pub confirmation: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub target_type: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub target: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetOperationStatusRequest {
#[prost(string, tag = "1")]
pub operation_id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct BackupOperationResponse {
#[prost(string, tag = "1")]
pub operation_id: ::prost::alloc::string::String,
#[prost(enumeration = "OperationKind", tag = "2")]
pub kind: i32,
#[prost(enumeration = "OperationStatus", tag = "3")]
pub status: i32,
#[prost(string, tag = "4")]
pub message: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub output: ::prost::alloc::string::String,
#[prost(int64, tag = "6")]
pub started_at_unix_seconds: i64,
#[prost(int64, tag = "7")]
pub finished_at_unix_seconds: i64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct BackupInfoResponse {
#[prost(bool, tag = "1")]
pub success: bool,
#[prost(string, tag = "2")]
pub output: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum BackupType {
Unspecified = 0,
Full = 1,
Diff = 2,
Incr = 3,
}
impl BackupType {
/// 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 => "BACKUP_TYPE_UNSPECIFIED",
Self::Full => "BACKUP_TYPE_FULL",
Self::Diff => "BACKUP_TYPE_DIFF",
Self::Incr => "BACKUP_TYPE_INCR",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"BACKUP_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
"BACKUP_TYPE_FULL" => Some(Self::Full),
"BACKUP_TYPE_DIFF" => Some(Self::Diff),
"BACKUP_TYPE_INCR" => Some(Self::Incr),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum OperationKind {
Unspecified = 0,
Backup = 1,
Check = 2,
Restore = 3,
}
impl OperationKind {
/// 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 => "OPERATION_KIND_UNSPECIFIED",
Self::Backup => "OPERATION_KIND_BACKUP",
Self::Check => "OPERATION_KIND_CHECK",
Self::Restore => "OPERATION_KIND_RESTORE",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"OPERATION_KIND_UNSPECIFIED" => Some(Self::Unspecified),
"OPERATION_KIND_BACKUP" => Some(Self::Backup),
"OPERATION_KIND_CHECK" => Some(Self::Check),
"OPERATION_KIND_RESTORE" => Some(Self::Restore),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum OperationStatus {
Unspecified = 0,
Running = 1,
Succeeded = 2,
Failed = 3,
}
impl OperationStatus {
/// 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 => "OPERATION_STATUS_UNSPECIFIED",
Self::Running => "OPERATION_STATUS_RUNNING",
Self::Succeeded => "OPERATION_STATUS_SUCCEEDED",
Self::Failed => "OPERATION_STATUS_FAILED",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"OPERATION_STATUS_UNSPECIFIED" => Some(Self::Unspecified),
"OPERATION_STATUS_RUNNING" => Some(Self::Running),
"OPERATION_STATUS_SUCCEEDED" => Some(Self::Succeeded),
"OPERATION_STATUS_FAILED" => Some(Self::Failed),
_ => None,
}
}
}
/// Generated client implementations.
pub mod backup_service_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct BackupServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl BackupServiceClient<tonic::transport::Channel> {
/// Attempt to create a new client by connecting to a given endpoint.
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> BackupServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + 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<F>(
inner: T,
interceptor: F,
) -> BackupServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
BackupServiceClient::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 start_backup(
&mut self,
request: impl tonic::IntoRequest<super::StartBackupRequest>,
) -> std::result::Result<
tonic::Response<super::BackupOperationResponse>,
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.backup.BackupService/StartBackup",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("komp_ac.backup.BackupService", "StartBackup"));
self.inner.unary(req, path, codec).await
}
pub async fn start_check(
&mut self,
request: impl tonic::IntoRequest<super::super::common::Empty>,
) -> std::result::Result<
tonic::Response<super::BackupOperationResponse>,
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.backup.BackupService/StartCheck",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("komp_ac.backup.BackupService", "StartCheck"));
self.inner.unary(req, path, codec).await
}
pub async fn get_backup_info(
&mut self,
request: impl tonic::IntoRequest<super::super::common::Empty>,
) -> std::result::Result<
tonic::Response<super::BackupInfoResponse>,
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.backup.BackupService/GetBackupInfo",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("komp_ac.backup.BackupService", "GetBackupInfo"),
);
self.inner.unary(req, path, codec).await
}
pub async fn get_operation_status(
&mut self,
request: impl tonic::IntoRequest<super::GetOperationStatusRequest>,
) -> std::result::Result<
tonic::Response<super::BackupOperationResponse>,
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.backup.BackupService/GetOperationStatus",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("komp_ac.backup.BackupService", "GetOperationStatus"),
);
self.inner.unary(req, path, codec).await
}
pub async fn restore_latest(
&mut self,
request: impl tonic::IntoRequest<super::RestoreLatestRequest>,
) -> std::result::Result<
tonic::Response<super::BackupOperationResponse>,
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.backup.BackupService/RestoreLatest",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("komp_ac.backup.BackupService", "RestoreLatest"),
);
self.inner.unary(req, path, codec).await
}
pub async fn restore_target(
&mut self,
request: impl tonic::IntoRequest<super::RestoreTargetRequest>,
) -> std::result::Result<
tonic::Response<super::BackupOperationResponse>,
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.backup.BackupService/RestoreTarget",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("komp_ac.backup.BackupService", "RestoreTarget"),
);
self.inner.unary(req, path, codec).await
}
}
}
/// Generated server implementations.
pub mod backup_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 BackupServiceServer.
#[async_trait]
pub trait BackupService: std::marker::Send + std::marker::Sync + 'static {
async fn start_backup(
&self,
request: tonic::Request<super::StartBackupRequest>,
) -> std::result::Result<
tonic::Response<super::BackupOperationResponse>,
tonic::Status,
>;
async fn start_check(
&self,
request: tonic::Request<super::super::common::Empty>,
) -> std::result::Result<
tonic::Response<super::BackupOperationResponse>,
tonic::Status,
>;
async fn get_backup_info(
&self,
request: tonic::Request<super::super::common::Empty>,
) -> std::result::Result<
tonic::Response<super::BackupInfoResponse>,
tonic::Status,
>;
async fn get_operation_status(
&self,
request: tonic::Request<super::GetOperationStatusRequest>,
) -> std::result::Result<
tonic::Response<super::BackupOperationResponse>,
tonic::Status,
>;
async fn restore_latest(
&self,
request: tonic::Request<super::RestoreLatestRequest>,
) -> std::result::Result<
tonic::Response<super::BackupOperationResponse>,
tonic::Status,
>;
async fn restore_target(
&self,
request: tonic::Request<super::RestoreTargetRequest>,
) -> std::result::Result<
tonic::Response<super::BackupOperationResponse>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct BackupServiceServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> BackupServiceServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> 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<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
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<T, B> tonic::codegen::Service<http::Request<B>> for BackupServiceServer<T>
where
T: BackupService,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/komp_ac.backup.BackupService/StartBackup" => {
#[allow(non_camel_case_types)]
struct StartBackupSvc<T: BackupService>(pub Arc<T>);
impl<
T: BackupService,
> tonic::server::UnaryService<super::StartBackupRequest>
for StartBackupSvc<T> {
type Response = super::BackupOperationResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::StartBackupRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as BackupService>::start_backup(&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 = StartBackupSvc(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.backup.BackupService/StartCheck" => {
#[allow(non_camel_case_types)]
struct StartCheckSvc<T: BackupService>(pub Arc<T>);
impl<
T: BackupService,
> tonic::server::UnaryService<super::super::common::Empty>
for StartCheckSvc<T> {
type Response = super::BackupOperationResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::super::common::Empty>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as BackupService>::start_check(&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 = StartCheckSvc(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.backup.BackupService/GetBackupInfo" => {
#[allow(non_camel_case_types)]
struct GetBackupInfoSvc<T: BackupService>(pub Arc<T>);
impl<
T: BackupService,
> tonic::server::UnaryService<super::super::common::Empty>
for GetBackupInfoSvc<T> {
type Response = super::BackupInfoResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::super::common::Empty>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as BackupService>::get_backup_info(&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 = GetBackupInfoSvc(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.backup.BackupService/GetOperationStatus" => {
#[allow(non_camel_case_types)]
struct GetOperationStatusSvc<T: BackupService>(pub Arc<T>);
impl<
T: BackupService,
> tonic::server::UnaryService<super::GetOperationStatusRequest>
for GetOperationStatusSvc<T> {
type Response = super::BackupOperationResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::GetOperationStatusRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as BackupService>::get_operation_status(&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 = GetOperationStatusSvc(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.backup.BackupService/RestoreLatest" => {
#[allow(non_camel_case_types)]
struct RestoreLatestSvc<T: BackupService>(pub Arc<T>);
impl<
T: BackupService,
> tonic::server::UnaryService<super::RestoreLatestRequest>
for RestoreLatestSvc<T> {
type Response = super::BackupOperationResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::RestoreLatestRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as BackupService>::restore_latest(&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 = RestoreLatestSvc(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.backup.BackupService/RestoreTarget" => {
#[allow(non_camel_case_types)]
struct RestoreTargetSvc<T: BackupService>(pub Arc<T>);
impl<
T: BackupService,
> tonic::server::UnaryService<super::RestoreTargetRequest>
for RestoreTargetSvc<T> {
type Response = super::BackupOperationResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::RestoreTargetRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as BackupService>::restore_target(&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 = RestoreTargetSvc(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<T> Clone for BackupServiceServer<T> {
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.backup.BackupService";
impl<T> tonic::server::NamedService for BackupServiceServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}

View File

@@ -1,12 +1,12 @@
// This file is @generated by prost-build.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Empty {}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CountResponse {
#[prost(int64, tag = "1")]
pub count: i64,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PositionRequest {
#[prost(int64, tag = "1")]
pub position: i64,

View File

@@ -1,5 +1,5 @@
// This file is @generated by prost-build.
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ColumnConstraint {
#[prost(string, tag = "1")]
pub column: ::prost::alloc::string::String,
@@ -173,7 +173,7 @@ pub mod searcher_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.search.Searcher/Search",
);
@@ -306,7 +306,7 @@ pub mod searcher_server {
let inner = self.inner.clone();
let fut = async move {
let method = SearchSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,

View File

@@ -17,7 +17,7 @@ pub struct Search2Request {
#[prost(bool, optional, tag = "7")]
pub order_desc: ::core::option::Option<bool>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ColumnFilter {
#[prost(string, tag = "1")]
pub column_name: ::prost::alloc::string::String,
@@ -39,7 +39,7 @@ pub struct Search2Response {
}
/// Nested message and enum types in `Search2Response`.
pub mod search2_response {
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Hit {
#[prost(int64, tag = "1")]
pub id: i64,
@@ -204,7 +204,7 @@ pub mod search2_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.search2.Search2/SearchTable",
);
@@ -337,7 +337,7 @@ pub mod search2_server {
let inner = self.inner.clone();
let fut = async move {
let method = SearchTableSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,

View File

@@ -1,10 +1,10 @@
// This file is @generated by prost-build.
/// A single link to another table within the same profile (schema).
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct TableLink {
/// Name of an existing table within the same profile to link to.
/// For each link, a "<linked>_id" column is created on the new table.
/// For each link, a "<linked>\_id" column is created on the new table.
/// That column references "<linked>"(id) and adds an index automatically.
#[prost(string, tag = "1")]
pub linked_table_name: ::prost::alloc::string::String,
@@ -20,12 +20,12 @@ pub struct TableLink {
pub struct PostTableDefinitionRequest {
/// Table name to create inside the target profile.
/// Must be lowercase, alphanumeric with underscores,
/// start with a letter, and be <= 63 chars.
/// Forbidden names: "id", "deleted", "created_at", or ending in "_id".
/// start with a letter, and be \<= 63 chars.
/// Forbidden names: "id", "deleted", "created_at", or ending in "\_id".
#[prost(string, tag = "1")]
pub table_name: ::prost::alloc::string::String,
/// List of links (foreign keys) to existing tables in the same profile.
/// Each will automatically get a "<linked>_id" column and an index.
/// Each will automatically get a "<linked>\_id" column and an index.
#[prost(message, repeated, tag = "2")]
pub links: ::prost::alloc::vec::Vec<TableLink>,
/// List of user-defined columns (adds to system/id/fk columns).
@@ -33,13 +33,13 @@ pub struct PostTableDefinitionRequest {
pub columns: ::prost::alloc::vec::Vec<ColumnDefinition>,
/// List of column names to be indexed (must match existing user-defined columns).
/// Indexes can target only user-defined columns; system columns ("id", "deleted",
/// "created_at") and automatically generated foreign key ("*_id") columns already
/// "created_at") and automatically generated foreign key ("\*\_id") columns already
/// have indexes. Requests trying to index those columns are rejected.
#[prost(string, repeated, tag = "4")]
pub indexes: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
/// Name of profile (Postgres schema) where the table will be created.
/// Same naming rules as table_name; cannot collide with reserved schemas
/// like "public", "information_schema", or ones starting with "pg_".
/// like "public", "information_schema", or ones starting with "pg\_".
#[prost(string, tag = "5")]
pub profile_name: ::prost::alloc::string::String,
}
@@ -62,22 +62,22 @@ pub struct AddTableColumnsRequest {
}
/// Describes one user-defined column for a table.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ColumnDefinition {
/// Column name that follows the same validation rules as table_name.
/// Must be lowercase, start with a letter, no uppercase characters,
/// and cannot be "id", "deleted", "created_at", or end with "_id".
/// and cannot be "id", "deleted", "created_at", or end with "\_id".
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// Logical column type. Supported values (case-insensitive):
/// TEXT / STRING
/// BOOLEAN
/// TIMESTAMP / TIMESTAMPTZ / TIME
/// MONEY (= NUMERIC(14,4))
/// INTEGER / INT
/// BIGINTEGER / BIGINT
/// DATE
/// DECIMAL(p,s) → NUMERIC(p,s)
/// TEXT / STRING
/// BOOLEAN
/// TIMESTAMP / TIMESTAMPTZ / TIME
/// MONEY (= NUMERIC(14,4))
/// INTEGER / INT
/// BIGINTEGER / BIGINT
/// DATE
/// DECIMAL(p,s) → NUMERIC(p,s)
/// DECIMAL args must be integers (no sign, no dot, no leading zeros);
/// s ≤ p and p ≥ 1.
#[prost(string, tag = "2")]
@@ -85,7 +85,7 @@ pub struct ColumnDefinition {
}
/// Response after table creation (success + DDL preview).
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct TableDefinitionResponse {
/// True if all DB changes and metadata inserts succeeded.
#[prost(bool, tag = "1")]
@@ -104,7 +104,7 @@ pub struct ProfileTreeResponse {
/// Nested message and enum types in `ProfileTreeResponse`.
pub mod profile_tree_response {
/// Table entry in a profile.
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Table {
/// Internal ID from table_definitions.id (metadata record).
#[prost(int64, tag = "1")]
@@ -128,7 +128,7 @@ pub mod profile_tree_response {
}
}
/// Request to fetch all tables, columns and scripts for a profile.
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetProfileDetailsRequest {
/// Profile (schema) name to fetch details for.
#[prost(string, tag = "1")]
@@ -144,7 +144,7 @@ pub struct GetProfileDetailsResponse {
}
/// Request to fetch recorded column alias rename history for one profile.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetColumnAliasRenameHistoryRequest {
#[prost(string, tag = "1")]
pub profile_name: ::prost::alloc::string::String,
@@ -154,7 +154,7 @@ pub struct GetColumnAliasRenameHistoryRequest {
}
/// One recorded column alias rename.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ColumnAliasRenameHistoryEntry {
#[prost(int64, tag = "1")]
pub id: i64,
@@ -193,7 +193,7 @@ pub struct TableDetail {
pub scripts: ::prost::alloc::vec::Vec<ScriptInfo>,
}
/// A script that targets a specific column in a table.
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ScriptInfo {
#[prost(int64, tag = "1")]
pub script_id: i64,
@@ -208,7 +208,7 @@ pub struct ScriptInfo {
}
/// Request to rename one user-visible column alias in a table.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct RenameColumnAliasRequest {
#[prost(string, tag = "1")]
pub profile_name: ::prost::alloc::string::String,
@@ -221,7 +221,7 @@ pub struct RenameColumnAliasRequest {
}
/// Response after renaming one column alias.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct RenameColumnAliasResponse {
#[prost(bool, tag = "1")]
pub success: bool,
@@ -229,7 +229,7 @@ pub struct RenameColumnAliasResponse {
pub message: ::prost::alloc::string::String,
}
/// Request to delete one table definition entirely.
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DeleteTableRequest {
/// Profile (schema) name owning the table (must exist).
#[prost(string, tag = "1")]
@@ -240,7 +240,7 @@ pub struct DeleteTableRequest {
pub table_name: ::prost::alloc::string::String,
}
/// Response after table deletion.
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DeleteTableResponse {
/// True if table and metadata were successfully deleted in one transaction.
#[prost(bool, tag = "1")]
@@ -362,7 +362,7 @@ pub mod table_definition_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.table_definition.TableDefinition/PostTableDefinition",
);
@@ -393,7 +393,7 @@ pub mod table_definition_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.table_definition.TableDefinition/AddTableColumns",
);
@@ -424,7 +424,7 @@ pub mod table_definition_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.table_definition.TableDefinition/GetProfileTree",
);
@@ -455,7 +455,7 @@ pub mod table_definition_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.table_definition.TableDefinition/GetProfileDetails",
);
@@ -485,7 +485,7 @@ pub mod table_definition_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.table_definition.TableDefinition/GetColumnAliasRenameHistory",
);
@@ -515,7 +515,7 @@ pub mod table_definition_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.table_definition.TableDefinition/RenameColumnAlias",
);
@@ -545,7 +545,7 @@ pub mod table_definition_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.table_definition.TableDefinition/DeleteTable",
);
@@ -750,7 +750,7 @@ pub mod table_definition_server {
let inner = self.inner.clone();
let fut = async move {
let method = PostTableDefinitionSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
@@ -796,7 +796,7 @@ pub mod table_definition_server {
let inner = self.inner.clone();
let fut = async move {
let method = AddTableColumnsSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
@@ -842,7 +842,7 @@ pub mod table_definition_server {
let inner = self.inner.clone();
let fut = async move {
let method = GetProfileTreeSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
@@ -888,7 +888,7 @@ pub mod table_definition_server {
let inner = self.inner.clone();
let fut = async move {
let method = GetProfileDetailsSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
@@ -942,7 +942,7 @@ pub mod table_definition_server {
let inner = self.inner.clone();
let fut = async move {
let method = GetColumnAliasRenameHistorySvc(inner);
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
@@ -988,7 +988,7 @@ pub mod table_definition_server {
let inner = self.inner.clone();
let fut = async move {
let method = RenameColumnAliasSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
@@ -1033,7 +1033,7 @@ pub mod table_definition_server {
let inner = self.inner.clone();
let fut = async move {
let method = DeleteTableSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,

View File

@@ -1,7 +1,7 @@
// 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, ::prost::Message)]
#[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
@@ -12,41 +12,45 @@ pub struct PostTableScriptRequest {
/// Must be an existing user-defined column in that table (not a system column).
/// System columns are reserved: "id", "deleted", "created_at".
/// The column's data type must NOT be one of the prohibited target types:
/// BIGINT, DATE, TIMESTAMPTZ
/// 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
///
/// * Non-empty, must start with '('
/// * Balanced parentheses
///
/// Referencing data:
/// - Structured table/column access (enforces link constraints):
/// (steel_get_column "table_name" "column_name")
/// (steel_get_column_with_index "table_name" index "column_name")
/// • index must be a non-negative integer literal
/// • self-references are allowed without links
/// • other tables require an explicit link from the source table
/// (table_definition_links) or the request fails
/// - Raw SQL access (no link required, but still validated):
/// (steel_query_sql "SELECT ...")
/// • Basic checks disallow operations that imply prohibited types,
/// e.g., EXTRACT(…), DATE_PART(…), ::DATE, ::TIMESTAMPTZ, ::BIGINT, CAST(…)
/// - Self variable access in transformed scripts:
/// (get-var "column_name") is treated as referencing the current table
///
/// * Structured table/column access (enforces link constraints):
/// (steel_get_column "table_name" "column_name")
/// (steel_get_column_with_index "table_name" index "column_name")
/// • index must be a non-negative integer literal
/// • self-references are allowed without links
/// • other tables require an explicit link from the source table
/// (table_definition_links) or the request fails
/// * Raw SQL access (no link required, but still validated):
/// (steel_query_sql "SELECT ...")
/// • Basic checks disallow operations that imply prohibited types,
/// e.g., EXTRACT(…), DATE_PART(…), ::DATE, ::TIMESTAMPTZ, ::BIGINT, CAST(…)
/// * Self variable access in transformed scripts:
/// (get-var "column_name") is treated as referencing the current table
///
/// 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
///
/// * 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(_with_index), get-var,
/// and steel_query_sql and stored in script_dependencies with context
/// - Cycles across tables are rejected (self-dependency is allowed)
///
/// * Dependencies are extracted from steel_get_column(\_with_index), get-var,
/// and steel_query_sql 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).
@@ -55,20 +59,21 @@ pub struct PostTableScriptRequest {
}
/// Response after creating or updating a script.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[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)
/// - Count of raw SQL queries present
/// - Info about number of structured linked-table accesses
/// - Warning if many dependencies may affect performance
///
/// * Warning if the script references itself (may affect first population)
/// * Count of raw SQL queries present
/// * 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, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetTableScriptsRequest {
/// Required. Profile (schema) name.
#[prost(string, tag = "1")]
@@ -97,7 +102,7 @@ pub struct StoredTableScript {
#[prost(message, repeated, tag = "6")]
pub dependencies: ::prost::alloc::vec::Vec<ScriptDependency>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ScriptDependency {
#[prost(string, tag = "1")]
pub target_table: ::prost::alloc::string::String,
@@ -124,15 +129,16 @@ pub mod table_script_client {
/// Manages column-computation scripts for user-defined tables.
/// 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
/// The whole operation is transactional.
///
/// * 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
/// The whole operation is transactional.
#[derive(Debug, Clone)]
pub struct TableScriptClient<T> {
inner: tonic::client::Grpc<T>,
@@ -216,20 +222,21 @@ pub mod table_script_client {
/// 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 / steel_get_column_with_index
/// requires an explicit link in table_definition_links
/// • Raw SQL access via steel_query_sql is permitted (still validated)
/// - 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
///
/// * 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 / steel_get_column_with_index
/// requires an explicit link in table_definition_links
/// • Raw SQL access via steel_query_sql is permitted (still validated)
/// * 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<super::PostTableScriptRequest>,
@@ -245,7 +252,7 @@ pub mod table_script_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.table_script.TableScript/PostTableScript",
);
@@ -262,10 +269,11 @@ pub mod table_script_client {
/// 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
///
/// * 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>,
@@ -281,7 +289,7 @@ pub mod table_script_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.table_script.TableScript/GetTableScripts",
);
@@ -313,20 +321,21 @@ pub mod table_script_server {
/// 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 / steel_get_column_with_index
/// requires an explicit link in table_definition_links
/// • Raw SQL access via steel_query_sql is permitted (still validated)
/// - 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
///
/// * 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 / steel_get_column_with_index
/// requires an explicit link in table_definition_links
/// • Raw SQL access via steel_query_sql is permitted (still validated)
/// * 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<super::PostTableScriptRequest>,
@@ -337,10 +346,11 @@ pub mod table_script_server {
/// 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
///
/// * 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>,
@@ -352,15 +362,16 @@ pub mod table_script_server {
/// Manages column-computation scripts for user-defined tables.
/// 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
/// The whole operation is transactional.
///
/// * 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
/// The whole operation is transactional.
#[derive(Debug)]
pub struct TableScriptServer<T> {
inner: Arc<T>,
@@ -467,7 +478,7 @@ pub mod table_script_server {
let inner = self.inner.clone();
let fut = async move {
let method = PostTableScriptSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
@@ -512,7 +523,7 @@ pub mod table_script_server {
let inner = self.inner.clone();
let fut = async move {
let method = GetTableScriptsSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,

View File

@@ -1,6 +1,6 @@
// This file is @generated by prost-build.
/// Request identifying the profile (schema) and tables to inspect.
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetTableStructureRequest {
/// Required. Profile (PostgreSQL schema) name. Must exist in `schemas`.
#[prost(string, tag = "1")]
@@ -26,24 +26,25 @@ pub struct GetTableStructureResponse {
pub struct TableStructureResponse {
/// Columns of the physical table, including system columns (id, deleted,
/// created_at), user-defined columns, and any foreign-key columns such as
/// "<linked_table>_id". May be empty if the physical table is missing.
/// "\<linked_table>\_id". May be empty if the physical table is missing.
#[prost(message, repeated, tag = "1")]
pub columns: ::prost::alloc::vec::Vec<TableColumn>,
}
/// One physical column entry as reported by information_schema.
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct TableColumn {
/// Column name exactly as defined in PostgreSQL.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// Normalized data type string derived from information_schema:
/// - VARCHAR(n) when udt_name='varchar' with character_maximum_length
/// - CHAR(n) when udt_name='bpchar' with character_maximum_length
/// - NUMERIC(p,s) when udt_name='numeric' with precision and scale
/// - NUMERIC(p) when udt_name='numeric' with precision only
/// - <TYPE>\[\] for array types (udt_name starting with '_', e.g., INT\[\] )
/// - Otherwise UPPER(udt_name), e.g., TEXT, BIGINT, TIMESTAMPTZ
/// Examples: "TEXT", "BIGINT", "VARCHAR(255)", "TIMESTAMPTZ", "NUMERIC(14,4)"
///
/// * VARCHAR(n) when udt_name='varchar' with character_maximum_length
/// * CHAR(n) when udt_name='bpchar' with character_maximum_length
/// * NUMERIC(p,s) when udt_name='numeric' with precision and scale
/// * NUMERIC(p) when udt_name='numeric' with precision only
/// * <TYPE>\[\] for array types (udt_name starting with '\_', e.g., INT\[\] )
/// * Otherwise UPPER(udt_name), e.g., TEXT, BIGINT, TIMESTAMPTZ
/// Examples: "TEXT", "BIGINT", "VARCHAR(255)", "TIMESTAMPTZ", "NUMERIC(14,4)"
#[prost(string, tag = "2")]
pub data_type: ::prost::alloc::string::String,
/// True if information_schema reports the column as nullable.
@@ -68,10 +69,11 @@ pub mod table_structure_service_client {
/// Introspects the physical PostgreSQL tables for one or more logical tables
/// (defined in table_definitions) and returns their column structures.
/// The server validates that:
/// - The profile (schema) exists in `schemas`
/// - Every table is defined for that profile in `table_definitions`
/// It then queries information_schema for the physical tables and returns
/// normalized column metadata.
///
/// * The profile (schema) exists in `schemas`
/// * Every table is defined for that profile in `table_definitions`
/// It then queries information_schema for the physical tables and returns
/// normalized column metadata.
#[derive(Debug, Clone)]
pub struct TableStructureServiceClient<T> {
inner: tonic::client::Grpc<T>,
@@ -156,12 +158,13 @@ pub mod table_structure_service_client {
/// nullability, primary key flag) for one or more tables in a profile.
///
/// Behavior:
/// - NOT_FOUND if profile doesn't exist in `schemas`
/// - NOT_FOUND if any table is not defined for that profile in `table_definitions`
/// - Queries information_schema.columns ordered by ordinal position
/// - Normalizes data_type text (details under TableColumn.data_type)
/// - Returns an error if any validated table has no visible columns in
/// information_schema (e.g., physical table missing)
///
/// * NOT_FOUND if profile doesn't exist in `schemas`
/// * NOT_FOUND if any table is not defined for that profile in `table_definitions`
/// * Queries information_schema.columns ordered by ordinal position
/// * Normalizes data_type text (details under TableColumn.data_type)
/// * Returns an error if any validated table has no visible columns in
/// information_schema (e.g., physical table missing)
pub async fn get_table_structure(
&mut self,
request: impl tonic::IntoRequest<super::GetTableStructureRequest>,
@@ -177,7 +180,7 @@ pub mod table_structure_service_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.table_structure.TableStructureService/GetTableStructure",
);
@@ -210,12 +213,13 @@ pub mod table_structure_service_server {
/// nullability, primary key flag) for one or more tables in a profile.
///
/// Behavior:
/// - NOT_FOUND if profile doesn't exist in `schemas`
/// - NOT_FOUND if any table is not defined for that profile in `table_definitions`
/// - Queries information_schema.columns ordered by ordinal position
/// - Normalizes data_type text (details under TableColumn.data_type)
/// - Returns an error if any validated table has no visible columns in
/// information_schema (e.g., physical table missing)
///
/// * NOT_FOUND if profile doesn't exist in `schemas`
/// * NOT_FOUND if any table is not defined for that profile in `table_definitions`
/// * Queries information_schema.columns ordered by ordinal position
/// * Normalizes data_type text (details under TableColumn.data_type)
/// * Returns an error if any validated table has no visible columns in
/// information_schema (e.g., physical table missing)
async fn get_table_structure(
&self,
request: tonic::Request<super::GetTableStructureRequest>,
@@ -227,10 +231,11 @@ pub mod table_structure_service_server {
/// Introspects the physical PostgreSQL tables for one or more logical tables
/// (defined in table_definitions) and returns their column structures.
/// The server validates that:
/// - The profile (schema) exists in `schemas`
/// - Every table is defined for that profile in `table_definitions`
/// It then queries information_schema for the physical tables and returns
/// normalized column metadata.
///
/// * The profile (schema) exists in `schemas`
/// * Every table is defined for that profile in `table_definitions`
/// It then queries information_schema for the physical tables and returns
/// normalized column metadata.
#[derive(Debug)]
pub struct TableStructureServiceServer<T> {
inner: Arc<T>,
@@ -342,7 +347,7 @@ pub mod table_structure_service_server {
let inner = self.inner.clone();
let fut = async move {
let method = GetTableStructureSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,

View File

@@ -1,6 +1,6 @@
// This file is @generated by prost-build.
/// Request validation rules for a table
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetTableValidationRequest {
#[prost(string, tag = "1")]
pub profile_name: ::prost::alloc::string::String,
@@ -48,7 +48,7 @@ pub struct FieldValidation {
/// Character limit validation (Validation 1).
/// These rules map directly to canvas CharacterLimits.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::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).
@@ -68,7 +68,7 @@ pub struct CharacterLimits {
/// 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)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DisplayMask {
/// e.g., "(###) ###-####" or "####-##-##"
#[prost(string, tag = "1")]
@@ -76,7 +76,7 @@ pub struct DisplayMask {
/// e.g., "#"
#[prost(string, tag = "2")]
pub input_char: ::prost::alloc::string::String,
/// e.g., "_"
/// e.g., "\_"
#[prost(string, optional, tag = "3")]
pub template_char: ::core::option::Option<::prost::alloc::string::String>,
}
@@ -84,7 +84,7 @@ pub struct DisplayMask {
/// 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)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PatternPosition {
#[prost(enumeration = "PatternPositionKind", tag = "1")]
pub kind: i32,
@@ -100,7 +100,7 @@ pub struct PatternPosition {
/// 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)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CharacterConstraint {
#[prost(enumeration = "CharacterConstraintKind", tag = "1")]
pub kind: i32,
@@ -116,7 +116,7 @@ pub struct CharacterConstraint {
}
/// One position-based validation rule, similar to canvas PositionFilter.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PatternRule {
#[prost(message, optional, tag = "1")]
pub position: ::core::option::Option<PatternPosition>,
@@ -126,7 +126,7 @@ pub struct PatternRule {
/// Exact-value whitelist configuration.
/// This maps to canvas AllowedValues semantics.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AllowedValues {
#[prost(string, repeated, tag = "1")]
pub values: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
@@ -159,7 +159,7 @@ pub struct UpdateFieldValidationRequest {
pub validation: ::core::option::Option<FieldValidation>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct UpdateFieldValidationResponse {
#[prost(bool, tag = "1")]
pub success: bool,
@@ -178,7 +178,7 @@ pub struct ReplaceTableValidationRequest {
pub fields: ::prost::alloc::vec::Vec<FieldValidation>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ReplaceTableValidationResponse {
#[prost(bool, tag = "1")]
pub success: bool,
@@ -246,7 +246,7 @@ pub struct UpsertValidationRuleRequest {
pub rule: ::core::option::Option<ValidationRuleDefinition>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct UpsertValidationRuleResponse {
#[prost(bool, tag = "1")]
pub success: bool,
@@ -254,7 +254,7 @@ pub struct UpsertValidationRuleResponse {
pub message: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ListValidationRulesRequest {
#[prost(string, tag = "1")]
pub profile_name: ::prost::alloc::string::String,
@@ -266,7 +266,7 @@ pub struct ListValidationRulesResponse {
pub rules: ::prost::alloc::vec::Vec<ValidationRuleDefinition>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DeleteValidationRuleRequest {
#[prost(string, tag = "1")]
pub profile_name: ::prost::alloc::string::String,
@@ -274,7 +274,7 @@ pub struct DeleteValidationRuleRequest {
pub name: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DeleteValidationRuleResponse {
#[prost(bool, tag = "1")]
pub success: bool,
@@ -290,7 +290,7 @@ pub struct UpsertValidationSetRequest {
pub set: ::core::option::Option<ValidationSetDefinition>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct UpsertValidationSetResponse {
#[prost(bool, tag = "1")]
pub success: bool,
@@ -298,7 +298,7 @@ pub struct UpsertValidationSetResponse {
pub message: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ListValidationSetsRequest {
#[prost(string, tag = "1")]
pub profile_name: ::prost::alloc::string::String,
@@ -310,7 +310,7 @@ pub struct ListValidationSetsResponse {
pub sets: ::prost::alloc::vec::Vec<ValidationSetDefinition>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DeleteValidationSetRequest {
#[prost(string, tag = "1")]
pub profile_name: ::prost::alloc::string::String,
@@ -318,7 +318,7 @@ pub struct DeleteValidationSetRequest {
pub name: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DeleteValidationSetResponse {
#[prost(bool, tag = "1")]
pub success: bool,
@@ -326,7 +326,7 @@ pub struct DeleteValidationSetResponse {
pub message: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ApplyValidationSetRequest {
#[prost(string, tag = "1")]
pub profile_name: ::prost::alloc::string::String,
@@ -348,7 +348,7 @@ pub struct ApplyValidationSetResponse {
pub validation: ::core::option::Option<FieldValidation>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct LockFieldValidationRequest {
#[prost(string, tag = "1")]
pub profile_name: ::prost::alloc::string::String,
@@ -358,7 +358,7 @@ pub struct LockFieldValidationRequest {
pub data_key: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct LockFieldValidationResponse {
#[prost(bool, tag = "1")]
pub success: bool,
@@ -594,7 +594,7 @@ pub mod table_validation_service_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.table_validation.TableValidationService/GetTableValidation",
);
@@ -624,7 +624,7 @@ pub mod table_validation_service_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.table_validation.TableValidationService/UpdateFieldValidation",
);
@@ -654,7 +654,7 @@ pub mod table_validation_service_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.table_validation.TableValidationService/ReplaceTableValidation",
);
@@ -684,7 +684,7 @@ pub mod table_validation_service_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.table_validation.TableValidationService/UpsertValidationRule",
);
@@ -713,7 +713,7 @@ pub mod table_validation_service_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.table_validation.TableValidationService/ListValidationRules",
);
@@ -742,7 +742,7 @@ pub mod table_validation_service_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.table_validation.TableValidationService/DeleteValidationRule",
);
@@ -772,7 +772,7 @@ pub mod table_validation_service_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.table_validation.TableValidationService/UpsertValidationSet",
);
@@ -801,7 +801,7 @@ pub mod table_validation_service_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.table_validation.TableValidationService/ListValidationSets",
);
@@ -830,7 +830,7 @@ pub mod table_validation_service_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.table_validation.TableValidationService/DeleteValidationSet",
);
@@ -860,7 +860,7 @@ pub mod table_validation_service_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.table_validation.TableValidationService/ApplyValidationSet",
);
@@ -890,7 +890,7 @@ pub mod table_validation_service_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.table_validation.TableValidationService/LockFieldValidation",
);
@@ -1115,7 +1115,7 @@ pub mod table_validation_service_server {
let inner = self.inner.clone();
let fut = async move {
let method = GetTableValidationSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
@@ -1166,7 +1166,7 @@ pub mod table_validation_service_server {
let inner = self.inner.clone();
let fut = async move {
let method = UpdateFieldValidationSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
@@ -1217,7 +1217,7 @@ pub mod table_validation_service_server {
let inner = self.inner.clone();
let fut = async move {
let method = ReplaceTableValidationSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
@@ -1268,7 +1268,7 @@ pub mod table_validation_service_server {
let inner = self.inner.clone();
let fut = async move {
let method = UpsertValidationRuleSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
@@ -1317,7 +1317,7 @@ pub mod table_validation_service_server {
let inner = self.inner.clone();
let fut = async move {
let method = ListValidationRulesSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
@@ -1368,7 +1368,7 @@ pub mod table_validation_service_server {
let inner = self.inner.clone();
let fut = async move {
let method = DeleteValidationRuleSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
@@ -1417,7 +1417,7 @@ pub mod table_validation_service_server {
let inner = self.inner.clone();
let fut = async move {
let method = UpsertValidationSetSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
@@ -1466,7 +1466,7 @@ pub mod table_validation_service_server {
let inner = self.inner.clone();
let fut = async move {
let method = ListValidationSetsSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
@@ -1515,7 +1515,7 @@ pub mod table_validation_service_server {
let inner = self.inner.clone();
let fut = async move {
let method = DeleteValidationSetSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
@@ -1564,7 +1564,7 @@ pub mod table_validation_service_server {
let inner = self.inner.clone();
let fut = async move {
let method = ApplyValidationSetSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
@@ -1613,7 +1613,7 @@ pub mod table_validation_service_server {
let inner = self.inner.clone();
let fut = async move {
let method = LockFieldValidationSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,

View File

@@ -13,29 +13,33 @@ pub struct PostTableDataRequest {
/// Required. Key-value data for columns to insert.
///
/// Allowed keys:
/// - User-defined columns from the table definition
/// - System/FK columns:
/// • "deleted" (BOOLEAN), optional; default FALSE if not provided
/// • "<linked_table>_id" (BIGINT) for each table link
///
/// * User-defined columns from the table definition
/// * System/FK columns:
/// • "deleted" (BOOLEAN), optional; default FALSE if not provided
/// • "\<linked_table>\_id" (BIGINT) for each table link
///
/// Type expectations by SQL type:
/// - TEXT: string value; empty string is treated as NULL
/// - BOOLEAN: bool value
/// - TIMESTAMPTZ: ISO 8601/RFC 3339 string (parsed to TIMESTAMPTZ)
/// - INTEGER: number with no fractional part and within i32 range
/// - BIGINT: number with no fractional part and within i64 range
/// - NUMERIC(p,s): string representation only; empty string becomes NULL
/// (numbers for NUMERIC are rejected to avoid precision loss)
///
/// * TEXT: string value; empty string is treated as NULL
/// * BOOLEAN: bool value
/// * TIMESTAMPTZ: ISO 8601/RFC 3339 string (parsed to TIMESTAMPTZ)
/// * INTEGER: number with no fractional part and within i32 range
/// * BIGINT: number with no fractional part and within i64 range
/// * NUMERIC(p,s): string representation only; empty string becomes NULL
/// (numbers for NUMERIC are rejected to avoid precision loss)
///
/// Script validation rules:
/// - If a script exists for a target column, that column MUST be present here,
/// and its provided value MUST equal the scripts computed value (type-aware
/// comparison, e.g., decimals are compared numerically).
///
/// * If a script exists for a target column, that column MUST be present here,
/// and its provided value MUST equal the scripts computed value (type-aware
/// comparison, e.g., decimals are compared numerically).
///
/// Notes:
/// - Unknown/invalid column names are rejected
/// - Some application-specific validations may apply (e.g., max length for
/// certain fields like "telefon")
///
/// * Unknown/invalid column names are rejected
/// * Some application-specific validations may apply (e.g., max length for
/// certain fields like "telefon")
#[prost(map = "string, message", tag = "3")]
pub data: ::std::collections::HashMap<
::prost::alloc::string::String,
@@ -43,7 +47,7 @@ pub struct PostTableDataRequest {
>,
}
/// Insert response.
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PostTableDataResponse {
/// True if the insert succeeded.
#[prost(bool, tag = "1")]
@@ -106,11 +110,12 @@ pub struct PutTableDataRequest {
/// Required. Columns to update (same typing rules as PostTableDataRequest.data).
///
/// Special script rules:
/// - If a script targets column X and X is included here, the value for X must
/// equal the scripts result (type-aware).
/// - If X is not included here but the update would cause the scripts result
/// to change compared to the current stored value, the update is rejected with
/// FAILED_PRECONDITION, instructing the caller to include X explicitly.
///
/// * If a script targets column X and X is included here, the value for X must
/// equal the scripts result (type-aware).
/// * If X is not included here but the update would cause the scripts result
/// to change compared to the current stored value, the update is rejected with
/// FAILED_PRECONDITION, instructing the caller to include X explicitly.
///
/// Passing an empty map results in a no-op success response.
#[prost(map = "string, message", tag = "4")]
@@ -120,7 +125,7 @@ pub struct PutTableDataRequest {
>,
}
/// Update response.
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PutTableDataResponse {
/// True if the update succeeded (or no-op on empty data).
#[prost(bool, tag = "1")]
@@ -133,7 +138,7 @@ pub struct PutTableDataResponse {
pub updated_id: i64,
}
/// Soft-delete a single row.
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DeleteTableDataRequest {
/// Required. Profile (schema) name.
#[prost(string, tag = "1")]
@@ -146,14 +151,14 @@ pub struct DeleteTableDataRequest {
pub record_id: i64,
}
/// Soft-delete response.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DeleteTableDataResponse {
/// True if a row was marked deleted (id existed and was not already deleted).
#[prost(bool, tag = "1")]
pub success: bool,
}
/// Fetch a single non-deleted row by id.
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetTableDataRequest {
/// Required. Profile (schema) name.
#[prost(string, tag = "1")]
@@ -169,9 +174,10 @@ pub struct GetTableDataRequest {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetTableDataResponse {
/// Map of column_name → stringified value for:
/// - id, deleted
/// - all user-defined columns from the table definition
/// - FK columns named "<linked_table>_id" for each table link
///
/// * id, deleted
/// * all user-defined columns from the table definition
/// * FK columns named "\<linked_table>\_id" for each table link
///
/// All values are returned as TEXT via col::TEXT and COALESCEed to empty string
/// (NULL becomes ""). The row is returned only if deleted = FALSE.
@@ -182,7 +188,7 @@ pub struct GetTableDataResponse {
>,
}
/// Count non-deleted rows.
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetTableDataCountRequest {
/// Required. Profile (schema) name.
#[prost(string, tag = "1")]
@@ -192,7 +198,7 @@ pub struct GetTableDataCountRequest {
pub table_name: ::prost::alloc::string::String,
}
/// Fetch by ordinal position among non-deleted rows (1-based).
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetTableDataByPositionRequest {
/// Required. Profile (schema) name.
#[prost(string, tag = "1")]
@@ -303,13 +309,14 @@ pub mod tables_data_client {
/// Insert a new row into a table with strict type binding and script validation.
///
/// Behavior:
/// - Validates that profile (schema) exists and table is defined for it
/// - Validates provided columns exist (user-defined or allowed system/FK columns)
/// - For columns targeted by scripts in this table, the client MUST provide the
/// value, and it MUST equal the scripts calculated value (compared type-safely)
/// - Binds values with correct SQL types, rejects invalid formats/ranges
/// - Inserts the row and returns the new id; queues search indexing (best effort)
/// - If the physical table is missing but the definition exists, returns INTERNAL
///
/// * Validates that profile (schema) exists and table is defined for it
/// * Validates provided columns exist (user-defined or allowed system/FK columns)
/// * For columns targeted by scripts in this table, the client MUST provide the
/// value, and it MUST equal the scripts calculated value (compared type-safely)
/// * Binds values with correct SQL types, rejects invalid formats/ranges
/// * Inserts the row and returns the new id; queues search indexing (best effort)
/// * If the physical table is missing but the definition exists, returns INTERNAL
pub async fn post_table_data(
&mut self,
request: impl tonic::IntoRequest<super::PostTableDataRequest>,
@@ -325,7 +332,7 @@ pub mod tables_data_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.tables_data.TablesData/PostTableData",
);
@@ -339,12 +346,13 @@ pub mod tables_data_client {
/// Insert multiple rows by applying PostTableData behavior to each row.
///
/// Behavior:
/// - Accepts 1..10,000 rows in one gRPC request
/// - Processes rows in request order
/// - Each row is inserted through the same validation, script execution,
/// typed binding, database insert, and indexing path as PostTableData
/// - Stops at the first failing row and returns that row's gRPC error code
/// with row index context; rows inserted before the failure remain inserted
///
/// * Accepts 1..10,000 rows in one gRPC request
/// * Processes rows in request order
/// * Each row is inserted through the same validation, script execution,
/// typed binding, database insert, and indexing path as PostTableData
/// * Stops at the first failing row and returns that row's gRPC error code
/// with row index context; rows inserted before the failure remain inserted
pub async fn post_table_data_bulk(
&mut self,
request: impl tonic::IntoRequest<super::PostTableDataBulkRequest>,
@@ -360,7 +368,7 @@ pub mod tables_data_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.tables_data.TablesData/PostTableDataBulk",
);
@@ -377,14 +385,15 @@ pub mod tables_data_client {
/// Update existing row data with strict type binding and script validation.
///
/// Behavior:
/// - Validates profile and table, and that the record exists
/// - If request data is empty, returns success without changing the row
/// - For columns targeted by scripts:
/// • If included in update, provided value must equal the script result
/// • If not included, update must not cause the script result to differ
/// from the current stored value; otherwise FAILED_PRECONDITION is returned
/// - Binds values with correct SQL types; rejects invalid formats/ranges
/// - Updates the row and returns the id; queues search indexing (best effort)
///
/// * Validates profile and table, and that the record exists
/// * If request data is empty, returns success without changing the row
/// * For columns targeted by scripts:
/// • If included in update, provided value must equal the script result
/// • If not included, update must not cause the script result to differ
/// from the current stored value; otherwise FAILED_PRECONDITION is returned
/// * Binds values with correct SQL types; rejects invalid formats/ranges
/// * Updates the row and returns the id; queues search indexing (best effort)
pub async fn put_table_data(
&mut self,
request: impl tonic::IntoRequest<super::PutTableDataRequest>,
@@ -400,7 +409,7 @@ pub mod tables_data_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.tables_data.TablesData/PutTableData",
);
@@ -414,10 +423,11 @@ pub mod tables_data_client {
/// Soft-delete a single record (sets deleted = true) if it exists and is not already deleted.
///
/// Behavior:
/// - Validates profile and table definition
/// - Updates only rows with deleted = false
/// - success = true means a row was actually changed; false means nothing to delete
/// - If the physical table is missing but the definition exists, returns INTERNAL
///
/// * Validates profile and table definition
/// * Updates only rows with deleted = false
/// * success = true means a row was actually changed; false means nothing to delete
/// * If the physical table is missing but the definition exists, returns INTERNAL
pub async fn delete_table_data(
&mut self,
request: impl tonic::IntoRequest<super::DeleteTableDataRequest>,
@@ -433,7 +443,7 @@ pub mod tables_data_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.tables_data.TablesData/DeleteTableData",
);
@@ -447,12 +457,13 @@ pub mod tables_data_client {
/// Fetch a single non-deleted row by id as textified values.
///
/// Behavior:
/// - Validates profile and table definition
/// - Returns all columns as strings (COALESCE(col::TEXT, '') AS col)
/// including: id, deleted, all user-defined columns, and FK columns
/// named "<linked_table>_id" for each table link
/// - Fails with NOT_FOUND if record does not exist or is soft-deleted
/// - If the physical table is missing but the definition exists, returns INTERNAL
///
/// * Validates profile and table definition
/// * Returns all columns as strings (COALESCE(col::TEXT, '') AS col)
/// including: id, deleted, all user-defined columns, and FK columns
/// named "\<linked_table>\_id" for each table link
/// * Fails with NOT_FOUND if record does not exist or is soft-deleted
/// * If the physical table is missing but the definition exists, returns INTERNAL
pub async fn get_table_data(
&mut self,
request: impl tonic::IntoRequest<super::GetTableDataRequest>,
@@ -468,7 +479,7 @@ pub mod tables_data_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.tables_data.TablesData/GetTableData",
);
@@ -482,9 +493,10 @@ pub mod tables_data_client {
/// Count non-deleted rows in a table.
///
/// Behavior:
/// - Validates profile and table definition
/// - Returns komp_ac.common.CountResponse.count with rows where deleted = FALSE
/// - If the physical table is missing but the definition exists, returns INTERNAL
///
/// * Validates profile and table definition
/// * Returns komp_ac.common.CountResponse.count with rows where deleted = FALSE
/// * If the physical table is missing but the definition exists, returns INTERNAL
pub async fn get_table_data_count(
&mut self,
request: impl tonic::IntoRequest<super::GetTableDataCountRequest>,
@@ -500,7 +512,7 @@ pub mod tables_data_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.tables_data.TablesData/GetTableDataCount",
);
@@ -517,9 +529,10 @@ pub mod tables_data_client {
/// Fetch the N-th non-deleted row by id order (1-based), then return its full data.
///
/// Behavior:
/// - position is 1-based (position = 1 → first row by id ASC with deleted = FALSE)
/// - Returns NOT_FOUND if position is out of bounds
/// - Otherwise identical to GetTableData for the selected id
///
/// * position is 1-based (position = 1 → first row by id ASC with deleted = FALSE)
/// * Returns NOT_FOUND if position is out of bounds
/// * Otherwise identical to GetTableData for the selected id
pub async fn get_table_data_by_position(
&mut self,
request: impl tonic::IntoRequest<super::GetTableDataByPositionRequest>,
@@ -535,7 +548,7 @@ pub mod tables_data_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.tables_data.TablesData/GetTableDataByPosition",
);
@@ -567,13 +580,14 @@ pub mod tables_data_server {
/// Insert a new row into a table with strict type binding and script validation.
///
/// Behavior:
/// - Validates that profile (schema) exists and table is defined for it
/// - Validates provided columns exist (user-defined or allowed system/FK columns)
/// - For columns targeted by scripts in this table, the client MUST provide the
/// value, and it MUST equal the scripts calculated value (compared type-safely)
/// - Binds values with correct SQL types, rejects invalid formats/ranges
/// - Inserts the row and returns the new id; queues search indexing (best effort)
/// - If the physical table is missing but the definition exists, returns INTERNAL
///
/// * Validates that profile (schema) exists and table is defined for it
/// * Validates provided columns exist (user-defined or allowed system/FK columns)
/// * For columns targeted by scripts in this table, the client MUST provide the
/// value, and it MUST equal the scripts calculated value (compared type-safely)
/// * Binds values with correct SQL types, rejects invalid formats/ranges
/// * Inserts the row and returns the new id; queues search indexing (best effort)
/// * If the physical table is missing but the definition exists, returns INTERNAL
async fn post_table_data(
&self,
request: tonic::Request<super::PostTableDataRequest>,
@@ -584,12 +598,13 @@ pub mod tables_data_server {
/// Insert multiple rows by applying PostTableData behavior to each row.
///
/// Behavior:
/// - Accepts 1..10,000 rows in one gRPC request
/// - Processes rows in request order
/// - Each row is inserted through the same validation, script execution,
/// typed binding, database insert, and indexing path as PostTableData
/// - Stops at the first failing row and returns that row's gRPC error code
/// with row index context; rows inserted before the failure remain inserted
///
/// * Accepts 1..10,000 rows in one gRPC request
/// * Processes rows in request order
/// * Each row is inserted through the same validation, script execution,
/// typed binding, database insert, and indexing path as PostTableData
/// * Stops at the first failing row and returns that row's gRPC error code
/// with row index context; rows inserted before the failure remain inserted
async fn post_table_data_bulk(
&self,
request: tonic::Request<super::PostTableDataBulkRequest>,
@@ -600,14 +615,15 @@ pub mod tables_data_server {
/// Update existing row data with strict type binding and script validation.
///
/// Behavior:
/// - Validates profile and table, and that the record exists
/// - If request data is empty, returns success without changing the row
/// - For columns targeted by scripts:
/// • If included in update, provided value must equal the script result
/// • If not included, update must not cause the script result to differ
/// from the current stored value; otherwise FAILED_PRECONDITION is returned
/// - Binds values with correct SQL types; rejects invalid formats/ranges
/// - Updates the row and returns the id; queues search indexing (best effort)
///
/// * Validates profile and table, and that the record exists
/// * If request data is empty, returns success without changing the row
/// * For columns targeted by scripts:
/// • If included in update, provided value must equal the script result
/// • If not included, update must not cause the script result to differ
/// from the current stored value; otherwise FAILED_PRECONDITION is returned
/// * Binds values with correct SQL types; rejects invalid formats/ranges
/// * Updates the row and returns the id; queues search indexing (best effort)
async fn put_table_data(
&self,
request: tonic::Request<super::PutTableDataRequest>,
@@ -618,10 +634,11 @@ pub mod tables_data_server {
/// Soft-delete a single record (sets deleted = true) if it exists and is not already deleted.
///
/// Behavior:
/// - Validates profile and table definition
/// - Updates only rows with deleted = false
/// - success = true means a row was actually changed; false means nothing to delete
/// - If the physical table is missing but the definition exists, returns INTERNAL
///
/// * Validates profile and table definition
/// * Updates only rows with deleted = false
/// * success = true means a row was actually changed; false means nothing to delete
/// * If the physical table is missing but the definition exists, returns INTERNAL
async fn delete_table_data(
&self,
request: tonic::Request<super::DeleteTableDataRequest>,
@@ -632,12 +649,13 @@ pub mod tables_data_server {
/// Fetch a single non-deleted row by id as textified values.
///
/// Behavior:
/// - Validates profile and table definition
/// - Returns all columns as strings (COALESCE(col::TEXT, '') AS col)
/// including: id, deleted, all user-defined columns, and FK columns
/// named "<linked_table>_id" for each table link
/// - Fails with NOT_FOUND if record does not exist or is soft-deleted
/// - If the physical table is missing but the definition exists, returns INTERNAL
///
/// * Validates profile and table definition
/// * Returns all columns as strings (COALESCE(col::TEXT, '') AS col)
/// including: id, deleted, all user-defined columns, and FK columns
/// named "\<linked_table>\_id" for each table link
/// * Fails with NOT_FOUND if record does not exist or is soft-deleted
/// * If the physical table is missing but the definition exists, returns INTERNAL
async fn get_table_data(
&self,
request: tonic::Request<super::GetTableDataRequest>,
@@ -648,9 +666,10 @@ pub mod tables_data_server {
/// Count non-deleted rows in a table.
///
/// Behavior:
/// - Validates profile and table definition
/// - Returns komp_ac.common.CountResponse.count with rows where deleted = FALSE
/// - If the physical table is missing but the definition exists, returns INTERNAL
///
/// * Validates profile and table definition
/// * Returns komp_ac.common.CountResponse.count with rows where deleted = FALSE
/// * If the physical table is missing but the definition exists, returns INTERNAL
async fn get_table_data_count(
&self,
request: tonic::Request<super::GetTableDataCountRequest>,
@@ -661,9 +680,10 @@ pub mod tables_data_server {
/// Fetch the N-th non-deleted row by id order (1-based), then return its full data.
///
/// Behavior:
/// - position is 1-based (position = 1 → first row by id ASC with deleted = FALSE)
/// - Returns NOT_FOUND if position is out of bounds
/// - Otherwise identical to GetTableData for the selected id
///
/// * position is 1-based (position = 1 → first row by id ASC with deleted = FALSE)
/// * Returns NOT_FOUND if position is out of bounds
/// * Otherwise identical to GetTableData for the selected id
async fn get_table_data_by_position(
&self,
request: tonic::Request<super::GetTableDataByPositionRequest>,
@@ -783,7 +803,7 @@ pub mod tables_data_server {
let inner = self.inner.clone();
let fut = async move {
let method = PostTableDataSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
@@ -829,7 +849,7 @@ pub mod tables_data_server {
let inner = self.inner.clone();
let fut = async move {
let method = PostTableDataBulkSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
@@ -874,7 +894,7 @@ pub mod tables_data_server {
let inner = self.inner.clone();
let fut = async move {
let method = PutTableDataSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
@@ -919,7 +939,7 @@ pub mod tables_data_server {
let inner = self.inner.clone();
let fut = async move {
let method = DeleteTableDataSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
@@ -964,7 +984,7 @@ pub mod tables_data_server {
let inner = self.inner.clone();
let fut = async move {
let method = GetTableDataSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
@@ -1010,7 +1030,7 @@ pub mod tables_data_server {
let inner = self.inner.clone();
let fut = async move {
let method = GetTableDataCountSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
@@ -1059,7 +1079,7 @@ pub mod tables_data_server {
let inner = self.inner.clone();
let fut = async move {
let method = GetTableDataByPositionSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,

View File

@@ -1,5 +1,5 @@
// This file is @generated by prost-build.
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PostUctovnictvoRequest {
#[prost(int64, tag = "1")]
pub adresar_id: i64,
@@ -25,7 +25,7 @@ pub struct PostUctovnictvoRequest {
#[prost(string, tag = "11")]
pub firma: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct UctovnictvoResponse {
#[prost(int64, tag = "1")]
pub id: i64,
@@ -52,7 +52,7 @@ pub struct UctovnictvoResponse {
#[prost(string, tag = "12")]
pub firma: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PutUctovnictvoRequest {
#[prost(int64, tag = "1")]
pub id: i64,
@@ -79,7 +79,7 @@ pub struct PutUctovnictvoRequest {
#[prost(string, tag = "12")]
pub firma: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetUctovnictvoRequest {
#[prost(int64, tag = "1")]
pub id: i64,
@@ -190,7 +190,7 @@ pub mod uctovnictvo_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.uctovnictvo.Uctovnictvo/PostUctovnictvo",
);
@@ -216,7 +216,7 @@ pub mod uctovnictvo_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.uctovnictvo.Uctovnictvo/GetUctovnictvo",
);
@@ -242,7 +242,7 @@ pub mod uctovnictvo_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.uctovnictvo.Uctovnictvo/GetUctovnictvoCount",
);
@@ -271,7 +271,7 @@ pub mod uctovnictvo_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.uctovnictvo.Uctovnictvo/GetUctovnictvoByPosition",
);
@@ -300,7 +300,7 @@ pub mod uctovnictvo_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.uctovnictvo.Uctovnictvo/PutUctovnictvo",
);
@@ -468,7 +468,7 @@ pub mod uctovnictvo_server {
let inner = self.inner.clone();
let fut = async move {
let method = PostUctovnictvoSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
@@ -513,7 +513,7 @@ pub mod uctovnictvo_server {
let inner = self.inner.clone();
let fut = async move {
let method = GetUctovnictvoSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
@@ -559,7 +559,7 @@ pub mod uctovnictvo_server {
let inner = self.inner.clone();
let fut = async move {
let method = GetUctovnictvoCountSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
@@ -610,7 +610,7 @@ pub mod uctovnictvo_server {
let inner = self.inner.clone();
let fut = async move {
let method = GetUctovnictvoByPositionSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
@@ -655,7 +655,7 @@ pub mod uctovnictvo_server {
let inner = self.inner.clone();
let fut = async move {
let method = PutUctovnictvoSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,

6
flake.lock generated
View File

@@ -20,11 +20,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1753549186,
"narHash": "sha256-Znl7rzuxKg/Mdm6AhimcKynM7V3YeNDIcLjBuoBcmNs=",
"lastModified": 1780749050,
"narHash": "sha256-3av0pIjlOWQ6rDbNOmpUSvbNnJkGORQKKjb4LtCZsIY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "17f6bd177404d6d43017595c5264756764444ab8",
"rev": "a799d3e3886da994fa307f817a6bc705ae538eeb",
"type": "github"
},
"original": {

View File

@@ -15,5 +15,5 @@ tracing = { workspace = true }
tantivy = { workspace = true }
common = { path = "../common" }
tonic-reflection = "0.13.1"
sqlx = { version = "0.8.6", features = ["postgres"] }
tonic-reflection = "0.14.6"
sqlx = { version = "0.9.0", features = ["postgres"] }

View File

@@ -6,10 +6,10 @@ use std::sync::{Arc, Mutex};
use common::proto::komp_ac::search::searcher_server::Searcher;
pub use common::proto::komp_ac::search::searcher_server::SearcherServer;
use common::proto::komp_ac::search::{search_response::Hit, SearchRequest, SearchResponse};
use common::search::{register_tokenizers, search_index_path, SchemaFields};
use query_builder::{build_master_query, ConstraintMode, SearchConstraint};
use sqlx::{PgPool, Row};
use common::proto::komp_ac::search::{SearchRequest, SearchResponse, search_response::Hit};
use common::search::{SchemaFields, register_tokenizers, search_index_path};
use query_builder::{ConstraintMode, SearchConstraint, build_master_query};
use sqlx::{AssertSqlSafe, PgPool, Row};
use tantivy::collector::TopDocs;
use tantivy::schema::Value;
use tantivy::{Index, IndexReader, ReloadPolicy, TantivyDocument};
@@ -112,7 +112,6 @@ impl SearcherService {
Ok(Response::new(SearchResponse { hits }))
}
}
struct ProfileIndex {
@@ -322,7 +321,7 @@ async fn fetch_latest_rows(
qualify_profile_table(profile_name, table_name)
);
let rows = sqlx::query(&sql)
let rows = sqlx::query(AssertSqlSafe(sql))
.bind(limit as i64)
.fetch_all(pool)
.await
@@ -362,7 +361,7 @@ async fn run_search(
let searcher = profile.reader.searcher();
let top_docs = searcher
.search(&*master_query, &TopDocs::with_limit(limit))
.search(&*master_query, &TopDocs::with_limit(limit).order_by_score())
.map_err(|e| Status::internal(format!("Search failed: {}", e)))?;
if top_docs.is_empty() {
@@ -409,7 +408,7 @@ async fn run_search(
qualify_profile_table(profile_name, &table_name)
);
let rows = sqlx::query(&sql)
let rows = sqlx::query(AssertSqlSafe(sql))
.bind(&pg_ids)
.fetch_all(pool)
.await

2
server

Submodule server updated: 271caf181d...a0c8fd1a77