Skip to main content

ave_common/
lib.rs

1//! Shared types used across the Ave workspace.
2//!
3//! `ave-common` keeps request, governance, bridge and utility types in one
4//! crate with a small dependency surface. It is intended for code that needs
5//! Ave domain models without depending on heavier runtime crates.
6//!
7//! Main areas:
8//! - request types for ledger events
9//! - governance payloads and policy models
10//! - bridge types for API-facing serialization
11//! - utility wrappers such as [`SchemaType`], [`Namespace`] and [`ValueWrapper`]
12//!
13//! Feature flags:
14//! - `common`: enables the domain and bridge models
15//! - `value-wrapper`: enables [`ValueWrapper`]
16//! - `openapi`: derives `utoipa` schemas
17//! - `typescript`: derives TypeScript exports
18//!
19//! ```rust
20//! use ave_common::{Namespace, SchemaType};
21//! use ave_common::identity::DigestIdentifier;
22//! use ave_common::request::{CreateRequest, EventRequest};
23//!
24//! let request = EventRequest::Create(CreateRequest {
25//!     name: Some("subject".to_string()),
26//!     description: None,
27//!     governance_id: DigestIdentifier::default(),
28//!     schema_id: SchemaType::Governance,
29//!     namespace: Namespace::from("demo.root"),
30//! });
31//!
32//! assert!(request.is_create_event());
33//! ```
34#[cfg(feature = "common")]
35pub mod governance;
36
37#[cfg(feature = "common")]
38pub mod error;
39
40#[cfg(feature = "common")]
41pub mod bridge;
42
43#[cfg(feature = "common")]
44pub mod request;
45
46#[cfg(feature = "common")]
47pub mod schematype;
48
49#[cfg(feature = "common")]
50pub mod namespace;
51
52#[cfg(feature = "common")]
53pub mod sink;
54
55#[cfg(feature = "value-wrapper")]
56pub mod wrapper;
57
58// Re-exports
59#[cfg(feature = "common")]
60pub use ave_identity as identity;
61
62#[cfg(feature = "common")]
63pub use bridge::*;
64
65#[cfg(feature = "common")]
66pub use error::{ConversionError, Error, SignatureError};
67
68#[cfg(feature = "common")]
69pub use schematype::SchemaType;
70
71#[cfg(feature = "common")]
72pub use namespace::Namespace;
73
74#[cfg(feature = "common")]
75pub use sink::*;
76
77#[cfg(feature = "value-wrapper")]
78pub use wrapper::ValueWrapper;