aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrtkay123 <dev@kanjala.com>2025-08-16 09:30:27 +0200
committerrtkay123 <dev@kanjala.com>2025-08-16 09:30:27 +0200
commit698633baa2505ffb60cb5bba588f8b360c767edd (patch)
tree8c0a93c3ca69f83189c0a57503581d4cdd31b097
parent000885c1d5a23eb353c3f490e32363010ca804d3 (diff)
downloadwarden-698633baa2505ffb60cb5bba588f8b360c767edd.tar.bz2
warden-698633baa2505ffb60cb5bba588f8b360c767edd.zip
build(config): typologies
-rw-r--r--Cargo.lock4
-rw-r--r--crates/typologies/Cargo.toml10
-rw-r--r--crates/typologies/src/main.rs3
-rw-r--r--lib/warden-core/build.rs5
-rw-r--r--lib/warden-core/src/configuration.rs4
-rw-r--r--proto/configuration/typology.proto73
-rw-r--r--proto/warden_message.proto24
7 files changed, 122 insertions, 1 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 9410446..6be0b0a 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3717,6 +3717,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f"
[[package]]
+name = "typologies"
+version = "0.1.0"
+
+[[package]]
name = "unicase"
version = "2.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/crates/typologies/Cargo.toml b/crates/typologies/Cargo.toml
new file mode 100644
index 0000000..207e671
--- /dev/null
+++ b/crates/typologies/Cargo.toml
@@ -0,0 +1,10 @@
+[package]
+name = "typologies"
+version = "0.1.0"
+edition = "2024"
+license.workspace = true
+homepage.workspace = true
+documentation.workspace = true
+description.workspace = true
+
+[dependencies]
diff --git a/crates/typologies/src/main.rs b/crates/typologies/src/main.rs
new file mode 100644
index 0000000..e7a11a9
--- /dev/null
+++ b/crates/typologies/src/main.rs
@@ -0,0 +1,3 @@
+fn main() {
+ println!("Hello, world!");
+}
diff --git a/lib/warden-core/build.rs b/lib/warden-core/build.rs
index abc6e37..abb105e 100644
--- a/lib/warden-core/build.rs
+++ b/lib/warden-core/build.rs
@@ -27,7 +27,10 @@ impl Entity {
if cfg!(feature = "message") {
base
} else {
- base.extend(["proto/configuration/routing.proto"]);
+ base.extend([
+ "proto/configuration/routing.proto",
+ "proto/configuration/typology.proto",
+ ]);
base
}
}
diff --git a/lib/warden-core/src/configuration.rs b/lib/warden-core/src/configuration.rs
index 296bfda..5b5b968 100644
--- a/lib/warden-core/src/configuration.rs
+++ b/lib/warden-core/src/configuration.rs
@@ -10,3 +10,7 @@ pub mod routing {
pub mod rule {
tonic::include_proto!("configuration.rule");
}
+
+pub mod typology {
+ tonic::include_proto!("configuration.typology");
+}
diff --git a/proto/configuration/typology.proto b/proto/configuration/typology.proto
new file mode 100644
index 0000000..bae4630
--- /dev/null
+++ b/proto/configuration/typology.proto
@@ -0,0 +1,73 @@
+syntax = "proto3";
+
+package configuration.typology;
+
+message Workflow {
+ double alert_threshold = 1;
+ optional double interdiction_threshold = 2;
+}
+
+message TypologyRuleWeight {
+ string ref = 1;
+ double wght = 2;
+}
+
+message TypologyRule {
+ string id = 1;
+ string version = 2;
+ repeated TypologyRuleWeight wghts = 3;
+}
+
+message TypologyConfiguration {
+ string id = 1;
+ string description = 2;
+ string version = 3;
+ Workflow workflow = 4;
+ repeated TypologyRule rules = 5;
+ Expression expression = 6;
+}
+
+enum Operator {
+ ADD = 0;
+ MULTIPLY = 1;
+ SUBTRACT = 2;
+ DIVIDE = 3;
+}
+
+message Term {
+ string id = 1;
+ string version = 2;
+}
+
+message Expression {
+ Operator operator = 1;
+ repeated Term terms = 2;
+}
+
+message TypologyConfigurationRequest {
+ string id = 1;
+ string version = 2;
+}
+
+message DeleteTypologyConfigurationRequest {
+ string id = 1;
+ string version = 2;
+}
+
+message GetTypologyConfigResponse {
+ optional TypologyConfiguration configuration = 1;
+}
+
+message UpdateTypologyConfigRequest {
+ TypologyConfiguration configuration = 1;
+}
+
+service QueryTypologies {
+ rpc GetTypologyConfiguration (TypologyConfigurationRequest) returns (GetTypologyConfigResponse);
+}
+
+service MutateTypologies {
+ rpc CreateTypologyConfiguration (TypologyConfiguration) returns (TypologyConfiguration);
+ rpc UpdateTypologyConfiguration (UpdateTypologyConfigRequest) returns (TypologyConfiguration);
+ rpc DeleteTypologyConfiguration (DeleteTypologyConfigurationRequest) returns (TypologyConfiguration);
+}
diff --git a/proto/warden_message.proto b/proto/warden_message.proto
index 706139c..937d5ae 100644
--- a/proto/warden_message.proto
+++ b/proto/warden_message.proto
@@ -3,6 +3,7 @@ syntax = "proto3";
package message;
import "configuration/routing.proto";
+import "configuration/typology.proto";
import "google/protobuf/timestamp.proto";
import "proto/iso20022/pacs_002_001_12.proto";
import "proto/iso20022/pacs_008_001_12.proto";
@@ -15,8 +16,31 @@ message Payload {
DataCache data_cache = 3;
string tx_tp = 4;
configuration.routing.RoutingConfiguration routing = 5;
+ RuleResult rule_result = 6;
+ TypologyResult typology_result = 7;
}
+message RuleResult {
+ string id = 1;
+ string version = 2;
+ string sub_rule_ref = 3;
+ string reason = 4;
+ string desc = 5;
+ double wght = 6;
+}
+
+message TypologyResult {
+ string id = 1;
+ string version = 2;
+ string desc = 3;
+ double result = 4;
+ double threshold = 5;
+ repeated RuleResult rule_results = 6;
+ bool review = 7;
+ configuration.typology.Workflow workflow = 8;
+}
+
+
message DataCache {
string cdtr_id = 1;
string dbtr_id = 2;