diff --git a/Cargo.toml b/Cargo.toml index 90c0ae8..486616c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ resolver = "3" [workspace.package] # TODO: idk how to do the name, fix later # name = "komp_ac" -version = "0.8.18" +version = "0.8.23" edition = "2024" license = "GPL-3.0-or-later" authors = ["Filip Priečinský "] diff --git a/client b/client index 3eb0eff..4023272 160000 --- a/client +++ b/client @@ -1 +1 @@ -Subproject commit 3eb0effba1b074dbc792bd9ceb56849808b15067 +Subproject commit 4023272451240ebf6c8b5c3157181a69332cd727 diff --git a/common/proto/table_definition.proto b/common/proto/table_definition.proto index 6ebc2ea..94d0875 100644 --- a/common/proto/table_definition.proto +++ b/common/proto/table_definition.proto @@ -126,10 +126,9 @@ message ColumnDefinition { // s ≤ p and p ≥ 1. string field_type = 2; - // Once initially stored, this column can never be changed. - bool immutable = 3; + reserved 3; - // MONEY rounding applied before an immutable value is initially stored. + // MONEY rounding applied before a value is stored. MoneyRounding rounding = 4; } diff --git a/common/proto/table_script.proto b/common/proto/table_script.proto index 587ac53..ea25295 100644 --- a/common/proto/table_script.proto +++ b/common/proto/table_script.proto @@ -24,7 +24,7 @@ service TableScript { // - 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 + // • Structured access via steel_get_column // 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 @@ -67,8 +67,6 @@ message PostTableScriptRequest { // 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 @@ -87,13 +85,17 @@ message PostTableScriptRequest { // BIGINT, TEXT, BOOLEAN, DATE, TIMESTAMPTZ // // Dependency tracking and cycles: - // - Dependencies are extracted from steel_get_column(_with_index), get-var, + // - Dependencies are extracted from steel_get_column, get-var, // and steel_query_sql and stored in script_dependencies with context // - Cycles across tables are rejected (self-dependency is allowed) string script = 3; // Optional. Free-text description stored alongside the script (no functional effect). string description = 4; + + // When true, changing any referenced field recomputes the target column. + // When false, the script only validates direct writes to its own table. + bool recompute_on_dependency_change = 5; } // Response after creating or updating a script. @@ -128,12 +130,12 @@ message StoredTableScript { string script = 4; string description = 5; repeated ScriptDependency dependencies = 6; + bool recompute_on_dependency_change = 7; } message ScriptDependency { string target_table = 1; string dependency_type = 2; string column = 3; - int64 index = 4; - string query_fragment = 5; + string query_fragment = 4; } diff --git a/common/src/proto/descriptor.bin b/common/src/proto/descriptor.bin index f13befb..e2bb570 100644 Binary files a/common/src/proto/descriptor.bin and b/common/src/proto/descriptor.bin differ diff --git a/common/src/proto/komp_ac.table_definition.rs b/common/src/proto/komp_ac.table_definition.rs index 705a952..e2d8800 100644 --- a/common/src/proto/komp_ac.table_definition.rs +++ b/common/src/proto/komp_ac.table_definition.rs @@ -88,10 +88,7 @@ pub struct ColumnDefinition { /// s ≤ p and p ≥ 1. #[prost(string, tag = "2")] pub field_type: ::prost::alloc::string::String, - /// Once initially stored, this column can never be changed. - #[prost(bool, tag = "3")] - pub immutable: bool, - /// MONEY rounding applied before an immutable value is initially stored. + /// MONEY rounding applied before a value is stored. #[prost(enumeration = "MoneyRounding", tag = "4")] pub rounding: i32, } diff --git a/common/src/proto/komp_ac.table_script.rs b/common/src/proto/komp_ac.table_script.rs index e35bc47..3887c2b 100644 --- a/common/src/proto/komp_ac.table_script.rs +++ b/common/src/proto/komp_ac.table_script.rs @@ -26,8 +26,6 @@ pub struct PostTableScriptRequest { /// /// * 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 @@ -48,7 +46,7 @@ pub struct PostTableScriptRequest { /// /// Dependency tracking and cycles: /// - /// * Dependencies are extracted from steel_get_column(\_with_index), get-var, + /// * Dependencies are extracted from steel_get_column, 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")] @@ -56,6 +54,10 @@ pub struct PostTableScriptRequest { /// Optional. Free-text description stored alongside the script (no functional effect). #[prost(string, tag = "4")] pub description: ::prost::alloc::string::String, + /// When true, changing any referenced field recomputes the target column. + /// When false, the script only validates direct writes to its own table. + #[prost(bool, tag = "5")] + pub recompute_on_dependency_change: bool, } /// Response after creating or updating a script. #[derive(serde::Serialize, serde::Deserialize)] @@ -101,6 +103,8 @@ pub struct StoredTableScript { pub description: ::prost::alloc::string::String, #[prost(message, repeated, tag = "6")] pub dependencies: ::prost::alloc::vec::Vec, + #[prost(bool, tag = "7")] + pub recompute_on_dependency_change: bool, } #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct ScriptDependency { @@ -110,9 +114,7 @@ pub struct ScriptDependency { pub dependency_type: ::prost::alloc::string::String, #[prost(string, tag = "3")] pub column: ::prost::alloc::string::String, - #[prost(int64, tag = "4")] - pub index: i64, - #[prost(string, tag = "5")] + #[prost(string, tag = "4")] pub query_fragment: ::prost::alloc::string::String, } /// Generated client implementations. @@ -229,7 +231,7 @@ pub mod table_script_client { /// * 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 + /// • Structured access via steel_get_column /// 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 @@ -328,7 +330,7 @@ pub mod table_script_server { /// * 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 + /// • Structured access via steel_get_column /// 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 diff --git a/server b/server index 75ad74a..e826723 160000 --- a/server +++ b/server @@ -1 +1 @@ -Subproject commit 75ad74a9d8a19fa23e800afcbdcf67bec5582068 +Subproject commit e8267235bc9c066bc879f1c472f0ca32e7d55709