From 1a62fcacddbdbbb3175da5fa8f575fe585560a1c Mon Sep 17 00:00:00 2001 From: Timur Gordon <31495328+timurgordon@users.noreply.github.com> Date: Tue, 5 Aug 2025 12:53:24 +0200 Subject: [PATCH 1/2] add heroledger models --- heromodels/docs/payment_usage.md | 318 ----------- .../prompts/v_specs_to_rust_heromodels.md | 301 ++++++++++ heromodels/src/models/heroledger/dnsrecord.rs | 301 ++++++++++ heromodels/src/models/heroledger/group.rs | 236 ++++++++ .../src/models/heroledger/membership.rs | 115 ++++ heromodels/src/models/heroledger/mod.rs | 19 + heromodels/src/models/heroledger/money.rs | 515 ++++++++++++++++++ heromodels/src/models/heroledger/secretbox.rs | 142 +++++ heromodels/src/models/heroledger/signature.rs | 120 ++++ heromodels/src/models/heroledger/user.rs | 370 +++++++++++++ heromodels/src/models/heroledger/user_kvs.rs | 120 ++++ heromodels/src/models/mod.rs | 1 + 12 files changed, 2240 insertions(+), 318 deletions(-) delete mode 100644 heromodels/docs/payment_usage.md create mode 100644 heromodels/docs/prompts/v_specs_to_rust_heromodels.md create mode 100644 heromodels/src/models/heroledger/dnsrecord.rs create mode 100644 heromodels/src/models/heroledger/group.rs create mode 100644 heromodels/src/models/heroledger/membership.rs create mode 100644 heromodels/src/models/heroledger/mod.rs create mode 100644 heromodels/src/models/heroledger/money.rs create mode 100644 heromodels/src/models/heroledger/secretbox.rs create mode 100644 heromodels/src/models/heroledger/signature.rs create mode 100644 heromodels/src/models/heroledger/user.rs create mode 100644 heromodels/src/models/heroledger/user_kvs.rs diff --git a/heromodels/docs/payment_usage.md b/heromodels/docs/payment_usage.md deleted file mode 100644 index 666b448..0000000 --- a/heromodels/docs/payment_usage.md +++ /dev/null @@ -1,318 +0,0 @@ -# Payment Model Usage Guide - -This document provides comprehensive instructions for AI assistants on how to use the Payment model in the heromodels repository. - -## Overview - -The Payment model represents a payment transaction in the system, typically associated with company registration or subscription payments. It integrates with Stripe for payment processing and maintains comprehensive status tracking. - -## Model Structure - -```rust -pub struct Payment { - pub base_data: BaseModelData, // Auto-managed ID, timestamps, comments - pub payment_intent_id: String, // Stripe payment intent ID - pub company_id: u32, // Foreign key to Company - pub payment_plan: String, // "monthly", "yearly", "two_year" - pub setup_fee: f64, // One-time setup fee - pub monthly_fee: f64, // Recurring monthly fee - pub total_amount: f64, // Total amount paid - pub currency: String, // Currency code (defaults to "usd") - pub status: PaymentStatus, // Current payment status - pub stripe_customer_id: Option, // Stripe customer ID (set on completion) - pub created_at: i64, // Payment creation timestamp - pub completed_at: Option, // Payment completion timestamp -} - -pub enum PaymentStatus { - Pending, // Initial state - payment created but not processed - Processing, // Payment is being processed by Stripe - Completed, // Payment successfully completed - Failed, // Payment processing failed - Refunded, // Payment was refunded -} -``` - -## Basic Usage - -### 1. Creating a New Payment - -```rust -use heromodels::models::biz::{Payment, PaymentStatus}; - -// Create a new payment with required fields -let payment = Payment::new( - "pi_1234567890".to_string(), // Stripe payment intent ID - company_id, // Company ID from database - "monthly".to_string(), // Payment plan - 100.0, // Setup fee - 49.99, // Monthly fee - 149.99, // Total amount -); - -// Payment defaults: -// - status: PaymentStatus::Pending -// - currency: "usd" -// - stripe_customer_id: None -// - created_at: current timestamp -// - completed_at: None -``` - -### 2. Using Builder Pattern - -```rust -let payment = Payment::new( - "pi_1234567890".to_string(), - company_id, - "yearly".to_string(), - 500.0, - 99.99, - 1699.88, -) -.currency("eur".to_string()) -.stripe_customer_id(Some("cus_existing_customer".to_string())); -``` - -### 3. Database Operations - -```rust -use heromodels::db::Collection; - -// Save payment to database -let db = get_db()?; -let (payment_id, saved_payment) = db.set(&payment)?; - -// Retrieve payment by ID -let retrieved_payment: Payment = db.get_by_id(payment_id)?.unwrap(); - -// Update payment -let updated_payment = saved_payment.complete_payment(Some("cus_new_customer".to_string())); -let (_, final_payment) = db.set(&updated_payment)?; -``` - -## Payment Status Management - -### Status Transitions - -```rust -// 1. Start with Pending status (default) -let payment = Payment::new(/* ... */); -assert!(payment.is_pending()); - -// 2. Mark as processing when Stripe starts processing -let processing_payment = payment.process_payment(); -assert!(processing_payment.is_processing()); - -// 3. Complete payment when Stripe confirms success -let completed_payment = processing_payment.complete_payment(Some("cus_123".to_string())); -assert!(completed_payment.is_completed()); -assert!(completed_payment.completed_at.is_some()); - -// 4. Handle failure if payment fails -let failed_payment = processing_payment.fail_payment(); -assert!(failed_payment.has_failed()); - -// 5. Refund if needed -let refunded_payment = completed_payment.refund_payment(); -assert!(refunded_payment.is_refunded()); -``` - -### Status Check Methods - -```rust -// Check current status -if payment.is_pending() { - // Show "Payment Pending" UI -} else if payment.is_processing() { - // Show "Processing Payment" UI -} else if payment.is_completed() { - // Show "Payment Successful" UI - // Enable company features -} else if payment.has_failed() { - // Show "Payment Failed" UI - // Offer retry option -} else if payment.is_refunded() { - // Show "Payment Refunded" UI -} -``` - -## Integration with Company Model - -### Complete Payment Flow - -```rust -use heromodels::models::biz::{Company, CompanyStatus, Payment, PaymentStatus}; - -// 1. Create company with pending payment status -let company = Company::new( - "TechStart Inc.".to_string(), - "REG-TS-2024-001".to_string(), - chrono::Utc::now().timestamp(), -) -.email("contact@techstart.com".to_string()) -.status(CompanyStatus::PendingPayment); - -let (company_id, company) = db.set(&company)?; - -// 2. Create payment for the company -let payment = Payment::new( - stripe_payment_intent_id, - company_id, - "yearly".to_string(), - 500.0, // Setup fee - 99.0, // Monthly fee - 1688.0, // Total (setup + 12 months) -); - -let (payment_id, payment) = db.set(&payment)?; - -// 3. Process payment through Stripe -let processing_payment = payment.process_payment(); -let (_, processing_payment) = db.set(&processing_payment)?; - -// 4. On successful Stripe webhook -let completed_payment = processing_payment.complete_payment(Some(stripe_customer_id)); -let (_, completed_payment) = db.set(&completed_payment)?; - -// 5. Activate company -let active_company = company.status(CompanyStatus::Active); -let (_, active_company) = db.set(&active_company)?; -``` - -## Database Indexing - -The Payment model provides custom indexes for efficient querying: - -```rust -// Indexed fields for fast lookups: -// - payment_intent_id: Find payment by Stripe intent ID -// - company_id: Find all payments for a company -// - status: Find payments by status - -// Example queries (conceptual - actual implementation depends on your query layer) -// let pending_payments = db.find_by_index("status", "Pending")?; -// let company_payments = db.find_by_index("company_id", company_id.to_string())?; -// let stripe_payment = db.find_by_index("payment_intent_id", "pi_1234567890")?; -``` - -## Error Handling Best Practices - -```rust -use heromodels::db::DbError; - -fn process_payment_flow(payment_intent_id: String, company_id: u32) -> Result { - let db = get_db()?; - - // Create payment - let payment = Payment::new( - payment_intent_id, - company_id, - "monthly".to_string(), - 100.0, - 49.99, - 149.99, - ); - - // Save to database - let (payment_id, payment) = db.set(&payment)?; - - // Process through Stripe (external API call) - match process_stripe_payment(&payment.payment_intent_id) { - Ok(stripe_customer_id) => { - // Success: complete payment - let completed_payment = payment.complete_payment(Some(stripe_customer_id)); - let (_, final_payment) = db.set(&completed_payment)?; - Ok(final_payment) - } - Err(_) => { - // Failure: mark as failed - let failed_payment = payment.fail_payment(); - let (_, final_payment) = db.set(&failed_payment)?; - Ok(final_payment) - } - } -} -``` - -## Testing - -The Payment model includes comprehensive tests in `tests/payment.rs`. When working with payments: - -1. **Always test status transitions** -2. **Verify timestamp handling** -3. **Test database persistence** -4. **Test integration with Company model** -5. **Test builder pattern methods** - -```bash -# Run payment tests -cargo test payment - -# Run specific test -cargo test test_payment_completion -``` - -## Common Patterns - -### 1. Payment Retry Logic -```rust -fn retry_failed_payment(payment: Payment) -> Payment { - if payment.has_failed() { - // Reset to pending for retry - Payment::new( - payment.payment_intent_id, - payment.company_id, - payment.payment_plan, - payment.setup_fee, - payment.monthly_fee, - payment.total_amount, - ) - .currency(payment.currency) - } else { - payment - } -} -``` - -### 2. Payment Summary -```rust -fn get_payment_summary(payment: &Payment) -> String { - format!( - "Payment {} for company {}: {} {} ({})", - payment.payment_intent_id, - payment.company_id, - payment.total_amount, - payment.currency.to_uppercase(), - payment.status - ) -} -``` - -### 3. Payment Validation -```rust -fn validate_payment(payment: &Payment) -> Result<(), String> { - if payment.total_amount <= 0.0 { - return Err("Total amount must be positive".to_string()); - } - if payment.payment_intent_id.is_empty() { - return Err("Payment intent ID is required".to_string()); - } - if payment.company_id == 0 { - return Err("Valid company ID is required".to_string()); - } - Ok(()) -} -``` - -## Key Points for AI Assistants - -1. **Always use auto-generated IDs** - Don't manually set IDs, let OurDB handle them -2. **Follow status flow** - Pending → Processing → Completed/Failed → (optionally) Refunded -3. **Update timestamps** - `completed_at` is automatically set when calling `complete_payment()` -4. **Use builder pattern** - For optional fields and cleaner code -5. **Test thoroughly** - Payment logic is critical, always verify with tests -6. **Handle errors gracefully** - Payment failures should be tracked, not ignored -7. **Integrate with Company** - Payments typically affect company status -8. **Use proper indexing** - Leverage indexed fields for efficient queries - -This model follows the heromodels patterns and integrates seamlessly with the existing codebase architecture. diff --git a/heromodels/docs/prompts/v_specs_to_rust_heromodels.md b/heromodels/docs/prompts/v_specs_to_rust_heromodels.md new file mode 100644 index 0000000..2f97961 --- /dev/null +++ b/heromodels/docs/prompts/v_specs_to_rust_heromodels.md @@ -0,0 +1,301 @@ +# AI Prompt: Convert V Language Specs to Rust Hero Models + +## Objective +Convert V language model specifications (`.v` files) to Rust hero models that integrate with the heromodels framework. The generated Rust models should follow the established patterns for base data embedding, indexing, fluent builder APIs, and Rhai scripting integration. + +## V Language Input Structure Analysis + +### V Spec Patterns to Recognize: +1. **Module Declaration**: `module circle` or `module group` +2. **Base Embedding**: `core.Base` - represents the base model data +3. **Index Fields**: Fields marked with `@[index]` comments +4. **Mutability**: Fields declared with `pub mut:` +5. **Enums**: `pub enum Status { active, inactive, suspended }` +6. **Nested Structs**: Embedded configuration or related data structures +7. **Collections**: `[]u32`, `[]string`, `map[string]string` +8. **References**: `u32` fields typically represent foreign key references + +### Example V Spec Structure: +```v +module circle + +import freeflowuniverse.herolib.hero.models.core + +pub struct User { + core.Base +pub mut: + username string @[index] // Unique username + email []string @[index] // Multiple email addresses + status UserStatus // Enum reference + profile UserProfile // Nested struct + metadata map[string]string // Key-value pairs +} + +pub enum UserStatus { + active + inactive + suspended +} + +pub struct UserProfile { +pub mut: + full_name string + bio string + links map[string]string +} +``` + +## Rust Hero Model Conversion Rules + +### 1. File Structure and Imports +```rust +use heromodels_core::{Model, BaseModelData, IndexKey}; +use heromodels_derive::model; +use rhai::CustomType; +use rhailib_derive::RhaiApi; +use serde::{Deserialize, Serialize}; +use chrono::{DateTime, Utc}; +``` + +### 2. Base Data Embedding +- **V**: `core.Base` +- **Rust**: `pub base_data: BaseModelData,` + +### 3. Index Field Conversion +- **V**: `field_name string @[index]` +- **Rust**: `#[index] pub field_name: String,` + +### 4. Type Mappings +| V Type | Rust Type | +|--------|-----------| +| `string` | `String` | +| `[]string` | `Vec` | +| `[]u32` | `Vec` | +| `u32` | `u32` | +| `u64` | `u64` | +| `f64` | `f64` | +| `bool` | `bool` | +| `map[string]string` | `std::collections::HashMap` | + +### 5. Struct Declaration Pattern +```rust +/// Documentation comment describing the model +#[model] +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, CustomType, Default, RhaiApi)] +pub struct ModelName { + /// Base model data + pub base_data: BaseModelData, + #[index] + pub indexed_field: String, + pub regular_field: String, + pub optional_field: Option, + pub nested_struct: NestedType, + pub collection: Vec, + pub metadata: std::collections::HashMap, +} +``` + +### 6. Enum Conversion +```rust +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +pub enum UserStatus { + Active, + Inactive, + Suspended, +} +``` + +### 7. Fluent Builder Implementation +Every model must implement a fluent builder pattern: + +```rust +impl ModelName { + /// Create a new instance + pub fn new(id: u32) -> Self { + Self { + base_data: BaseModelData::new(id), + indexed_field: String::new(), + regular_field: String::new(), + optional_field: None, + nested_struct: NestedType::new(), + collection: Vec::new(), + metadata: std::collections::HashMap::new(), + } + } + + /// Set indexed field (fluent) + pub fn indexed_field(mut self, value: impl ToString) -> Self { + self.indexed_field = value.to_string(); + self + } + + /// Set regular field (fluent) + pub fn regular_field(mut self, value: impl ToString) -> Self { + self.regular_field = value.to_string(); + self + } + + /// Set optional field (fluent) + pub fn optional_field(mut self, value: impl ToString) -> Self { + self.optional_field = Some(value.to_string()); + self + } + + /// Set nested struct (fluent) + pub fn nested_struct(mut self, value: NestedType) -> Self { + self.nested_struct = value; + self + } + + /// Add to collection (fluent) + pub fn add_to_collection(mut self, value: u32) -> Self { + self.collection.push(value); + self + } + + /// Set entire collection (fluent) + pub fn collection(mut self, value: Vec) -> Self { + self.collection = value; + self + } + + /// Add metadata entry (fluent) + pub fn add_metadata(mut self, key: impl ToString, value: impl ToString) -> Self { + self.metadata.insert(key.to_string(), value.to_string()); + self + } + + /// Build the final instance + pub fn build(self) -> Self { + self + } +} +``` + +### 8. Model Trait Implementation +```rust +impl Model for ModelName { + fn db_prefix() -> &'static str { + "modelname" + } + + fn get_id(&self) -> u32 { + self.base_data.id + } + + fn base_data_mut(&mut self) -> &mut BaseModelData { + &mut self.base_data + } + + fn db_keys(&self) -> Vec { + let mut keys = Vec::new(); + + // Add index keys for fields marked with #[index] + keys.push(IndexKey::new("indexed_field", &self.indexed_field)); + + // Add additional index keys as needed + keys + } +} +``` + +### 9. Nested Struct Builder Pattern +For embedded types, implement similar builder patterns: + +```rust +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +pub struct NestedType { + pub field1: String, + pub field2: String, +} + +impl NestedType { + pub fn new() -> Self { + Self { + field1: String::new(), + field2: String::new(), + } + } + + pub fn field1(mut self, value: impl ToString) -> Self { + self.field1 = value.to_string(); + self + } + + pub fn field2(mut self, value: impl ToString) -> Self { + self.field2 = value.to_string(); + self + } + + pub fn build(self) -> Self { + self + } +} +``` + +## Conversion Steps + +1. **Analyze V Spec Structure** + - Identify the module name and main structs + - Note which fields are marked with `@[index]` + - Identify nested structs and enums + - Map field types from V to Rust + +2. **Create Rust File Structure** + - Add appropriate imports + - Convert enums first (they're often referenced by structs) + - Convert nested structs before main structs + +3. **Implement Main Struct** + - Add `#[model]` macro and derives + - Embed `BaseModelData` as `base_data` + - Mark indexed fields with `#[index]` + - Convert field types according to mapping table + +4. **Implement Builder Pattern** + - Add `new(id: u32)` constructor + - Add fluent setter methods for each field + - Handle optional fields appropriately + - Add collection manipulation methods + +5. **Implement Model Trait** + - Define appropriate `db_prefix` + - Implement required trait methods + - Add index keys for searchable fields + +6. **Add Documentation** + - Document the struct and its purpose + - Document each field's meaning + - Add usage examples in comments + +## Example Usage After Conversion + +```rust +let user = User::new(1) + .username("john_doe") + .add_email("john@example.com") + .add_email("john.doe@company.com") + .status(UserStatus::Active) + .profile( + UserProfile::new() + .full_name("John Doe") + .bio("Software developer") + .build() + ) + .add_metadata("department", "engineering") + .build(); +``` + +## Notes and Best Practices + +1. **Field Naming**: Convert V snake_case to Rust snake_case (usually no change needed) +2. **Optional Fields**: Use `Option` for fields that may be empty in V +3. **Collections**: Always provide both `add_item` and `set_collection` methods +4. **Error Handling**: Builder methods should not panic; use appropriate defaults +5. **Documentation**: Include comprehensive documentation for public APIs +6. **Testing**: Consider adding unit tests for builder patterns +7. **Validation**: Add validation logic in builder methods if needed + +## File Organization + +Place the converted Rust models in the appropriate subdirectory under `heromodels/src/models/` based on the domain (e.g., `user/`, `finance/`, `governance/`, etc.). diff --git a/heromodels/src/models/heroledger/dnsrecord.rs b/heromodels/src/models/heroledger/dnsrecord.rs new file mode 100644 index 0000000..47fc162 --- /dev/null +++ b/heromodels/src/models/heroledger/dnsrecord.rs @@ -0,0 +1,301 @@ +use heromodels_core::{Model, BaseModelData, IndexKey}; +use heromodels_derive::model; +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; + +/// Defines the supported DNS record types +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +pub enum NameType { + A, + AAAA, + CNAME, + MX, + TXT, + SRV, + PTR, + NS, +} + +impl Default for NameType { + fn default() -> Self { + NameType::A + } +} + +/// Category of the DNS record +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +pub enum NameCat { + IPv4, + IPv6, + Mycelium, +} + +impl Default for NameCat { + fn default() -> Self { + NameCat::IPv4 + } +} + +/// Status of a DNS zone +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +pub enum DNSZoneStatus { + Active, + Suspended, + Archived, +} + +impl Default for DNSZoneStatus { + fn default() -> Self { + DNSZoneStatus::Active + } +} + +/// Represents a DNS record configuration +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +pub struct DNSRecord { + pub subdomain: String, + pub record_type: NameType, + pub value: String, + pub priority: u32, + pub ttl: u32, + pub is_active: bool, + pub cat: NameCat, + pub is_wildcard: bool, +} + +impl DNSRecord { + pub fn new() -> Self { + Self { + subdomain: String::new(), + record_type: NameType::default(), + value: String::new(), + priority: 0, + ttl: 3600, + is_active: true, + cat: NameCat::default(), + is_wildcard: false, + } + } + + pub fn subdomain(mut self, subdomain: impl ToString) -> Self { + self.subdomain = subdomain.to_string(); + self + } + + pub fn record_type(mut self, record_type: NameType) -> Self { + self.record_type = record_type; + self + } + + pub fn value(mut self, value: impl ToString) -> Self { + self.value = value.to_string(); + self + } + + pub fn priority(mut self, priority: u32) -> Self { + self.priority = priority; + self + } + + pub fn ttl(mut self, ttl: u32) -> Self { + self.ttl = ttl; + self + } + + pub fn is_active(mut self, is_active: bool) -> Self { + self.is_active = is_active; + self + } + + pub fn cat(mut self, cat: NameCat) -> Self { + self.cat = cat; + self + } + + pub fn is_wildcard(mut self, is_wildcard: bool) -> Self { + self.is_wildcard = is_wildcard; + self + } + + pub fn build(self) -> Self { + self + } +} + +/// SOA (Start of Authority) record for a DNS zone +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +pub struct SOARecord { + pub zone_id: u32, + pub primary_ns: String, + pub admin_email: String, + pub serial: u64, + pub refresh: u32, + pub retry: u32, + pub expire: u32, + pub minimum_ttl: u32, + pub is_active: bool, +} + +impl SOARecord { + pub fn new() -> Self { + Self { + zone_id: 0, + primary_ns: String::new(), + admin_email: String::new(), + serial: 0, + refresh: 3600, + retry: 600, + expire: 604800, + minimum_ttl: 3600, + is_active: true, + } + } + + pub fn zone_id(mut self, zone_id: u32) -> Self { + self.zone_id = zone_id; + self + } + + pub fn primary_ns(mut self, primary_ns: impl ToString) -> Self { + self.primary_ns = primary_ns.to_string(); + self + } + + pub fn admin_email(mut self, admin_email: impl ToString) -> Self { + self.admin_email = admin_email.to_string(); + self + } + + pub fn serial(mut self, serial: u64) -> Self { + self.serial = serial; + self + } + + pub fn refresh(mut self, refresh: u32) -> Self { + self.refresh = refresh; + self + } + + pub fn retry(mut self, retry: u32) -> Self { + self.retry = retry; + self + } + + pub fn expire(mut self, expire: u32) -> Self { + self.expire = expire; + self + } + + pub fn minimum_ttl(mut self, minimum_ttl: u32) -> Self { + self.minimum_ttl = minimum_ttl; + self + } + + pub fn is_active(mut self, is_active: bool) -> Self { + self.is_active = is_active; + self + } + + pub fn build(self) -> Self { + self + } +} + +/// Represents a DNS zone with its configuration and records +#[model] +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)] +pub struct DNSZone { + /// Base model data + pub base_data: BaseModelData, + #[index] + pub domain: String, + pub dnsrecords: Vec, + pub administrators: Vec, + pub status: DNSZoneStatus, + pub metadata: HashMap, + pub soarecord: Vec, +} + +impl DNSZone { + /// Create a new DNS zone instance + pub fn new(id: u32) -> Self { + let mut base_data = BaseModelData::new(); + base_data.update_id(id); + Self { + base_data, + domain: String::new(), + dnsrecords: Vec::new(), + administrators: Vec::new(), + status: DNSZoneStatus::default(), + metadata: HashMap::new(), + soarecord: Vec::new(), + } + } + + /// Set the domain name (fluent) + pub fn domain(mut self, domain: impl ToString) -> Self { + self.domain = domain.to_string(); + self + } + + /// Add a DNS record (fluent) + pub fn add_dnsrecord(mut self, record: DNSRecord) -> Self { + self.dnsrecords.push(record); + self + } + + /// Set all DNS records (fluent) + pub fn dnsrecords(mut self, dnsrecords: Vec) -> Self { + self.dnsrecords = dnsrecords; + self + } + + /// Add an administrator (fluent) + pub fn add_administrator(mut self, admin_id: u32) -> Self { + self.administrators.push(admin_id); + self + } + + /// Set all administrators (fluent) + pub fn administrators(mut self, administrators: Vec) -> Self { + self.administrators = administrators; + self + } + + /// Set the zone status (fluent) + pub fn status(mut self, status: DNSZoneStatus) -> Self { + self.status = status; + self + } + + /// Add metadata entry (fluent) + pub fn add_metadata(mut self, key: impl ToString, value: impl ToString) -> Self { + self.metadata.insert(key.to_string(), value.to_string()); + self + } + + /// Set all metadata (fluent) + pub fn metadata(mut self, metadata: HashMap) -> Self { + self.metadata = metadata; + self + } + + /// Add an SOA record (fluent) + pub fn add_soarecord(mut self, soa: SOARecord) -> Self { + self.soarecord.push(soa); + self + } + + /// Set all SOA records (fluent) + pub fn soarecord(mut self, soarecord: Vec) -> Self { + self.soarecord = soarecord; + self + } + + /// Build the final DNS zone instance + pub fn build(self) -> Self { + self + } +} + + diff --git a/heromodels/src/models/heroledger/group.rs b/heromodels/src/models/heroledger/group.rs new file mode 100644 index 0000000..a01b98d --- /dev/null +++ b/heromodels/src/models/heroledger/group.rs @@ -0,0 +1,236 @@ +use heromodels_core::{Model, BaseModelData, IndexKey}; +use heromodels_derive::model; +use serde::{Deserialize, Serialize}; + +/// Defines the lifecycle of a group +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +pub enum GroupStatus { + Active, + Inactive, + Suspended, + Archived, +} + +impl Default for GroupStatus { + fn default() -> Self { + GroupStatus::Active + } +} + +/// Visibility controls who can discover or view the group +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +pub enum Visibility { + Public, // Anyone can see and request to join + Private, // Only invited users can see the group + Unlisted, // Not visible in search; only accessible by direct link or DNS +} + +impl Default for Visibility { + fn default() -> Self { + Visibility::Public + } +} + +/// GroupConfig holds rules that govern group membership and behavior +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)] +pub struct GroupConfig { + pub max_members: u32, + pub allow_guests: bool, + pub auto_approve: bool, + pub require_invite: bool, +} + +impl GroupConfig { + pub fn new() -> Self { + Self { + max_members: 0, + allow_guests: false, + auto_approve: false, + require_invite: false, + } + } + + pub fn max_members(mut self, max_members: u32) -> Self { + self.max_members = max_members; + self + } + + pub fn allow_guests(mut self, allow_guests: bool) -> Self { + self.allow_guests = allow_guests; + self + } + + pub fn auto_approve(mut self, auto_approve: bool) -> Self { + self.auto_approve = auto_approve; + self + } + + pub fn require_invite(mut self, require_invite: bool) -> Self { + self.require_invite = require_invite; + self + } + + pub fn build(self) -> Self { + self + } +} + +/// Represents a collaborative or access-controlled unit within the system +#[model] +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)] +pub struct Group { + /// Base model data + pub base_data: BaseModelData, + #[index] + pub name: String, + pub description: String, + pub dnsrecords: Vec, + pub administrators: Vec, + pub config: GroupConfig, + pub status: GroupStatus, + pub visibility: Visibility, + pub created: u64, + pub updated: u64, +} + +impl Group { + /// Create a new group instance + pub fn new(id: u32) -> Self { + let mut base_data = BaseModelData::new(); + base_data.update_id(id); + Self { + base_data, + name: String::new(), + description: String::new(), + dnsrecords: Vec::new(), + administrators: Vec::new(), + config: GroupConfig::new(), + status: GroupStatus::default(), + visibility: Visibility::default(), + created: 0, + updated: 0, + } + } + + /// Set the group name (fluent) + pub fn name(mut self, name: impl ToString) -> Self { + self.name = name.to_string(); + self + } + + /// Set the group description (fluent) + pub fn description(mut self, description: impl ToString) -> Self { + self.description = description.to_string(); + self + } + + /// Add a DNS record ID (fluent) + pub fn add_dnsrecord(mut self, dnsrecord_id: u32) -> Self { + self.dnsrecords.push(dnsrecord_id); + self + } + + /// Set all DNS record IDs (fluent) + pub fn dnsrecords(mut self, dnsrecords: Vec) -> Self { + self.dnsrecords = dnsrecords; + self + } + + /// Add an administrator user ID (fluent) + pub fn add_administrator(mut self, user_id: u32) -> Self { + self.administrators.push(user_id); + self + } + + /// Set all administrator user IDs (fluent) + pub fn administrators(mut self, administrators: Vec) -> Self { + self.administrators = administrators; + self + } + + /// Set the group configuration (fluent) + pub fn config(mut self, config: GroupConfig) -> Self { + self.config = config; + self + } + + /// Set the group status (fluent) + pub fn status(mut self, status: GroupStatus) -> Self { + self.status = status; + self + } + + /// Set the group visibility (fluent) + pub fn visibility(mut self, visibility: Visibility) -> Self { + self.visibility = visibility; + self + } + + /// Set the created timestamp (fluent) + pub fn created(mut self, created: u64) -> Self { + self.created = created; + self + } + + /// Set the updated timestamp (fluent) + pub fn updated(mut self, updated: u64) -> Self { + self.updated = updated; + self + } + + /// Build the final group instance + pub fn build(self) -> Self { + self + } +} + + + +/// Represents the membership relationship between users and groups +#[model] +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)] +pub struct UserGroupMembership { + /// Base model data + pub base_data: BaseModelData, + #[index] + pub user_id: u32, + pub group_ids: Vec, +} + +impl UserGroupMembership { + /// Create a new user group membership instance + pub fn new(id: u32) -> Self { + let mut base_data = BaseModelData::new(); + base_data.update_id(id); + Self { + base_data, + user_id: 0, + group_ids: Vec::new(), + } + } + + /// Set the user ID (fluent) + pub fn user_id(mut self, user_id: u32) -> Self { + self.user_id = user_id; + self + } + + /// Add a group ID (fluent) + pub fn add_group_id(mut self, group_id: u32) -> Self { + self.group_ids.push(group_id); + self + } + + /// Set all group IDs (fluent) + pub fn group_ids(mut self, group_ids: Vec) -> Self { + self.group_ids = group_ids; + self + } + + /// Build the final membership instance + pub fn build(self) -> Self { + self + } +} + + diff --git a/heromodels/src/models/heroledger/membership.rs b/heromodels/src/models/heroledger/membership.rs new file mode 100644 index 0000000..bce12b5 --- /dev/null +++ b/heromodels/src/models/heroledger/membership.rs @@ -0,0 +1,115 @@ +use heromodels_core::{Model, BaseModelData, IndexKey}; +use heromodels_derive::model; +use serde::{Deserialize, Serialize}; + +/// Defines the possible roles a member can have +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +pub enum MemberRole { + Owner, + Admin, + Moderator, + Member, + Guest, +} + +impl Default for MemberRole { + fn default() -> Self { + MemberRole::Member + } +} + +/// Represents the current status of membership +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +pub enum MemberStatus { + Active, + Pending, + Suspended, + Removed, +} + +impl Default for MemberStatus { + fn default() -> Self { + MemberStatus::Pending + } +} + +/// Represents a member within a circle +#[model] +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)] +pub struct Member { + /// Base model data + pub base_data: BaseModelData, + #[index] + pub user_id: u32, + pub role: MemberRole, + pub status: MemberStatus, + pub joined_at: u64, + pub invited_by: u32, + pub permissions: Vec, +} + +impl Member { + /// Create a new member instance + pub fn new(id: u32) -> Self { + let mut base_data = BaseModelData::new(); + base_data.update_id(id); + Self { + base_data, + user_id: 0, + role: MemberRole::default(), + status: MemberStatus::default(), + joined_at: 0, + invited_by: 0, + permissions: Vec::new(), + } + } + + /// Set the user ID (fluent) + pub fn user_id(mut self, user_id: u32) -> Self { + self.user_id = user_id; + self + } + + /// Set the member role (fluent) + pub fn role(mut self, role: MemberRole) -> Self { + self.role = role; + self + } + + /// Set the member status (fluent) + pub fn status(mut self, status: MemberStatus) -> Self { + self.status = status; + self + } + + /// Set the joined timestamp (fluent) + pub fn joined_at(mut self, joined_at: u64) -> Self { + self.joined_at = joined_at; + self + } + + /// Set who invited this member (fluent) + pub fn invited_by(mut self, invited_by: u32) -> Self { + self.invited_by = invited_by; + self + } + + /// Add a permission (fluent) + pub fn add_permission(mut self, permission: impl ToString) -> Self { + self.permissions.push(permission.to_string()); + self + } + + /// Set all permissions (fluent) + pub fn permissions(mut self, permissions: Vec) -> Self { + self.permissions = permissions; + self + } + + /// Build the final member instance + pub fn build(self) -> Self { + self + } +} + + diff --git a/heromodels/src/models/heroledger/mod.rs b/heromodels/src/models/heroledger/mod.rs new file mode 100644 index 0000000..4237870 --- /dev/null +++ b/heromodels/src/models/heroledger/mod.rs @@ -0,0 +1,19 @@ +// Export all heroledger model modules +pub mod user; +pub mod group; +pub mod money; +pub mod membership; +pub mod dnsrecord; +pub mod secretbox; +pub mod signature; +pub mod user_kvs; + +// Re-export key types for convenience +pub use user::{User, UserStatus, UserProfile, KYCInfo, KYCStatus, SecretBox}; +pub use group::{Group, UserGroupMembership, GroupStatus, Visibility, GroupConfig}; +pub use money::{Account, Asset, AccountPolicy, AccountPolicyItem, Transaction, AccountStatus, TransactionType, Signature as TransactionSignature}; +pub use membership::{Member, MemberRole, MemberStatus}; +pub use dnsrecord::{DNSZone, DNSRecord, SOARecord, NameType, NameCat, DNSZoneStatus}; +pub use secretbox::{Notary, NotaryStatus, SecretBoxCategory}; +pub use signature::{Signature, SignatureStatus, ObjectType}; +pub use user_kvs::{UserKVS, UserKVSItem}; diff --git a/heromodels/src/models/heroledger/money.rs b/heromodels/src/models/heroledger/money.rs new file mode 100644 index 0000000..9bcb02d --- /dev/null +++ b/heromodels/src/models/heroledger/money.rs @@ -0,0 +1,515 @@ +use heromodels_core::{Model, BaseModelData, IndexKey}; +use heromodels_derive::model; +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; + +/// Represents the status of an account +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +pub enum AccountStatus { + Active, + Inactive, + Suspended, + Archived, +} + +impl Default for AccountStatus { + fn default() -> Self { + AccountStatus::Active + } +} + +/// Represents the type of transaction +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +pub enum TransactionType { + Transfer, + Clawback, + Freeze, + Unfreeze, + Issue, + Burn, +} + +impl Default for TransactionType { + fn default() -> Self { + TransactionType::Transfer + } +} + +/// Represents a signature for transactions +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +pub struct Signature { + pub signer_id: u32, + pub signature: String, + pub timestamp: u64, +} + +impl Signature { + pub fn new() -> Self { + Self { + signer_id: 0, + signature: String::new(), + timestamp: 0, + } + } + + pub fn signer_id(mut self, signer_id: u32) -> Self { + self.signer_id = signer_id; + self + } + + pub fn signature(mut self, signature: impl ToString) -> Self { + self.signature = signature.to_string(); + self + } + + pub fn timestamp(mut self, timestamp: u64) -> Self { + self.timestamp = timestamp; + self + } + + pub fn build(self) -> Self { + self + } +} + +/// Policy item for account operations +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)] +pub struct AccountPolicyItem { + pub signers: Vec, + pub min_signatures: u32, + pub enabled: bool, + pub threshold: f64, + pub recipient: u32, +} + +impl AccountPolicyItem { + pub fn new() -> Self { + Self { + signers: Vec::new(), + min_signatures: 0, + enabled: false, + threshold: 0.0, + recipient: 0, + } + } + + pub fn add_signer(mut self, signer_id: u32) -> Self { + self.signers.push(signer_id); + self + } + + pub fn signers(mut self, signers: Vec) -> Self { + self.signers = signers; + self + } + + pub fn min_signatures(mut self, min_signatures: u32) -> Self { + self.min_signatures = min_signatures; + self + } + + pub fn enabled(mut self, enabled: bool) -> Self { + self.enabled = enabled; + self + } + + pub fn threshold(mut self, threshold: f64) -> Self { + self.threshold = threshold; + self + } + + pub fn recipient(mut self, recipient: u32) -> Self { + self.recipient = recipient; + self + } + + pub fn build(self) -> Self { + self + } +} + +/// Represents an account in the financial system +#[model] +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)] +pub struct Account { + /// Base model data + pub base_data: BaseModelData, + pub owner_id: u32, + #[index] + pub address: String, + pub balance: f64, + pub currency: String, + pub assetid: u32, + pub last_activity: u64, + pub administrators: Vec, + pub accountpolicy: u32, +} + +impl Account { + /// Create a new account instance + pub fn new(id: u32) -> Self { + let mut base_data = BaseModelData::new(); + base_data.update_id(id); + Self { + base_data, + owner_id: 0, + address: String::new(), + balance: 0.0, + currency: String::new(), + assetid: 0, + last_activity: 0, + administrators: Vec::new(), + accountpolicy: 0, + } + } + + /// Set the owner ID (fluent) + pub fn owner_id(mut self, owner_id: u32) -> Self { + self.owner_id = owner_id; + self + } + + /// Set the blockchain address (fluent) + pub fn address(mut self, address: impl ToString) -> Self { + self.address = address.to_string(); + self + } + + /// Set the balance (fluent) + pub fn balance(mut self, balance: f64) -> Self { + self.balance = balance; + self + } + + /// Set the currency (fluent) + pub fn currency(mut self, currency: impl ToString) -> Self { + self.currency = currency.to_string(); + self + } + + /// Set the asset ID (fluent) + pub fn assetid(mut self, assetid: u32) -> Self { + self.assetid = assetid; + self + } + + /// Set the last activity timestamp (fluent) + pub fn last_activity(mut self, last_activity: u64) -> Self { + self.last_activity = last_activity; + self + } + + /// Add an administrator (fluent) + pub fn add_administrator(mut self, admin_id: u32) -> Self { + self.administrators.push(admin_id); + self + } + + /// Set all administrators (fluent) + pub fn administrators(mut self, administrators: Vec) -> Self { + self.administrators = administrators; + self + } + + /// Set the account policy ID (fluent) + pub fn accountpolicy(mut self, accountpolicy: u32) -> Self { + self.accountpolicy = accountpolicy; + self + } + + /// Build the final account instance + pub fn build(self) -> Self { + self + } +} + + + +/// Represents an asset in the financial system +#[model] +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)] +pub struct Asset { + /// Base model data + pub base_data: BaseModelData, + #[index] + pub address: String, + pub assetid: u32, + pub asset_type: String, + pub issuer: u32, + pub supply: f64, + pub decimals: u8, + pub is_frozen: bool, + pub metadata: HashMap, + pub administrators: Vec, + pub min_signatures: u32, +} + +impl Asset { + /// Create a new asset instance + pub fn new(id: u32) -> Self { + let mut base_data = BaseModelData::new(); + base_data.update_id(id); + Self { + base_data, + address: String::new(), + assetid: 0, + asset_type: String::new(), + issuer: 0, + supply: 0.0, + decimals: 0, + is_frozen: false, + metadata: HashMap::new(), + administrators: Vec::new(), + min_signatures: 0, + } + } + + /// Set the blockchain address (fluent) + pub fn address(mut self, address: impl ToString) -> Self { + self.address = address.to_string(); + self + } + + /// Set the asset ID (fluent) + pub fn assetid(mut self, assetid: u32) -> Self { + self.assetid = assetid; + self + } + + /// Set the asset type (fluent) + pub fn asset_type(mut self, asset_type: impl ToString) -> Self { + self.asset_type = asset_type.to_string(); + self + } + + /// Set the issuer (fluent) + pub fn issuer(mut self, issuer: u32) -> Self { + self.issuer = issuer; + self + } + + /// Set the supply (fluent) + pub fn supply(mut self, supply: f64) -> Self { + self.supply = supply; + self + } + + /// Set the decimals (fluent) + pub fn decimals(mut self, decimals: u8) -> Self { + self.decimals = decimals; + self + } + + /// Set the frozen status (fluent) + pub fn is_frozen(mut self, is_frozen: bool) -> Self { + self.is_frozen = is_frozen; + self + } + + /// Add metadata entry (fluent) + pub fn add_metadata(mut self, key: impl ToString, value: impl ToString) -> Self { + self.metadata.insert(key.to_string(), value.to_string()); + self + } + + /// Set all metadata (fluent) + pub fn metadata(mut self, metadata: HashMap) -> Self { + self.metadata = metadata; + self + } + + /// Add an administrator (fluent) + pub fn add_administrator(mut self, admin_id: u32) -> Self { + self.administrators.push(admin_id); + self + } + + /// Set all administrators (fluent) + pub fn administrators(mut self, administrators: Vec) -> Self { + self.administrators = administrators; + self + } + + /// Set minimum signatures required (fluent) + pub fn min_signatures(mut self, min_signatures: u32) -> Self { + self.min_signatures = min_signatures; + self + } + + /// Build the final asset instance + pub fn build(self) -> Self { + self + } +} + + + +/// Represents account policies for various operations +#[model] +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)] +pub struct AccountPolicy { + /// Base model data + pub base_data: BaseModelData, + pub transferpolicy: AccountPolicyItem, + pub adminpolicy: AccountPolicyItem, + pub clawbackpolicy: AccountPolicyItem, + pub freezepolicy: AccountPolicyItem, +} + +impl AccountPolicy { + /// Create a new account policy instance + pub fn new(id: u32) -> Self { + let mut base_data = BaseModelData::new(); + base_data.update_id(id); + Self { + base_data, + transferpolicy: AccountPolicyItem::new(), + adminpolicy: AccountPolicyItem::new(), + clawbackpolicy: AccountPolicyItem::new(), + freezepolicy: AccountPolicyItem::new(), + } + } + + /// Set the transfer policy (fluent) + pub fn transferpolicy(mut self, transferpolicy: AccountPolicyItem) -> Self { + self.transferpolicy = transferpolicy; + self + } + + /// Set the admin policy (fluent) + pub fn adminpolicy(mut self, adminpolicy: AccountPolicyItem) -> Self { + self.adminpolicy = adminpolicy; + self + } + + /// Set the clawback policy (fluent) + pub fn clawbackpolicy(mut self, clawbackpolicy: AccountPolicyItem) -> Self { + self.clawbackpolicy = clawbackpolicy; + self + } + + /// Set the freeze policy (fluent) + pub fn freezepolicy(mut self, freezepolicy: AccountPolicyItem) -> Self { + self.freezepolicy = freezepolicy; + self + } + + /// Build the final account policy instance + pub fn build(self) -> Self { + self + } +} + + + +/// Represents a financial transaction +#[model] +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)] +pub struct Transaction { + /// Base model data + pub base_data: BaseModelData, + pub txid: u32, + pub source: u32, + pub destination: u32, + pub assetid: u32, + pub amount: f64, + pub timestamp: u64, + pub status: String, + pub memo: String, + pub tx_type: TransactionType, + pub signatures: Vec, +} + +impl Transaction { + /// Create a new transaction instance + pub fn new(id: u32) -> Self { + let mut base_data = BaseModelData::new(); + base_data.update_id(id); + Self { + base_data, + txid: 0, + source: 0, + destination: 0, + assetid: 0, + amount: 0.0, + timestamp: 0, + status: String::new(), + memo: String::new(), + tx_type: TransactionType::default(), + signatures: Vec::new(), + } + } + + /// Set the transaction ID (fluent) + pub fn txid(mut self, txid: u32) -> Self { + self.txid = txid; + self + } + + /// Set the source account (fluent) + pub fn source(mut self, source: u32) -> Self { + self.source = source; + self + } + + /// Set the destination account (fluent) + pub fn destination(mut self, destination: u32) -> Self { + self.destination = destination; + self + } + + /// Set the asset ID (fluent) + pub fn assetid(mut self, assetid: u32) -> Self { + self.assetid = assetid; + self + } + + /// Set the amount (fluent) + pub fn amount(mut self, amount: f64) -> Self { + self.amount = amount; + self + } + + /// Set the timestamp (fluent) + pub fn timestamp(mut self, timestamp: u64) -> Self { + self.timestamp = timestamp; + self + } + + /// Set the status (fluent) + pub fn status(mut self, status: impl ToString) -> Self { + self.status = status.to_string(); + self + } + + /// Set the memo (fluent) + pub fn memo(mut self, memo: impl ToString) -> Self { + self.memo = memo.to_string(); + self + } + + /// Set the transaction type (fluent) + pub fn tx_type(mut self, tx_type: TransactionType) -> Self { + self.tx_type = tx_type; + self + } + + /// Add a signature (fluent) + pub fn add_signature(mut self, signature: Signature) -> Self { + self.signatures.push(signature); + self + } + + /// Set all signatures (fluent) + pub fn signatures(mut self, signatures: Vec) -> Self { + self.signatures = signatures; + self + } + + /// Build the final transaction instance + pub fn build(self) -> Self { + self + } +} + + diff --git a/heromodels/src/models/heroledger/secretbox.rs b/heromodels/src/models/heroledger/secretbox.rs new file mode 100644 index 0000000..4f93e39 --- /dev/null +++ b/heromodels/src/models/heroledger/secretbox.rs @@ -0,0 +1,142 @@ +use heromodels_core::{Model, BaseModelData, IndexKey}; +use heromodels_derive::model; +use serde::{Deserialize, Serialize}; + +/// Category of the secret box +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +pub enum SecretBoxCategory { + Profile, +} + +impl Default for SecretBoxCategory { + fn default() -> Self { + SecretBoxCategory::Profile + } +} + +/// Status of a notary +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +pub enum NotaryStatus { + Active, + Inactive, + Suspended, + Archived, + Error, +} + +impl Default for NotaryStatus { + fn default() -> Self { + NotaryStatus::Active + } +} + +/// Represents an encrypted secret box for storing sensitive data +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +pub struct SecretBox { + pub notary_id: u32, + pub value: String, + pub version: u16, + pub timestamp: u64, + pub cat: SecretBoxCategory, +} + +impl SecretBox { + pub fn new() -> Self { + Self { + notary_id: 0, + value: String::new(), + version: 1, + timestamp: 0, + cat: SecretBoxCategory::default(), + } + } + + pub fn notary_id(mut self, notary_id: u32) -> Self { + self.notary_id = notary_id; + self + } + + pub fn value(mut self, value: impl ToString) -> Self { + self.value = value.to_string(); + self + } + + pub fn version(mut self, version: u16) -> Self { + self.version = version; + self + } + + pub fn timestamp(mut self, timestamp: u64) -> Self { + self.timestamp = timestamp; + self + } + + pub fn cat(mut self, cat: SecretBoxCategory) -> Self { + self.cat = cat; + self + } + + pub fn build(self) -> Self { + self + } +} + +/// Represents a notary who can decrypt secret boxes +#[model] +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)] +pub struct Notary { + /// Base model data + pub base_data: BaseModelData, + #[index] + pub userid: u32, + pub status: NotaryStatus, + pub myceliumaddress: String, + #[index] + pub pubkey: String, +} + +impl Notary { + /// Create a new notary instance + pub fn new(id: u32) -> Self { + let mut base_data = BaseModelData::new(); + base_data.update_id(id); + Self { + base_data, + userid: 0, + status: NotaryStatus::default(), + myceliumaddress: String::new(), + pubkey: String::new(), + } + } + + /// Set the user ID (fluent) + pub fn userid(mut self, userid: u32) -> Self { + self.userid = userid; + self + } + + /// Set the notary status (fluent) + pub fn status(mut self, status: NotaryStatus) -> Self { + self.status = status; + self + } + + /// Set the mycelium address (fluent) + pub fn myceliumaddress(mut self, myceliumaddress: impl ToString) -> Self { + self.myceliumaddress = myceliumaddress.to_string(); + self + } + + /// Set the public key (fluent) + pub fn pubkey(mut self, pubkey: impl ToString) -> Self { + self.pubkey = pubkey.to_string(); + self + } + + /// Build the final notary instance + pub fn build(self) -> Self { + self + } +} + + diff --git a/heromodels/src/models/heroledger/signature.rs b/heromodels/src/models/heroledger/signature.rs new file mode 100644 index 0000000..c97cf89 --- /dev/null +++ b/heromodels/src/models/heroledger/signature.rs @@ -0,0 +1,120 @@ +use heromodels_core::{Model, BaseModelData, IndexKey}; +use heromodels_derive::model; +use serde::{Deserialize, Serialize}; + +/// Status of a signature +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +pub enum SignatureStatus { + Active, + Inactive, + Pending, + Revoked, +} + +impl Default for SignatureStatus { + fn default() -> Self { + SignatureStatus::Pending + } +} + +/// Type of object being signed +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +pub enum ObjectType { + Account, + DNSRecord, + Membership, + User, + Transaction, + KYC, +} + +impl Default for ObjectType { + fn default() -> Self { + ObjectType::User + } +} + +/// Represents a cryptographic signature for various objects +#[model] +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)] +pub struct Signature { + /// Base model data + pub base_data: BaseModelData, + #[index] + pub signature_id: u32, + #[index] + pub user_id: u32, + pub value: String, + #[index] + pub objectid: u32, + pub objecttype: ObjectType, + pub status: SignatureStatus, + pub timestamp: u64, +} + +impl Signature { + /// Create a new signature instance + pub fn new(id: u32) -> Self { + let mut base_data = BaseModelData::new(); + base_data.update_id(id); + Self { + base_data, + signature_id: 0, + user_id: 0, + value: String::new(), + objectid: 0, + objecttype: ObjectType::default(), + status: SignatureStatus::default(), + timestamp: 0, + } + } + + /// Set the signature ID (fluent) + pub fn signature_id(mut self, signature_id: u32) -> Self { + self.signature_id = signature_id; + self + } + + /// Set the user ID (fluent) + pub fn user_id(mut self, user_id: u32) -> Self { + self.user_id = user_id; + self + } + + /// Set the signature value (fluent) + pub fn value(mut self, value: impl ToString) -> Self { + self.value = value.to_string(); + self + } + + /// Set the object ID (fluent) + pub fn objectid(mut self, objectid: u32) -> Self { + self.objectid = objectid; + self + } + + /// Set the object type (fluent) + pub fn objecttype(mut self, objecttype: ObjectType) -> Self { + self.objecttype = objecttype; + self + } + + /// Set the signature status (fluent) + pub fn status(mut self, status: SignatureStatus) -> Self { + self.status = status; + self + } + + /// Set the timestamp (fluent) + pub fn timestamp(mut self, timestamp: u64) -> Self { + self.timestamp = timestamp; + self + } + + /// Build the final signature instance + pub fn build(self) -> Self { + self + } +} + + diff --git a/heromodels/src/models/heroledger/user.rs b/heromodels/src/models/heroledger/user.rs new file mode 100644 index 0000000..b9d34d3 --- /dev/null +++ b/heromodels/src/models/heroledger/user.rs @@ -0,0 +1,370 @@ +use heromodels_core::{Model, BaseModelData, IndexKey}; +use heromodels_derive::model; +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; + +/// Represents the status of a user in the system +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +pub enum UserStatus { + Active, + Inactive, + Suspended, + Archived, +} + +impl Default for UserStatus { + fn default() -> Self { + UserStatus::Active + } +} + +/// Represents the KYC status of a user +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +pub enum KYCStatus { + Pending, + Approved, + Rejected, +} + +impl Default for KYCStatus { + fn default() -> Self { + KYCStatus::Pending + } +} + +/// User profile information +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +pub struct UserProfile { + pub user_id: u32, + pub full_name: String, + pub bio: String, + pub profile_pic: String, + pub links: HashMap, + pub metadata: HashMap, +} + +impl UserProfile { + pub fn new() -> Self { + Self { + user_id: 0, + full_name: String::new(), + bio: String::new(), + profile_pic: String::new(), + links: HashMap::new(), + metadata: HashMap::new(), + } + } + + pub fn user_id(mut self, user_id: u32) -> Self { + self.user_id = user_id; + self + } + + pub fn full_name(mut self, full_name: impl ToString) -> Self { + self.full_name = full_name.to_string(); + self + } + + pub fn bio(mut self, bio: impl ToString) -> Self { + self.bio = bio.to_string(); + self + } + + pub fn profile_pic(mut self, profile_pic: impl ToString) -> Self { + self.profile_pic = profile_pic.to_string(); + self + } + + pub fn add_link(mut self, key: impl ToString, value: impl ToString) -> Self { + self.links.insert(key.to_string(), value.to_string()); + self + } + + pub fn links(mut self, links: HashMap) -> Self { + self.links = links; + self + } + + pub fn add_metadata(mut self, key: impl ToString, value: impl ToString) -> Self { + self.metadata.insert(key.to_string(), value.to_string()); + self + } + + pub fn metadata(mut self, metadata: HashMap) -> Self { + self.metadata = metadata; + self + } + + pub fn build(self) -> Self { + self + } +} + +/// KYC (Know Your Customer) information for a user +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +pub struct KYCInfo { + pub user_id: u32, + pub full_name: String, + pub date_of_birth: u64, + pub address: String, + pub phone_number: String, + pub id_number: String, + pub id_type: String, + pub id_expiry: u64, + pub kyc_status: KYCStatus, + pub kyc_verified: bool, + pub kyc_verified_by: u32, + pub kyc_verified_at: u64, + pub kyc_rejected_reason: String, + pub kyc_signature: u32, + pub metadata: HashMap, +} + +impl KYCInfo { + pub fn new() -> Self { + Self { + user_id: 0, + full_name: String::new(), + date_of_birth: 0, + address: String::new(), + phone_number: String::new(), + id_number: String::new(), + id_type: String::new(), + id_expiry: 0, + kyc_status: KYCStatus::default(), + kyc_verified: false, + kyc_verified_by: 0, + kyc_verified_at: 0, + kyc_rejected_reason: String::new(), + kyc_signature: 0, + metadata: HashMap::new(), + } + } + + pub fn user_id(mut self, user_id: u32) -> Self { + self.user_id = user_id; + self + } + + pub fn full_name(mut self, full_name: impl ToString) -> Self { + self.full_name = full_name.to_string(); + self + } + + pub fn date_of_birth(mut self, date_of_birth: u64) -> Self { + self.date_of_birth = date_of_birth; + self + } + + pub fn address(mut self, address: impl ToString) -> Self { + self.address = address.to_string(); + self + } + + pub fn phone_number(mut self, phone_number: impl ToString) -> Self { + self.phone_number = phone_number.to_string(); + self + } + + pub fn id_number(mut self, id_number: impl ToString) -> Self { + self.id_number = id_number.to_string(); + self + } + + pub fn id_type(mut self, id_type: impl ToString) -> Self { + self.id_type = id_type.to_string(); + self + } + + pub fn id_expiry(mut self, id_expiry: u64) -> Self { + self.id_expiry = id_expiry; + self + } + + pub fn kyc_status(mut self, kyc_status: KYCStatus) -> Self { + self.kyc_status = kyc_status; + self + } + + pub fn kyc_verified(mut self, kyc_verified: bool) -> Self { + self.kyc_verified = kyc_verified; + self + } + + pub fn kyc_verified_by(mut self, kyc_verified_by: u32) -> Self { + self.kyc_verified_by = kyc_verified_by; + self + } + + pub fn kyc_verified_at(mut self, kyc_verified_at: u64) -> Self { + self.kyc_verified_at = kyc_verified_at; + self + } + + pub fn kyc_rejected_reason(mut self, kyc_rejected_reason: impl ToString) -> Self { + self.kyc_rejected_reason = kyc_rejected_reason.to_string(); + self + } + + pub fn kyc_signature(mut self, kyc_signature: u32) -> Self { + self.kyc_signature = kyc_signature; + self + } + + pub fn add_metadata(mut self, key: impl ToString, value: impl ToString) -> Self { + self.metadata.insert(key.to_string(), value.to_string()); + self + } + + pub fn metadata(mut self, metadata: HashMap) -> Self { + self.metadata = metadata; + self + } + + pub fn build(self) -> Self { + self + } +} + +/// Represents a secret box for storing encrypted data +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +pub struct SecretBox { + pub data: Vec, + pub nonce: Vec, +} + +impl SecretBox { + pub fn new() -> Self { + Self { + data: Vec::new(), + nonce: Vec::new(), + } + } + + pub fn data(mut self, data: Vec) -> Self { + self.data = data; + self + } + + pub fn nonce(mut self, nonce: Vec) -> Self { + self.nonce = nonce; + self + } + + pub fn build(self) -> Self { + self + } +} + +/// Represents a user in the heroledger system +#[model] +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +pub struct User { + /// Base model data + pub base_data: BaseModelData, + #[index] + pub username: String, + #[index] + pub pubkey: String, + pub email: Vec, + pub status: UserStatus, + pub userprofile: Vec, + pub kyc: Vec, +} + +impl Default for User { + fn default() -> Self { + Self { + base_data: BaseModelData::new(), + username: String::new(), + pubkey: String::new(), + email: Vec::new(), + status: UserStatus::default(), + userprofile: Vec::new(), + kyc: Vec::new(), + } + } +} + +impl User { + /// Create a new user instance + pub fn new(id: u32) -> Self { + let mut base_data = BaseModelData::new(); + base_data.update_id(id); + Self { + base_data, + username: String::new(), + pubkey: String::new(), + email: Vec::new(), + status: UserStatus::default(), + userprofile: Vec::new(), + kyc: Vec::new(), + } + } + + /// Get the user ID + pub fn id(&self) -> u32 { + self.base_data.id + } + + /// Set the username (fluent) + pub fn username(mut self, username: impl ToString) -> Self { + self.username = username.to_string(); + self + } + + /// Set the public key (fluent) + pub fn pubkey(mut self, pubkey: impl ToString) -> Self { + self.pubkey = pubkey.to_string(); + self + } + + /// Add an email address (fluent) + pub fn add_email(mut self, email: impl ToString) -> Self { + self.email.push(email.to_string()); + self + } + + /// Set all email addresses (fluent) + pub fn email(mut self, email: Vec) -> Self { + self.email = email; + self + } + + /// Set the user status (fluent) + pub fn status(mut self, status: UserStatus) -> Self { + self.status = status; + self + } + + /// Add a user profile secret box (fluent) + pub fn add_userprofile(mut self, profile: SecretBox) -> Self { + self.userprofile.push(profile); + self + } + + /// Set all user profile secret boxes (fluent) + pub fn userprofile(mut self, userprofile: Vec) -> Self { + self.userprofile = userprofile; + self + } + + /// Add a KYC secret box (fluent) + pub fn add_kyc(mut self, kyc: SecretBox) -> Self { + self.kyc.push(kyc); + self + } + + /// Set all KYC secret boxes (fluent) + pub fn kyc(mut self, kyc: Vec) -> Self { + self.kyc = kyc; + self + } + + /// Build the final user instance + pub fn build(self) -> Self { + self + } +} + + diff --git a/heromodels/src/models/heroledger/user_kvs.rs b/heromodels/src/models/heroledger/user_kvs.rs new file mode 100644 index 0000000..da64ecf --- /dev/null +++ b/heromodels/src/models/heroledger/user_kvs.rs @@ -0,0 +1,120 @@ +use heromodels_core::{Model, BaseModelData, IndexKey}; +use heromodels_derive::model; +use serde::{Deserialize, Serialize}; +use super::secretbox::SecretBox; + +/// Represents a per-user key-value store +#[model] +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)] +pub struct UserKVS { + /// Base model data + pub base_data: BaseModelData, + #[index] + pub userid: u32, + pub name: String, +} + +impl UserKVS { + /// Create a new user KVS instance + pub fn new(id: u32) -> Self { + let mut base_data = BaseModelData::new(); + base_data.update_id(id); + Self { + base_data, + userid: 0, + name: String::new(), + } + } + + /// Set the user ID (fluent) + pub fn userid(mut self, userid: u32) -> Self { + self.userid = userid; + self + } + + /// Set the KVS name (fluent) + pub fn name(mut self, name: impl ToString) -> Self { + self.name = name.to_string(); + self + } + + /// Build the final user KVS instance + pub fn build(self) -> Self { + self + } +} + + + +/// Represents an item in a user's key-value store +#[model] +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)] +pub struct UserKVSItem { + /// Base model data + pub base_data: BaseModelData, + #[index] + pub userkvs_id: u32, + pub key: String, + pub value: String, + pub secretbox: Vec, + pub timestamp: u64, +} + +impl UserKVSItem { + /// Create a new user KVS item instance + pub fn new(id: u32) -> Self { + let mut base_data = BaseModelData::new(); + base_data.update_id(id); + Self { + base_data, + userkvs_id: 0, + key: String::new(), + value: String::new(), + secretbox: Vec::new(), + timestamp: 0, + } + } + + /// Set the user KVS ID (fluent) + pub fn userkvs_id(mut self, userkvs_id: u32) -> Self { + self.userkvs_id = userkvs_id; + self + } + + /// Set the key (fluent) + pub fn key(mut self, key: impl ToString) -> Self { + self.key = key.to_string(); + self + } + + /// Set the value (fluent) + pub fn value(mut self, value: impl ToString) -> Self { + self.value = value.to_string(); + self + } + + /// Add a secret box (fluent) + pub fn add_secretbox(mut self, secretbox: SecretBox) -> Self { + self.secretbox.push(secretbox); + self + } + + /// Set all secret boxes (fluent) + pub fn secretbox(mut self, secretbox: Vec) -> Self { + self.secretbox = secretbox; + self + } + + /// Set the timestamp (fluent) + pub fn timestamp(mut self, timestamp: u64) -> Self { + self.timestamp = timestamp; + self + } + + /// Build the final user KVS item instance + pub fn build(self) -> Self { + self + } +} + + diff --git a/heromodels/src/models/mod.rs b/heromodels/src/models/mod.rs index 305777b..b1cd40f 100644 --- a/heromodels/src/models/mod.rs +++ b/heromodels/src/models/mod.rs @@ -10,6 +10,7 @@ pub mod contact; pub mod finance; pub mod flow; pub mod governance; +pub mod heroledger; pub mod legal; pub mod library; pub mod object; From 0cffda37a7816dc5f921aead30b2ed391f2de586 Mon Sep 17 00:00:00 2001 From: Maxime Van Hees Date: Tue, 5 Aug 2025 13:00:09 +0200 Subject: [PATCH 2/2] fixed dependencies issues --- Cargo.lock | 2056 ++++++++++++++++++++++++ Cargo.toml | 9 + heromodels/Cargo.toml | 1 - heromodels/src/models/object/object.rs | 3 +- 4 files changed, 2066 insertions(+), 3 deletions(-) create mode 100644 Cargo.lock create mode 100644 Cargo.toml diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..ebd6a16 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,2056 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "addr2line" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "ahash" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" +dependencies = [ + "cfg-if", + "const-random", + "getrandom 0.3.3", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "anes" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" + +[[package]] +name = "anstyle" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd" + +[[package]] +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" + +[[package]] +name = "async-trait" +version = "0.1.88" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e539d3fca749fcee5236ab05e93a52867dd549cc157c8cb7f99595f3cedffdb5" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + +[[package]] +name = "backtrace" +version = "0.3.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6806a6321ec58106fea15becdad98371e28d92ccbc7c8f1b3b6dd724fe8f1002" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-targets 0.52.6", +] + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "bincode" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36eaf5d7b090263e8150820482d5d93cd964a81e4019913c972f4edcc6edb740" +dependencies = [ + "bincode_derive", + "serde", + "unty", +] + +[[package]] +name = "bincode_derive" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf95709a440f45e986983918d0e8a1f30a9b1df04918fc828670606804ac3c09" +dependencies = [ + "virtue", +] + +[[package]] +name = "bitflags" +version = "2.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bumpalo" +version = "3.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" + +[[package]] +name = "cast" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" + +[[package]] +name = "cc" +version = "1.2.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3a42d84bb6b69d3a8b3eaacf0d88f179e1929695e1ad012b6cf64d9caaa5fd2" +dependencies = [ + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" + +[[package]] +name = "chrono" +version = "0.4.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c469d952047f47f91b68d1cba3f10d63c11d73e4636f24f08daf0278abf01c4d" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "js-sys", + "num-traits", + "serde", + "wasm-bindgen", + "windows-link", +] + +[[package]] +name = "ciborium" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42e69ffd6f0917f5c029256a24d0161db17cea3997d185db0d35926308770f0e" +dependencies = [ + "ciborium-io", + "ciborium-ll", + "serde", +] + +[[package]] +name = "ciborium-io" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05afea1e0a06c9be33d539b876f1ce3692f4afea2cb41f740e7743225ed1c757" + +[[package]] +name = "ciborium-ll" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9" +dependencies = [ + "ciborium-io", + "half", +] + +[[package]] +name = "clap" +version = "4.5.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed87a9d530bb41a67537289bafcac159cb3ee28460e0a4571123d2a778a6a882" +dependencies = [ + "clap_builder", +] + +[[package]] +name = "clap_builder" +version = "4.5.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64f4f3f3c77c94aff3c7e9aac9a2ca1974a5adf392a8bb751e827d6d127ab966" +dependencies = [ + "anstyle", + "clap_lex", +] + +[[package]] +name = "clap_lex" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675" + +[[package]] +name = "const-random" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87e00182fe74b066627d63b85fd550ac2998d4b0bd86bfed477a0ae4c7c71359" +dependencies = [ + "const-random-macro", +] + +[[package]] +name = "const-random-macro" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e" +dependencies = [ + "getrandom 0.2.16", + "once_cell", + "tiny-keccak", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "criterion" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2b12d017a929603d80db1831cd3a24082f8137ce19c69e6447f54f5fc8d692f" +dependencies = [ + "anes", + "cast", + "ciborium", + "clap", + "criterion-plot", + "is-terminal", + "itertools", + "num-traits", + "once_cell", + "oorandom", + "plotters", + "rayon", + "regex", + "serde", + "serde_derive", + "serde_json", + "tinytemplate", + "walkdir", +] + +[[package]] +name = "criterion-plot" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b50826342786a51a89e2da3a28f1c32b06e387201bc2d19791f622c673706b1" +dependencies = [ + "cast", + "itertools", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "crunchy" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", + "subtle", +] + +[[package]] +name = "either" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "778e2ac28f6c47af28e4907f13ffd1e1ddbd400980a9abd7c8df189bf578a5ad" +dependencies = [ + "libc", + "windows-sys 0.60.2", +] + +[[package]] +name = "ethnum" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca81e6b4777c89fd810c25a4be2b1bd93ea034fbe58e6a75216a34c6b82c539b" + +[[package]] +name = "fallible-iterator" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" + +[[package]] +name = "fast-float2" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8eb564c5c7423d25c886fb561d1e4ee69f72354d16918afa32c08811f6b6a55" + +[[package]] +name = "fastrand" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" + +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-macro" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-core", + "futures-macro", + "futures-sink", + "futures-task", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.11.1+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasi 0.14.2+wasi-0.2.4", +] + +[[package]] +name = "gimli" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" + +[[package]] +name = "half" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "459196ed295495a68f7d7fe1d84f6c4b7ff0e21fe3017b2f283c6fac3ad803c9" +dependencies = [ + "cfg-if", + "crunchy", +] + +[[package]] +name = "hashbrown" +version = "0.15.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hermit-abi" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c" + +[[package]] +name = "heromodels" +version = "0.1.0" +dependencies = [ + "bincode", + "chrono", + "heromodels-derive", + "heromodels_core", + "jsonb", + "ourdb", + "postgres", + "r2d2", + "r2d2_postgres", + "rhai", + "serde", + "serde_json", + "strum", + "strum_macros", + "tokio", + "tst", + "uuid", +] + +[[package]] +name = "heromodels-derive" +version = "0.1.0" +dependencies = [ + "proc-macro2", + "quote", + "serde", + "syn", +] + +[[package]] +name = "heromodels_core" +version = "0.1.0" +dependencies = [ + "chrono", + "serde", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0c919e5debc312ad217002b8048a17b7d83f80703865bbfcfebb0458b0b27d8" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "indexmap" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "instant" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "io-uring" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d93587f37623a1a17d94ef2bc9ada592f5465fe7732084ab7beefabe5c77c0c4" +dependencies = [ + "bitflags", + "cfg-if", + "libc", +] + +[[package]] +name = "is-terminal" +version = "0.4.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e04d7f318608d35d4b61ddd75cbdaee86b023ebe2bd5a66ee0915f0bf93095a9" +dependencies = [ + "hermit-abi", + "libc", + "windows-sys 0.59.0", +] + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" + +[[package]] +name = "jiff" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be1f93b8b1eb69c77f24bbb0afdf66f54b632ee39af40ca21c4365a1d7347e49" +dependencies = [ + "jiff-static", + "jiff-tzdb-platform", + "log", + "portable-atomic", + "portable-atomic-util", + "serde", + "windows-sys 0.59.0", +] + +[[package]] +name = "jiff-static" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03343451ff899767262ec32146f6d559dd759fdadf42ff0e227c7c48f72594b4" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "jiff-tzdb" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1283705eb0a21404d2bfd6eef2a7593d240bc42a0bdb39db0ad6fa2ec026524" + +[[package]] +name = "jiff-tzdb-platform" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "875a5a69ac2bab1a891711cf5eccbec1ce0341ea805560dcd90b7a2e925132e8" +dependencies = [ + "jiff-tzdb", +] + +[[package]] +name = "js-sys" +version = "0.3.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "jsonb" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96cbb4fba292867a2d86ed83dbe5f9d036f423bf6a491b7d884058b2fde42fcd" +dependencies = [ + "byteorder", + "ethnum", + "fast-float2", + "itoa", + "jiff", + "nom", + "num-traits", + "ordered-float", + "rand 0.9.2", + "ryu", + "serde", + "serde_json", +] + +[[package]] +name = "libc" +version = "0.2.174" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776" + +[[package]] +name = "linux-raw-sys" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" + +[[package]] +name = "lock_api" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96936507f153605bddfcda068dd804796c84324ed2510809e5b2a624c81da765" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" + +[[package]] +name = "md-5" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" +dependencies = [ + "cfg-if", + "digest", +] + +[[package]] +name = "memchr" +version = "2.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" + +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", +] + +[[package]] +name = "mio" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c" +dependencies = [ + "libc", + "wasi 0.11.1+wasi-snapshot-preview1", + "windows-sys 0.59.0", +] + +[[package]] +name = "no-std-compat" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b93853da6d84c2e3c7d730d6473e8817692dd89be387eb01b94d7f108ecb5b8c" +dependencies = [ + "spin", +] + +[[package]] +name = "nom" +version = "8.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405" +dependencies = [ + "memchr", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "object" +version = "0.36.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +dependencies = [ + "portable-atomic", +] + +[[package]] +name = "oorandom" +version = "11.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6790f58c7ff633d8771f42965289203411a5e5c68388703c06e14f24770b41e" + +[[package]] +name = "ordered-float" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2c1f9f56e534ac6a9b8a4600bdf0f530fb393b5f393e7b4d03489c3cf0c3f01" +dependencies = [ + "num-traits", +] + +[[package]] +name = "ourdb" +version = "0.1.0" +dependencies = [ + "crc32fast", + "criterion", + "log", + "rand 0.8.5", + "tempfile", + "thiserror", +] + +[[package]] +name = "parking_lot" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70d58bf43669b5795d1576d0641cfb6fbb2057bf629506267a92807158584a13" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc838d2a56b5b1a6c25f55575dfc605fabb63bb2365f6c2353ef9159aa69e4a5" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets 0.52.6", +] + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "phf" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078" +dependencies = [ + "phf_shared", +] + +[[package]] +name = "phf_shared" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" +dependencies = [ + "siphasher", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "plotters" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aeb6f403d7a4911efb1e33402027fc44f29b5bf6def3effcc22d7bb75f2b747" +dependencies = [ + "num-traits", + "plotters-backend", + "plotters-svg", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "plotters-backend" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df42e13c12958a16b3f7f4386b9ab1f3e7933914ecea48da7139435263a4172a" + +[[package]] +name = "plotters-svg" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51bae2ac328883f7acdfea3d66a7c35751187f870bc81f94563733a154d7a670" +dependencies = [ + "plotters-backend", +] + +[[package]] +name = "portable-atomic" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" + +[[package]] +name = "portable-atomic-util" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +dependencies = [ + "portable-atomic", +] + +[[package]] +name = "postgres" +version = "0.19.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "363e6dfbdd780d3aa3597b6eb430db76bb315fa9bad7fae595bb8def808b8470" +dependencies = [ + "bytes", + "fallible-iterator", + "futures-util", + "log", + "tokio", + "tokio-postgres", +] + +[[package]] +name = "postgres-protocol" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76ff0abab4a9b844b93ef7b81f1efc0a366062aaef2cd702c76256b5dc075c54" +dependencies = [ + "base64", + "byteorder", + "bytes", + "fallible-iterator", + "hmac", + "md-5", + "memchr", + "rand 0.9.2", + "sha2", + "stringprep", +] + +[[package]] +name = "postgres-types" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613283563cd90e1dfc3518d548caee47e0e725455ed619881f5cf21f36de4b48" +dependencies = [ + "bytes", + "fallible-iterator", + "postgres-protocol", + "serde", + "serde_json", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "proc-macro2" +version = "1.0.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "r2d2" +version = "0.8.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51de85fb3fb6524929c8a2eb85e6b6d363de4e8c48f9e2c2eac4944abc181c93" +dependencies = [ + "log", + "parking_lot", + "scheduled-thread-pool", +] + +[[package]] +name = "r2d2_postgres" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "efd4b47636dbca581cd057e2f27a5d39be741ea4f85fd3c29e415c55f71c7595" +dependencies = [ + "postgres", + "r2d2", +] + +[[package]] +name = "radixtree" +version = "0.1.0" +dependencies = [ + "criterion", + "log", + "ourdb", + "tempfile", + "thiserror", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.16", +] + +[[package]] +name = "rand_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom 0.3.3", +] + +[[package]] +name = "rayon" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "redox_syscall" +version = "0.5.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5407465600fb0548f1442edf71dd20683c6ed326200ace4b1ef0763521bb3b77" +dependencies = [ + "bitflags", +] + +[[package]] +name = "regex" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" + +[[package]] +name = "rhai" +version = "1.22.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2780e813b755850e50b178931aaf94ed24f6817f46aaaf5d21c13c12d939a249" +dependencies = [ + "ahash", + "bitflags", + "instant", + "no-std-compat", + "num-traits", + "once_cell", + "rhai_codegen", + "rust_decimal", + "smallvec", + "smartstring", + "thin-vec", +] + +[[package]] +name = "rhai_codegen" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5a11a05ee1ce44058fa3d5961d05194fdbe3ad6b40f904af764d81b86450e6b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "rust_decimal" +version = "1.37.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b203a6425500a03e0919c42d3c47caca51e79f1132046626d2c8871c5092035d" +dependencies = [ + "arrayvec", + "num-traits", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace" + +[[package]] +name = "rustix" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11181fbabf243db407ef8df94a6ce0b2f9a733bd8be4ad02b4eda9602296cac8" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.60.2", +] + +[[package]] +name = "rustversion" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d" + +[[package]] +name = "ryu" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "scheduled-thread-pool" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cbc66816425a074528352f5789333ecff06ca41b36b0b0efdfbb29edc391a19" +dependencies = [ + "parking_lot", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "serde" +version = "1.0.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.142" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "030fedb782600dcbd6f02d479bf0d817ac3bb40d644745b769d6a96bc3afc5a7" +dependencies = [ + "indexmap", + "itoa", + "memchr", + "ryu", + "serde", +] + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signal-hook-registry" +version = "1.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a4719bff48cee6b39d12c020eeb490953ad2443b7055bd0b21fca26bd8c28b" +dependencies = [ + "libc", +] + +[[package]] +name = "siphasher" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" + +[[package]] +name = "slab" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04dc19736151f35336d325007ac991178d504a119863a2fcb3758cdb5e52c50d" + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" + +[[package]] +name = "smartstring" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fb72c633efbaa2dd666986505016c32c3044395ceaf881518399d2f4127ee29" +dependencies = [ + "autocfg", + "static_assertions", + "version_check", +] + +[[package]] +name = "socket2" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "socket2" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "233504af464074f9d066d7b5416c5f9b894a5862a6506e306f7b816cdd6f1807" +dependencies = [ + "libc", + "windows-sys 0.59.0", +] + +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "stringprep" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b4df3d392d81bd458a8a621b8bffbd2302a12ffe288a9d931670948749463b1" +dependencies = [ + "unicode-bidi", + "unicode-normalization", + "unicode-properties", +] + +[[package]] +name = "strum" +version = "0.26.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" + +[[package]] +name = "strum_macros" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn", +] + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "2.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tempfile" +version = "3.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8a64e3985349f2441a1a9ef0b853f869006c3855f2cda6862a94d26ebb9d6a1" +dependencies = [ + "fastrand", + "getrandom 0.3.3", + "once_cell", + "rustix", + "windows-sys 0.59.0", +] + +[[package]] +name = "thin-vec" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "144f754d318415ac792f9d69fc87abbbfc043ce2ef041c60f16ad828f638717d" + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + +[[package]] +name = "tinytemplate" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" +dependencies = [ + "serde", + "serde_json", +] + +[[package]] +name = "tinyvec" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09b3661f17e86524eccd4371ab0429194e0d7c008abb45f7a7495b1719463c71" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.47.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89e49afdadebb872d3145a5638b59eb0691ea23e46ca484037cfab3b76b95038" +dependencies = [ + "backtrace", + "bytes", + "io-uring", + "libc", + "mio", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "slab", + "socket2 0.6.0", + "tokio-macros", + "windows-sys 0.59.0", +] + +[[package]] +name = "tokio-macros" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-postgres" +version = "0.7.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c95d533c83082bb6490e0189acaa0bbeef9084e60471b696ca6988cd0541fb0" +dependencies = [ + "async-trait", + "byteorder", + "bytes", + "fallible-iterator", + "futures-channel", + "futures-util", + "log", + "parking_lot", + "percent-encoding", + "phf", + "pin-project-lite", + "postgres-protocol", + "postgres-types", + "rand 0.9.2", + "socket2 0.5.10", + "tokio", + "tokio-util", + "whoami", +] + +[[package]] +name = "tokio-util" +version = "0.7.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14307c986784f72ef81c89db7d9e28d6ac26d16213b109ea501696195e6e3ce5" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tst" +version = "0.1.0" +dependencies = [ + "ourdb", + "thiserror", +] + +[[package]] +name = "typenum" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" + +[[package]] +name = "unicode-bidi" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" + +[[package]] +name = "unicode-ident" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" + +[[package]] +name = "unicode-normalization" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-properties" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e70f2a8b45122e719eb623c01822704c4e0907e7e426a05927e1a1cfff5b75d0" + +[[package]] +name = "unty" +version = "0.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d49784317cd0d1ee7ec5c716dd598ec5b4483ea832a2dced265471cc0f690ae" + +[[package]] +name = "uuid" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cf4199d1e5d15ddd86a694e4d0dffa9c323ce759fea589f00fef9d81cc1931d" +dependencies = [ + "getrandom 0.3.3", + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "virtue" +version = "0.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "051eb1abcf10076295e815102942cc58f9d5e3b4560e46e53c21e8ff6f3af7b1" + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasi" +version = "0.14.2+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" +dependencies = [ + "wit-bindgen-rt", +] + +[[package]] +name = "wasite" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" + +[[package]] +name = "wasm-bindgen" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" +dependencies = [ + "bumpalo", + "log", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "web-sys" +version = "0.3.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "whoami" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6994d13118ab492c3c80c1f81928718159254c53c472bf9ce36f8dae4add02a7" +dependencies = [ + "redox_syscall", + "wasite", + "web-sys", +] + +[[package]] +name = "winapi-util" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" +dependencies = [ + "windows-sys 0.59.0", +] + +[[package]] +name = "windows-core" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-implement" +version = "0.60.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-interface" +version = "0.59.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-link" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" + +[[package]] +name = "windows-result" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets 0.53.3", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm 0.52.6", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.53.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91" +dependencies = [ + "windows-link", + "windows_aarch64_gnullvm 0.53.0", + "windows_aarch64_msvc 0.53.0", + "windows_i686_gnu 0.53.0", + "windows_i686_gnullvm 0.53.0", + "windows_i686_msvc 0.53.0", + "windows_x86_64_gnu 0.53.0", + "windows_x86_64_gnullvm 0.53.0", + "windows_x86_64_msvc 0.53.0", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnu" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_i686_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" + +[[package]] +name = "wit-bindgen-rt" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" +dependencies = [ + "bitflags", +] + +[[package]] +name = "zerocopy" +version = "0.8.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1039dd0d3c310cf05de012d8a39ff557cb0d23087fd44cad61df08fc31907a2f" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..36b705e --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,9 @@ +[workspace] +members = [ + "heromodels", + "heromodels_core", + "heromodels-derive", + "ourdb", + "radixtree", + "tst", +] \ No newline at end of file diff --git a/heromodels/Cargo.toml b/heromodels/Cargo.toml index 57e5651..161398a 100644 --- a/heromodels/Cargo.toml +++ b/heromodels/Cargo.toml @@ -14,7 +14,6 @@ ourdb = { path = "../ourdb" } tst = { path = "../tst" } heromodels-derive = { path = "../heromodels-derive" } heromodels_core = { path = "../heromodels_core" } -rhailib_derive = { package = "derive", path = "../../rhailib/src/derive" } rhai = { version = "1.21.0", features = [ "std", "sync", diff --git a/heromodels/src/models/object/object.rs b/heromodels/src/models/object/object.rs index 88c4228..b80d8d8 100644 --- a/heromodels/src/models/object/object.rs +++ b/heromodels/src/models/object/object.rs @@ -2,12 +2,11 @@ use heromodels_core::BaseModelData; use heromodels_derive::model; use rhai::CustomType; use rhai::TypeBuilder; -use rhailib_derive::RhaiApi; use serde::{Deserialize, Serialize}; /// Represents an event in a contact #[model] -#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, CustomType, Default, RhaiApi)] +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, CustomType, Default)] pub struct Object { /// Base model data pub base_data: BaseModelData,