From eb2d6bea5da7f32d8367642643679ca918807149 Mon Sep 17 00:00:00 2001 From: Filipriec Date: Sat, 29 Aug 2026 23:19:53 +0200 Subject: [PATCH] typst files stored in the db from now on2 --- client | 2 +- common/build.rs | 4 +- common/proto/document_data.proto | 58 +++--- common/proto/table_definition.proto | 10 +- common/src/proto/descriptor.bin | Bin 201712 -> 202411 bytes common/src/proto/komp_ac.document_data.rs | 180 +++++++++++++++---- common/src/proto/komp_ac.table_definition.rs | 13 +- server | 2 +- web/src/schema/mod.rs | 3 + 9 files changed, 203 insertions(+), 69 deletions(-) diff --git a/client b/client index 1d3e75b1..748a601d 160000 --- a/client +++ b/client @@ -1 +1 @@ -Subproject commit 1d3e75b1502956959ae5ea43c1514ecd23904a0b +Subproject commit 748a601d68d879121b0f7ab809e8e8717c571372 diff --git a/common/build.rs b/common/build.rs index 4b80a955..cb6dfe9f 100644 --- a/common/build.rs +++ b/common/build.rs @@ -158,8 +158,8 @@ fn main() -> Result<(), Box> { "#[derive(serde::Serialize, serde::Deserialize)]", ) .field_attribute( - ".komp_ac.table_definition.ColumnDefinition.boolean_ledger_operator", - "#[serde(default)]", + ".komp_ac.table_definition.ColumnDefinition.boolean_ledger", + "#[serde(default, alias = \"boolean_ledger_operator\")]", ) .type_attribute( ".komp_ac.table_definition.PostTableDefinitionRequest", diff --git a/common/proto/document_data.proto b/common/proto/document_data.proto index 748b4b86..4ec83210 100644 --- a/common/proto/document_data.proto +++ b/common/proto/document_data.proto @@ -7,6 +7,7 @@ service DocumentDataService { rpc GetDocuments(GetDocumentsRequest) returns (GetDocumentsResponse); rpc GetDocument(GetDocumentRequest) returns (GetDocumentResponse); rpc GetDocumentVersion(GetDocumentVersionRequest) returns (GetDocumentVersionResponse); + rpc GetTypstTemplateVersion(GetTypstTemplateVersionRequest) returns (GetTypstTemplateVersionResponse); } message SourceRecord { @@ -17,28 +18,24 @@ message SourceRecord { } message SaveDocumentRequest { - optional int64 schema_id = 1; - repeated SourceRecord source_records = 2; - optional string template_name = 3; - optional string template_kind = 4; - optional string template_path = 5; - string data_json = 6; + repeated SourceRecord source_records = 1; + string template_name = 2; + string typst_source = 3; + string typst_compiler_version = 4; + string data_json = 5; } message SaveDocumentResponse { int64 document_id = 1; int64 snapshot_id = 2; int32 version_number = 3; + int64 template_version_id = 4; + int32 template_version = 5; } message UpdateDocumentRequest { int64 document_id = 1; - optional int64 schema_id = 2; - repeated SourceRecord source_records = 3; - optional string template_name = 4; - optional string template_kind = 5; - optional string template_path = 6; - string data_json = 7; + string data_json = 2; } message UpdateDocumentResponse { @@ -56,16 +53,15 @@ message GetDocumentsRequest { message Document { int64 snapshot_id = 1; int64 document_id = 2; - optional int64 schema_id = 3; + int64 schema_id = 3; repeated SourceRecord source_records = 4; - optional string template_name = 5; - optional string template_kind = 6; - optional string template_path = 7; - string data_json = 8; - string change_kind = 9; - int32 version_number = 10; - string created_at = 11; - string updated_at = 12; + string data_json = 5; + string change_kind = 6; + int32 version_number = 7; + string created_at = 8; + string updated_at = 9; + int64 template_version_id = 10; + string data_sha256 = 11; } message GetDocumentsResponse { @@ -88,3 +84,23 @@ message GetDocumentVersionRequest { message GetDocumentVersionResponse { optional Document document = 1; } + +message GetTypstTemplateVersionRequest { + int64 template_version_id = 1; + int64 document_id = 2; +} + +message TypstTemplateVersion { + int64 id = 1; + int64 schema_id = 2; + string template_name = 3; + int32 version = 4; + string source_code = 5; + string source_sha256 = 6; + string typst_compiler_version = 7; + string created_at = 8; +} + +message GetTypstTemplateVersionResponse { + optional TypstTemplateVersion template_version = 1; +} diff --git a/common/proto/table_definition.proto b/common/proto/table_definition.proto index 3fbdfa63..9068981b 100644 --- a/common/proto/table_definition.proto +++ b/common/proto/table_definition.proto @@ -291,8 +291,8 @@ message ColumnDefinition { // MONEY rounding applied before a value is stored. MoneyRounding rounding = 3; - // When true, this numeric or Boolean column is server-owned and projected - // from ledger contributions. + // When true, this numeric column is server-owned and projected + // from quantity-ledger contributions. bool quantity_ledger = 4; // Canonical uppercase ISO-4217 currency code. Required for MONEY and forbidden @@ -302,9 +302,9 @@ message ColumnDefinition { // When true, the server rejects omitted or explicitly null values. bool required = 6; - // Required for Boolean ledger columns and forbidden otherwise. ANY means + // Enables a Boolean ledger on Boolean columns. ANY means // one true contribution wins; ALL means one false contribution wins. - BooleanLedgerOperator boolean_ledger_operator = 7; + BooleanLedgerOperator boolean_ledger = 7; } enum BooleanLedgerOperator { @@ -595,6 +595,8 @@ message ListColumnTypesResponse { // Whether ColumnDefinition.quantity_ledger may be set on this type. bool allows_quantity_ledger = 8; + // Whether ColumnDefinition.boolean_ledger may be set on this type. + bool allows_boolean_ledger = 11; // Optional name grouping several types a client offers behind one choice — // "temporal" for the date and time types, "gtin" for the GTIN lengths. diff --git a/common/src/proto/descriptor.bin b/common/src/proto/descriptor.bin index 371c8cbed221618a019df85add525c4c4dfe33cd..d3f911c1eea22bd5a775228cc5a97f14d3560b12 100644 GIT binary patch delta 5127 zcmZ`-YiwM_6}~ffcK7b=!}j%KH-4_|Bw!ny*u+VkI7x|V0!~PRV@N_tHtY2TyY(aS zu0fzyE2N^P{3xon(n^H3zgk*Vl`7KKs!)Ym)QUh06-5YvM4KN-O(i7Srcx;B<2!fG zy$Qwn=WphG-+9cLGk5*b^T{9mIQf&_i}D*I)eRS48n`BO-7)E?U zhZZJ)d)^h*iPtJ8-9gEblPc{TwEP2n2+o$V;#V`ocj!f1C>ulU}fAx2- zjkbR(3X@zI#fAHR-zDS^?dtOD_mW|$IO{DG$iEFqd(trr_smrP{QAA=Pbo#Jzj&il zM62(-(JNxrYj5;atB0EASI!_oZzf+TXXAdtabCHze6vio?`e%pyL7@YUum{5JhC;L z@bxq;9raf(eDe>#6-Ro`>dyUMd5Vr_iVu8tkQa7z7>87 zSRn^&z(tB02WHWf$-Q~=#(e9~Ht#e#+wIW0xaG-B`Ub(Z}Qx&@Frgbl!Sz0W4 z?ibeRRVrO#c%b^^o0+|9Rrqe}GmU&sh`o)vAs_U2(D%c?j$C-~&26&NJt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!#zb)FixjtRVf`2L|9jJsR>tm~-nkIJkcJ^)I7luHf-JB~(zK?MTs zXku&aB-D>)I(&84Qxn!R!BA19CfrtE+$HhjJRJb^{v7Ax0OI6v9uFYs9mjM~v|&%3 zw4M$0sDvl^{RxxaDcRwN0Dxdmaj-xL_7n#T1lp-Y;0h4LPi@O+)TDJLP^Usq zx*dMBn$)K_S^$)Gih~8h!6^jZ> zqPa4%B);j2Ka_v-lK5xK^Ex$CC|t_t7N#%d=bq0mP8Tlc7jw&n@_SdrkW9{$|9nLx zRQ73|D!=loNLMo75I1AuM)@D#6IbM_s$BfOm=Ki@Ulwn=k>9NeUFU^_^|30ie_eJ| z-hEBHG0?DtY0`L`)LT-vwdTvY8=^%Q7BgeP#pSQv5Pg-O-ViT{6R!*ZEMDbzq#S5{ zS!5>jUs<`Zn4imh`2iyngqoQxTw0l5SjyxU{Oy?wb94EHOkw$ae(}W%OZoDds+ezl zQpfPd;V%FJct`f{t=z7PZ*_~0D`)SCUkGup68)DLuZ!Ij+EMMcg{fC-<-h(%Tpz~B zt2KnK8+2W;g%9X8g_qbYKyyvS6Z$|vwk^;3K&cPQfBQu2Pkf-FZTbg7yF`XE{&U}B=mSdlanW4Lz>1Zl-SH)5f(edMg zrPemRWa#+lTra=, - #[prost(message, repeated, tag = "2")] + #[prost(message, repeated, tag = "1")] pub source_records: ::prost::alloc::vec::Vec, - #[prost(string, optional, tag = "3")] - pub template_name: ::core::option::Option<::prost::alloc::string::String>, - #[prost(string, optional, tag = "4")] - pub template_kind: ::core::option::Option<::prost::alloc::string::String>, - #[prost(string, optional, tag = "5")] - pub template_path: ::core::option::Option<::prost::alloc::string::String>, - #[prost(string, tag = "6")] + #[prost(string, tag = "2")] + pub template_name: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub typst_source: ::prost::alloc::string::String, + #[prost(string, tag = "4")] + pub typst_compiler_version: ::prost::alloc::string::String, + #[prost(string, tag = "5")] pub data_json: ::prost::alloc::string::String, } #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] @@ -33,22 +31,16 @@ pub struct SaveDocumentResponse { pub snapshot_id: i64, #[prost(int32, tag = "3")] pub version_number: i32, + #[prost(int64, tag = "4")] + pub template_version_id: i64, + #[prost(int32, tag = "5")] + pub template_version: i32, } -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct UpdateDocumentRequest { #[prost(int64, tag = "1")] pub document_id: i64, - #[prost(int64, optional, tag = "2")] - pub schema_id: ::core::option::Option, - #[prost(message, repeated, tag = "3")] - pub source_records: ::prost::alloc::vec::Vec, - #[prost(string, optional, tag = "4")] - pub template_name: ::core::option::Option<::prost::alloc::string::String>, - #[prost(string, optional, tag = "5")] - pub template_kind: ::core::option::Option<::prost::alloc::string::String>, - #[prost(string, optional, tag = "6")] - pub template_path: ::core::option::Option<::prost::alloc::string::String>, - #[prost(string, tag = "7")] + #[prost(string, tag = "2")] pub data_json: ::prost::alloc::string::String, } #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] @@ -75,26 +67,24 @@ pub struct Document { pub snapshot_id: i64, #[prost(int64, tag = "2")] pub document_id: i64, - #[prost(int64, optional, tag = "3")] - pub schema_id: ::core::option::Option, + #[prost(int64, tag = "3")] + pub schema_id: i64, #[prost(message, repeated, tag = "4")] pub source_records: ::prost::alloc::vec::Vec, - #[prost(string, optional, tag = "5")] - pub template_name: ::core::option::Option<::prost::alloc::string::String>, - #[prost(string, optional, tag = "6")] - pub template_kind: ::core::option::Option<::prost::alloc::string::String>, - #[prost(string, optional, tag = "7")] - pub template_path: ::core::option::Option<::prost::alloc::string::String>, - #[prost(string, tag = "8")] + #[prost(string, tag = "5")] pub data_json: ::prost::alloc::string::String, - #[prost(string, tag = "9")] + #[prost(string, tag = "6")] pub change_kind: ::prost::alloc::string::String, - #[prost(int32, tag = "10")] + #[prost(int32, tag = "7")] pub version_number: i32, - #[prost(string, tag = "11")] + #[prost(string, tag = "8")] pub created_at: ::prost::alloc::string::String, - #[prost(string, tag = "12")] + #[prost(string, tag = "9")] pub updated_at: ::prost::alloc::string::String, + #[prost(int64, tag = "10")] + pub template_version_id: i64, + #[prost(string, tag = "11")] + pub data_sha256: ::prost::alloc::string::String, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetDocumentsResponse { @@ -123,6 +113,37 @@ pub struct GetDocumentVersionResponse { #[prost(message, optional, tag = "1")] pub document: ::core::option::Option, } +#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] +pub struct GetTypstTemplateVersionRequest { + #[prost(int64, tag = "1")] + pub template_version_id: i64, + #[prost(int64, tag = "2")] + pub document_id: i64, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct TypstTemplateVersion { + #[prost(int64, tag = "1")] + pub id: i64, + #[prost(int64, tag = "2")] + pub schema_id: i64, + #[prost(string, tag = "3")] + pub template_name: ::prost::alloc::string::String, + #[prost(int32, tag = "4")] + pub version: i32, + #[prost(string, tag = "5")] + pub source_code: ::prost::alloc::string::String, + #[prost(string, tag = "6")] + pub source_sha256: ::prost::alloc::string::String, + #[prost(string, tag = "7")] + pub typst_compiler_version: ::prost::alloc::string::String, + #[prost(string, tag = "8")] + pub created_at: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct GetTypstTemplateVersionResponse { + #[prost(message, optional, tag = "1")] + pub template_version: ::core::option::Option, +} /// Generated client implementations. pub mod document_data_service_client { #![allow( @@ -359,6 +380,35 @@ pub mod document_data_service_client { ); self.inner.unary(req, path, codec).await } + pub async fn get_typst_template_version( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic_prost::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/komp_ac.document_data.DocumentDataService/GetTypstTemplateVersion", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "komp_ac.document_data.DocumentDataService", + "GetTypstTemplateVersion", + ), + ); + self.inner.unary(req, path, codec).await + } } } /// Generated server implementations. @@ -409,6 +459,13 @@ pub mod document_data_service_server { tonic::Response, tonic::Status, >; + async fn get_typst_template_version( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; } #[derive(Debug)] pub struct DocumentDataServiceServer { @@ -719,6 +776,59 @@ pub mod document_data_service_server { }; Box::pin(fut) } + "/komp_ac.document_data.DocumentDataService/GetTypstTemplateVersion" => { + #[allow(non_camel_case_types)] + struct GetTypstTemplateVersionSvc( + pub Arc, + ); + impl< + T: DocumentDataService, + > tonic::server::UnaryService + for GetTypstTemplateVersionSvc { + type Response = super::GetTypstTemplateVersionResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request< + super::GetTypstTemplateVersionRequest, + >, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::get_typst_template_version( + &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 = GetTypstTemplateVersionSvc(inner); + let codec = tonic_prost::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } _ => { Box::pin(async move { let mut response = http::Response::new( diff --git a/common/src/proto/komp_ac.table_definition.rs b/common/src/proto/komp_ac.table_definition.rs index ac0ab261..d5eb70ec 100644 --- a/common/src/proto/komp_ac.table_definition.rs +++ b/common/src/proto/komp_ac.table_definition.rs @@ -255,8 +255,8 @@ pub struct ColumnDefinition { /// MONEY rounding applied before a value is stored. #[prost(enumeration = "MoneyRounding", tag = "3")] pub rounding: i32, - /// When true, this numeric or Boolean column is server-owned and projected - /// from ledger contributions. + /// When true, this numeric column is server-owned and projected + /// from quantity-ledger contributions. #[prost(bool, tag = "4")] pub quantity_ledger: bool, /// Canonical uppercase ISO-4217 currency code. Required for MONEY and forbidden @@ -266,11 +266,11 @@ pub struct ColumnDefinition { /// When true, the server rejects omitted or explicitly null values. #[prost(bool, tag = "6")] pub required: bool, - /// Required for Boolean ledger columns and forbidden otherwise. ANY means + /// Enables a Boolean ledger on Boolean columns. ANY means /// one true contribution wins; ALL means one false contribution wins. #[prost(enumeration = "BooleanLedgerOperator", tag = "7")] - #[serde(default)] - pub boolean_ledger_operator: i32, + #[serde(default, alias = "boolean_ledger_operator")] + pub boolean_ledger: i32, } /// Response after table creation (success + DDL preview). #[derive(serde::Serialize, serde::Deserialize)] @@ -620,6 +620,9 @@ pub mod list_column_types_response { /// Whether ColumnDefinition.quantity_ledger may be set on this type. #[prost(bool, tag = "8")] pub allows_quantity_ledger: bool, + /// Whether ColumnDefinition.boolean_ledger may be set on this type. + #[prost(bool, tag = "11")] + pub allows_boolean_ledger: bool, /// Optional name grouping several types a client offers behind one choice — /// "temporal" for the date and time types, "gtin" for the GTIN lengths. /// Empty when the type stands on its own. diff --git a/server b/server index 554e98ec..b25dd5a9 160000 --- a/server +++ b/server @@ -1 +1 @@ -Subproject commit 554e98ec117ea09f9a856dcbc3c1c86b6768fc30 +Subproject commit b25dd5a9d3827bdc90706ad900cc37cb76df4c56 diff --git a/web/src/schema/mod.rs b/web/src/schema/mod.rs index 7483d342..17498bd2 100644 --- a/web/src/schema/mod.rs +++ b/web/src/schema/mod.rs @@ -95,6 +95,7 @@ pub(crate) struct ColumnType { /// Only choosable while the table is being created. pub creation_only: bool, pub allows_quantity_ledger: bool, + pub allows_boolean_ledger: bool, /// Groups several types behind one choice in the picker; empty when the /// type stands on its own. pub group: String, @@ -1269,6 +1270,7 @@ pub(crate) fn proto_columns(columns: &[ColumnDefinition]) -> Vec MoneyRounding::None.into(), }, quantity_ledger: column.quantity_ledger, + boolean_ledger: 0, currency: column.currency.clone(), required: column.required, }) @@ -1290,6 +1292,7 @@ pub(crate) fn column_catalog(column_types: Vec) -> ColumnCatalo requires_currency: column_type.requires_currency, creation_only: column_type.creation_only, allows_quantity_ledger: column_type.allows_quantity_ledger, + allows_boolean_ledger: column_type.allows_boolean_ledger, group: column_type.group, generated_columns: column_type .generated_columns