From 631679ddd789579838e05ab99e92bfd779a67547 Mon Sep 17 00:00:00 2001 From: Raphael Date: Sat, 12 Apr 2025 13:53:29 +0200 Subject: [PATCH 1/9] ref: moved flow file --- proto/shared/shared.flow.proto | 48 ++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 proto/shared/shared.flow.proto diff --git a/proto/shared/shared.flow.proto b/proto/shared/shared.flow.proto new file mode 100644 index 0000000..c2069f2 --- /dev/null +++ b/proto/shared/shared.flow.proto @@ -0,0 +1,48 @@ +syntax = "proto3"; + +option ruby_package = "Tucana::Shared"; + +package shared; + +import "shared.struct.proto"; + +message Flow { + // Database ID -> req. for Aquila to identify in FlowStore + int64 flow_id = 1; + string type = 2; + repeated FlowSetting settings = 3; + NodeFunction starting_node = 4; +} + +message FlowSetting { + string definition = 1; + shared.Struct object = 2; +} + +message NodeFunction { + NodeFunctionDefinition definition = 1; + repeated NodeParameter parameters = 2; + optional NodeFunction next_node = 3; +} + +message NodeParameter { + NodeParameterDefinition definition = 1; + oneof value { + shared.Value literal_value = 2; + NodeFunction function_value = 3; + } +} + +message NodeParameterDefinition { + string parameter_id = 1; + string runtime_parameter_id = 2; +} + +message NodeFunctionDefinition { + string function_id = 1; + string runtime_function_id = 2; +} + +message Flows { + repeated Flow flows = 1; +} From 085020c0128607e571be94dfe87bac97f648a241 Mon Sep 17 00:00:00 2001 From: Raphael Date: Sat, 12 Apr 2025 13:53:39 +0200 Subject: [PATCH 2/9] feat: adjusted build configuration --- build/rust/build.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/build/rust/build.rs b/build/rust/build.rs index 6d91fb9..a1e0ce4 100644 --- a/build/rust/build.rs +++ b/build/rust/build.rs @@ -15,6 +15,7 @@ fn main() -> Result<()> { "sagittarius.runtime_function.proto", // shared "shared.datatype.proto", + "shared.flow.proto", "shared.runtime_function.proto", "shared.translation.proto", "shared.struct.proto", From 95189f147853f314d7818db6b1f198d21dbe5c56 Mon Sep 17 00:00:00 2001 From: Raphael Date: Sat, 12 Apr 2025 13:54:23 +0200 Subject: [PATCH 3/9] ref: removed flow from Sagittarius --- proto/sagittarius/sagittarius.flow.proto | 44 ++----------------- .../sagittarius.flow_definition.proto | 7 +-- 2 files changed, 7 insertions(+), 44 deletions(-) diff --git a/proto/sagittarius/sagittarius.flow.proto b/proto/sagittarius/sagittarius.flow.proto index b546685..743a2b6 100644 --- a/proto/sagittarius/sagittarius.flow.proto +++ b/proto/sagittarius/sagittarius.flow.proto @@ -5,45 +5,7 @@ option ruby_package = "Tucana::Sagittarius"; package sagittarius; import "shared.struct.proto"; - -message Flow { - // Database ID -> req. for Aquila to identify in FlowStore - int64 flow_id = 1; - string type = 2; - repeated FlowSetting settings = 3; - NodeFunction starting_node = 4; -} - -message FlowSetting { - string definition = 1; - shared.Struct object = 2; -} - -message NodeFunction { - NodeFunctionDefinition definition = 1; - repeated NodeParameter parameters = 2; - optional NodeFunction next_node = 3; -} - -message NodeParameter { - NodeParameterDefinition definition = 1; - shared.Struct object = 2; - NodeFunction sub_node = 3; -} - -message NodeParameterDefinition { - string parameter_id = 1; - string runtime_parameter_id = 2; -} - -message NodeFunctionDefinition { - string function_id = 1; - string runtime_function_id = 2; -} - -message Flows { - repeated Flow flows = 1; -} +import "shared.flow.proto"; //Aquila sends a request to initialise stream to Sagittarius message FlowLogonRequest { @@ -53,11 +15,11 @@ message FlowLogonRequest { message FlowResponse { oneof data { // Updates a single flow - Flow updated_flow = 1; + shared.Flow updated_flow = 1; // Deletes a single flow int64 deleted_flow_id = 2; // Replaces all flows in Aquila (only on startup and for releases) - Flows flows = 3; + shared.Flows flows = 3; } } diff --git a/proto/sagittarius/sagittarius.flow_definition.proto b/proto/sagittarius/sagittarius.flow_definition.proto index af1c66a..0a79552 100644 --- a/proto/sagittarius/sagittarius.flow_definition.proto +++ b/proto/sagittarius/sagittarius.flow_definition.proto @@ -7,9 +7,10 @@ package sagittarius; import "shared.translation.proto"; import "shared.datatype.proto"; import "shared.struct.proto"; +import "shared.flow.proto"; message FlowType { - FlowDefinition definition = 1; + shared.FlowDefinition definition = 1; repeated shared.Translation name = 2; } @@ -22,7 +23,7 @@ message FlowDefinitionSetting { } message FlowDefinition { - repeated FlowDefinitionSetting settings = 1; + repeated shared.FlowDefinitionSetting settings = 1; shared.DataType input_type = 2; bool editable = 3; -} \ No newline at end of file +} From 2e8f4b372bb872ca034590fbe474bdd301ff1bc9 Mon Sep 17 00:00:00 2001 From: Raphael Date: Sat, 12 Apr 2025 13:55:09 +0200 Subject: [PATCH 4/9] docs: updated readme --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 10af15f..c1dacde 100644 --- a/README.md +++ b/README.md @@ -44,22 +44,23 @@ Tucana.load_protocol(:aquila) The project is organized with services functioning as servers. Each protocol in the Sagittarius folder corresponds to services that Sagittarius must implement as a server. -```ascii-tree +```ascii-tree . ├── aquila │ ├── action - Action service (emits events, manages configs, and handles executions) │ └── execution - Execution service (handles internal execution calls) ├── sagittarius │ ├── action - Action service (manages logon/logoff requests for action configurations) -│ ├── datatype - DataType service -│ ├── flow - Flow service & Flow types (handles flow updates) +│ ├── datatype - DataType service +│ ├── flow - Flow service (handles flow updates) │ ├── flow_definition - Defines a definition for a Flow │ ├── ping - Ping service (performs life checks) │ └── runtime_function - Service for updating the runtime functions └── shared ├── datatype - Defines types for data types ├── event - Defines types for events + ├── flow - Defines types for flows ├── runtime_function_definition - Defines types for runtime functions ├── struct - Defines types for json representations └── translation - Contains translations with country codes and translated messages -``` \ No newline at end of file +``` From aa4e09e90a4e7f7a692c8d9d727a950b58c51e11 Mon Sep 17 00:00:00 2001 From: Raphael Date: Sat, 12 Apr 2025 14:47:46 +0200 Subject: [PATCH 5/9] feat: added flow settings definition & missing field --- proto/shared/shared.flow.proto | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/proto/shared/shared.flow.proto b/proto/shared/shared.flow.proto index c2069f2..4f4d81b 100644 --- a/proto/shared/shared.flow.proto +++ b/proto/shared/shared.flow.proto @@ -10,15 +10,22 @@ message Flow { // Database ID -> req. for Aquila to identify in FlowStore int64 flow_id = 1; string type = 2; - repeated FlowSetting settings = 3; - NodeFunction starting_node = 4; + repeated shared.DataType data_types = 3; + shared.DataType input_type = 4; + repeated FlowSetting settings = 5; + NodeFunction starting_node = 6; } message FlowSetting { - string definition = 1; + FlowSettingDefinition definition = 1; shared.Struct object = 2; } +message FlowSettingDefinition { + string id = 1; + string key = 2; +} + message NodeFunction { NodeFunctionDefinition definition = 1; repeated NodeParameter parameters = 2; From b942d3aae334fd0c9fe5212819647d09997bf8d6 Mon Sep 17 00:00:00 2001 From: Raphael Date: Sat, 12 Apr 2025 14:55:46 +0200 Subject: [PATCH 6/9] fix: added missing imports --- proto/shared/shared.flow.proto | 1 + 1 file changed, 1 insertion(+) diff --git a/proto/shared/shared.flow.proto b/proto/shared/shared.flow.proto index 4f4d81b..195609b 100644 --- a/proto/shared/shared.flow.proto +++ b/proto/shared/shared.flow.proto @@ -5,6 +5,7 @@ option ruby_package = "Tucana::Shared"; package shared; import "shared.struct.proto"; +import "shared.datatype.proto"; message Flow { // Database ID -> req. for Aquila to identify in FlowStore From e1a6d60d372303547b2f27ed12e9da344e55c22e Mon Sep 17 00:00:00 2001 From: Raphael Date: Sat, 12 Apr 2025 15:03:14 +0200 Subject: [PATCH 7/9] fix: added missing rule --- build/rust/build.rs | 1 + proto/sagittarius/sagittarius.flow.proto | 1 - proto/sagittarius/sagittarius.flow_definition.proto | 4 ++-- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build/rust/build.rs b/build/rust/build.rs index a1e0ce4..da4f1e0 100644 --- a/build/rust/build.rs +++ b/build/rust/build.rs @@ -52,6 +52,7 @@ fn main() -> Result<()> { .type_attribute("DataType", serde_attribute) .type_attribute("RuntimeParameterDefinition", serde_attribute) .type_attribute("RuntimeFunctionDefinition", serde_attribute) + .type_attribute("FlowSettingDefinition", serde_attribute) .type_attribute("FlowSetting", serde_attribute) .type_attribute("NodeParameterDefinition", serde_attribute) .type_attribute("NodeFunctionDefinition", serde_attribute) diff --git a/proto/sagittarius/sagittarius.flow.proto b/proto/sagittarius/sagittarius.flow.proto index 743a2b6..e109680 100644 --- a/proto/sagittarius/sagittarius.flow.proto +++ b/proto/sagittarius/sagittarius.flow.proto @@ -4,7 +4,6 @@ option ruby_package = "Tucana::Sagittarius"; package sagittarius; -import "shared.struct.proto"; import "shared.flow.proto"; //Aquila sends a request to initialise stream to Sagittarius diff --git a/proto/sagittarius/sagittarius.flow_definition.proto b/proto/sagittarius/sagittarius.flow_definition.proto index 0a79552..eb35ae4 100644 --- a/proto/sagittarius/sagittarius.flow_definition.proto +++ b/proto/sagittarius/sagittarius.flow_definition.proto @@ -10,7 +10,7 @@ import "shared.struct.proto"; import "shared.flow.proto"; message FlowType { - shared.FlowDefinition definition = 1; + FlowDefinition definition = 1; repeated shared.Translation name = 2; } @@ -23,7 +23,7 @@ message FlowDefinitionSetting { } message FlowDefinition { - repeated shared.FlowDefinitionSetting settings = 1; + repeated FlowDefinitionSetting settings = 1; shared.DataType input_type = 2; bool editable = 3; } From 9501759bbfc4ea3d9dac64076a38693b4846beab Mon Sep 17 00:00:00 2001 From: Raphael Date: Sat, 12 Apr 2025 15:13:48 +0200 Subject: [PATCH 8/9] feat: made input type optional --- proto/shared/shared.flow.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/shared/shared.flow.proto b/proto/shared/shared.flow.proto index 195609b..56e836a 100644 --- a/proto/shared/shared.flow.proto +++ b/proto/shared/shared.flow.proto @@ -12,7 +12,7 @@ message Flow { int64 flow_id = 1; string type = 2; repeated shared.DataType data_types = 3; - shared.DataType input_type = 4; + optional shared.DataType input_type = 4; repeated FlowSetting settings = 5; NodeFunction starting_node = 6; } From 4043640d13c86a69083a28aa413b618f03861146 Mon Sep 17 00:00:00 2001 From: Raphael Date: Sat, 12 Apr 2025 15:14:01 +0200 Subject: [PATCH 9/9] fix: adjusted tests to match new flow object --- build/rust/build.rs | 1 + build/rust/src/lib.rs | 28 ++++++++++++++++++---------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/build/rust/build.rs b/build/rust/build.rs index da4f1e0..080a0de 100644 --- a/build/rust/build.rs +++ b/build/rust/build.rs @@ -43,6 +43,7 @@ fn main() -> Result<()> { .build_server(true) .build_client(true) .type_attribute("kind", serde_attribute) + .type_attribute("value", serde_attribute) .type_attribute("NullValue", serde_attribute) .type_attribute("Value", serde_attribute) .type_attribute("ListValue", serde_attribute) diff --git a/build/rust/src/lib.rs b/build/rust/src/lib.rs index 1ebe387..e74566f 100644 --- a/build/rust/src/lib.rs +++ b/build/rust/src/lib.rs @@ -1,30 +1,35 @@ #[cfg(feature = "sagittarius")] pub mod sagittarius { - include!("generated/sagittarius.rs"); + include!("generated/shared.rs"); #[cfg(test)] pub mod tests { - use crate::sagittarius::Flow; + use crate::shared::Flow; use serde_json; #[test] fn test_serialize() { let flow = Flow { flow_id: 0, + data_types: vec![], + input_type: None, r#type: "no".to_string(), settings: vec![], starting_node: None, }; let str_flow = serde_json::to_string(&flow).expect("Serialization failed"); - let json_flow: serde_json::Value = serde_json::from_str(&str_flow).expect("Failed to parse JSON"); + let json_flow: serde_json::Value = + serde_json::from_str(&str_flow).expect("Failed to parse JSON"); let expected_json: serde_json::Value = serde_json::json!({ - "flow_id": 0, - "type": "no", - "settings": [], - "starting_node": null - }); + "flow_id": 0, + "type": "no", + "input_type": null, + "data_types": [], + "settings": [], + "starting_node": null + }); assert_eq!(json_flow, expected_json); } @@ -34,6 +39,8 @@ pub mod sagittarius { let json_data = r#"{ "flow_id": 0, "type": "no", + "input_type": null, + "data_types": [], "settings": [], "starting_node": null }"#; @@ -45,13 +52,14 @@ pub mod sagittarius { flow_id: 0, r#type: "no".to_string(), settings: vec![], + data_types: vec![], + input_type: None, starting_node: None, }; assert_eq!(deserialized.unwrap(), expected_flow); } } - } #[cfg(feature = "aquila")] @@ -62,4 +70,4 @@ pub mod aquila { #[cfg(feature = "shared")] pub mod shared { include!("generated/shared.rs"); -} \ No newline at end of file +}