pub mod client;
pub mod delta;
pub mod manifest;
#[cfg(feature = "server")]
pub mod routes;
pub mod store;
pub use client::CodePushClient;
pub use client::FileTransport;
pub use client::SyncReport;
pub use client::Transport;
pub use client::UpdatePlan;
pub use delta::Delta;
pub use delta::DeltaOp;
pub use delta::apply_delta;
pub use delta::create_delta;
pub use manifest::BundleFile;
pub use manifest::BundleManifest;
pub use manifest::bundle_directory;
pub use manifest::hash_bytes;
pub use manifest::read_container;
#[cfg(feature = "server")]
pub use routes::codepush_router;
pub use store::ReleaseRecord;
pub use store::ReleaseStore;
pub use store::StoreError;
#[derive(Debug, thiserror::Error)]
pub enum CodePushError {
#[error("io error: {0}")]
Io(#[from] std::io::Error),
#[error("serialization error: {0}")]
Serialize(#[from] serde_json::Error),
#[error("hash mismatch for {path}: expected {expected}, got {actual}")]
HashMismatch {
path: String,
expected: String,
actual: String,
},
#[error("delta base hash mismatch: expected {expected}, got {actual}")]
DeltaBaseMismatch {
expected: String,
actual: String,
},
#[error("transport error: {0}")]
Transport(String),
#[error("release {0} does not exist")]
UnknownRelease(String),
#[error("directory walk failed: {0}")]
Walk(#[from] walkdir::Error),
}
impl From<StoreError> for CodePushError {
fn from(error: StoreError) -> Self {
match error {
StoreError::Io(error) => Self::Io(error),
StoreError::Serialize(error) => Self::Serialize(error),
StoreError::CodePush(error) => error,
}
}
}