#[cfg(doctest)]
#[doc = include_str!("../README.md")]
pub struct ReadmeDoctests;
pub mod capability;
pub mod catalog;
pub mod contract;
pub mod manifest;
pub mod registry;
pub mod runtime;
pub mod types;
pub use capability::{Binding, CapabilityEnvelope, EnvelopeViolation, Hardware};
pub use catalog::{catalog_json, descriptors, model_descriptors, models_json, FieldInfo, TransformDescriptor};
pub use contract::{Compute, ComputeError, TransformBackend};
pub use manifest::{
parse_and_validate, ContainerProtocol, ImplKind, Labels, LabelsRule, ManifestError, TransformManifest,
};
pub use registry::{
standard_registry, Backends, DirRoot, MemoryRoot, RawUnit, RegisteredTransform, Registry, RegistryBuilder,
RegistryError, RegistryIndex, Root,
};
pub use runtime::{Runtime, RuntimeBuilder};
pub use types::{ColumnSpec, FvType, SchemaSpec};
pub const CONTRACT_VERSION: &str = "0.1.0";
pub fn transform_index_payload(roots_spec: &str) -> serde_json::Value {
use crate::registry::{DirRoot, Registry};
let mut b = Registry::builder();
for (i, r) in roots_spec.split(':').filter(|s| !s.is_empty()).enumerate() {
let name = std::path::Path::new(r)
.file_name()
.map(|s| s.to_string_lossy().to_string())
.unwrap_or_else(|| format!("root{i}"));
b = b.root(DirRoot::new(name, std::path::PathBuf::from(r)));
}
let registry = b.build().expect("build transform registry");
let transforms: Vec<serde_json::Value> = registry
.iter()
.map(|t| serde_json::to_value(&t.manifest).unwrap())
.collect();
serde_json::json!({
"description": "Transform registry catalogue. SINGLE SOURCE = the fv-compute directory-per-transform registry (transforms/ + each business bundle). Generated by `fv-datafusion --emit-transform-index`; the TS pipeline builder reads this to offer registered transforms (container/wasm/expression/builtin) in its palette. Do not hand-edit.",
"contractVersion": CONTRACT_VERSION,
"transforms": transforms,
})
}