flow_lib/
lib.rs

1//! Utilities to use within nodes and flows.
2//!
3//! Table of contents:
4//! - [`command`]: implementing a new command.
5//! - [`config`]: types definition
6//! - [`context`]: providing services and information for nodes to use.
7//! - [`solana`]: utilities for working with Solana.
8//! - [`utils`]: other utilities.
9
10pub mod command;
11pub mod config;
12pub mod context;
13pub mod flow_run_events;
14pub mod solana;
15pub mod utils;
16
17pub type BoxError = Box<dyn std::error::Error + Send + Sync>;
18
19pub type UserId = uuid::Uuid;
20
21pub use config::{
22    CmdInputDescription, CmdOutputDescription, CommandType, ContextConfig, FlowConfig, FlowId,
23    FlowRunId, Gate, HttpClientConfig, Name, NodeConfig, NodeId, SolanaClientConfig, SolanaNet,
24    ValueSet, ValueType,
25};
26pub use context::User;
27pub use inventory::submit;
28pub use value::{self, Error as ValueError, Value};
29
30/// Helper macro to read node definition file at compile-time.
31///
32/// `node_definition!("node.json")` will expand to read file at
33/// `$CARGO_MANIFEST_DIR/node-definitions/node.json`.
34///
35/// See: [CARGO_MANIFEST_DIR](https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-crates).
36#[macro_export]
37macro_rules! node_definition {
38    ($file:expr $(,)?) => {
39        include_str!(concat!(
40            env!("CARGO_MANIFEST_DIR"),
41            "/node-definitions/",
42            $file
43        ))
44    };
45}