1pub mod error;
17pub mod types;
18
19pub use error::{Error, ErrorData, Result};
20pub use types::*;
21
22#[cfg(any(feature = "server", feature = "dispatchers"))]
23pub mod dispatchers;
24
25#[cfg(feature = "server")]
26pub mod server;
27
28#[cfg(any(feature = "runtime", feature = "receiver"))]
29pub mod runtime;
30
31#[cfg(feature = "receiver")]
32pub mod receiver;
33
34#[cfg(feature = "test-utils")]
35pub mod test_utils;
36
37pub use types::{
39 BodySpec, CommandResponse, CommandState, CommandStatusResponse, CreateCommandRequest,
40 CreateCommandResponse, Envelope, LeaseInfo, LeaseRequest, LeaseResponse, ResponseHandling,
41 StorageUpload, SubmitResponseRequest, UploadCompleteRequest, UploadCompleteResponse,
42};
43
44#[cfg(feature = "server")]
45pub use server::{create_axum_router, CommandRegistry, CommandServer, InMemoryCommandRegistry};
46
47#[cfg(any(feature = "runtime", feature = "receiver"))]
48pub use runtime::{
49 command_budget, decode_params, parse_envelope, submit_response, LeaseClient,
50 LEASE_SAFETY_MARGIN,
51};
52
53#[cfg(feature = "receiver")]
57pub use receiver::{Receiver, ShutdownHandle};
58
59pub const INLINE_MAX_BYTES: usize = 150_000;
63
64pub const PROTOCOL_VERSION: &str = "arc.v1";
66
67pub fn resolve_envelope_urls(envelope: &mut Envelope, base: &url::Url) {
75 let resolve = |target: &mut String| {
76 if url::Url::parse(target).is_ok() || target.starts_with("//") {
77 return;
78 }
79 if let Ok(resolved) = base.join(target) {
80 *target = resolved.to_string();
81 }
82 };
83
84 resolve(&mut envelope.response_handling.submit_response_url);
85 if let alien_core::presigned::PresignedRequestBackend::Http { url, .. } =
86 &mut envelope.response_handling.storage_upload_request.backend
87 {
88 resolve(url);
89 }
90 if let alien_core::commands_types::BodySpec::Storage {
91 storage_get_request: Some(request),
92 ..
93 } = &mut envelope.params
94 {
95 if let alien_core::presigned::PresignedRequestBackend::Http { url, .. } =
96 &mut request.backend
97 {
98 resolve(url);
99 }
100 }
101}