pub mod error;
pub mod types;
pub use error::{Error, ErrorData, Result};
pub use types::*;
#[cfg(any(feature = "server", feature = "dispatchers"))]
pub mod dispatchers;
#[cfg(feature = "server")]
pub mod server;
#[cfg(any(feature = "runtime", feature = "receiver"))]
pub mod runtime;
#[cfg(feature = "receiver")]
pub mod receiver;
#[cfg(feature = "test-utils")]
pub mod test_utils;
pub use types::{
BodySpec, CommandResponse, CommandState, CommandStatusResponse, CreateCommandRequest,
CreateCommandResponse, Envelope, LeaseInfo, LeaseRequest, LeaseResponse, ResponseHandling,
StorageUpload, SubmitResponseRequest, UploadCompleteRequest, UploadCompleteResponse,
};
#[cfg(feature = "server")]
pub use server::{create_axum_router, CommandRegistry, CommandServer, InMemoryCommandRegistry};
#[cfg(any(feature = "runtime", feature = "receiver"))]
pub use runtime::{
command_budget, decode_params, parse_envelope, submit_response, LeaseClient,
LEASE_SAFETY_MARGIN,
};
#[cfg(feature = "receiver")]
pub use receiver::{Receiver, ShutdownHandle};
pub const INLINE_MAX_BYTES: usize = 150_000;
pub const PROTOCOL_VERSION: &str = "arc.v1";
pub fn resolve_envelope_urls(envelope: &mut Envelope, base: &url::Url) {
let resolve = |target: &mut String| {
if url::Url::parse(target).is_ok() || target.starts_with("//") {
return;
}
if let Ok(resolved) = base.join(target) {
*target = resolved.to_string();
}
};
resolve(&mut envelope.response_handling.submit_response_url);
if let alien_core::presigned::PresignedRequestBackend::Http { url, .. } =
&mut envelope.response_handling.storage_upload_request.backend
{
resolve(url);
}
if let alien_core::commands_types::BodySpec::Storage {
storage_get_request: Some(request),
..
} = &mut envelope.params
{
if let alien_core::presigned::PresignedRequestBackend::Http { url, .. } =
&mut request.backend
{
resolve(url);
}
}
}