#![cfg_attr(docsrs, feature(doc_cfg))]
pub mod auth_catalog;
pub mod cli;
pub mod commands;
pub mod config;
pub mod env_config;
pub mod env_loader;
pub mod error;
pub mod executor;
pub mod expand;
pub mod init_template;
pub mod interpolate;
pub mod merge;
pub mod obs;
pub mod registry;
#[cfg(feature = "schedule")]
pub mod schedule;
pub mod secrets;
#[cfg(feature = "serve")]
pub mod serve;
pub mod state;
pub mod transforms;
pub use error::{CliError, CliResult};
pub async fn run_from_yaml_str(yaml: &str) -> CliResult<executor::RunSummary> {
let interpolated = interpolate::interpolate(yaml)?;
let mut cfg: config::PipelineConfig =
serde_yaml::from_str(&interpolated).map_err(|e| CliError::ParseConfig {
path: std::path::PathBuf::from("<yaml-string>"),
message: e.to_string(),
})?;
if cfg.version != 1 {
return Err(CliError::ParseConfig {
path: std::path::PathBuf::from("<yaml-string>"),
message: format!(
"unsupported pipeline version {}, only version 1 is recognised",
cfg.version
),
});
}
crate::secrets::resolve_secrets(&mut cfg).await?;
let pipeline_name = cfg.name.clone().unwrap_or_else(|| "unnamed".to_string());
let auth = auth_catalog::build_auth_catalog(cfg.auth.as_ref())?;
let nodes = expand::expand(&cfg)?;
executor::run_expanded(
nodes,
executor::ExecuteOptions {
pipeline_name,
execution: cfg.execution.clone(),
dry_run: false,
limit: None,
state_path_override: None,
auth,
clock: chrono::Utc::now().fixed_offset(),
cancel: None,
},
)
.await
}