use serde::Serialize;
#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
pub struct DeployedVersion {
pub workflow_type: String,
pub content_hash: String,
pub loaded: bool,
pub route_active: bool,
pub loaded_at: Option<String>,
pub deployed_at: Option<String>,
pub source: DeployedSourceState,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
#[serde(tag = "state", rename_all = "snake_case")]
pub enum DeployedSourceState {
Available {
document_name: String,
schema_count: usize,
},
Absent,
NotPersisted,
Unreadable {
reason: String,
},
}
#[derive(Debug, Serialize)]
pub struct DeployedDocument {
pub workflow_type: String,
pub content_hash: String,
pub document_name: String,
pub source: String,
pub schemas: Vec<DeployedSchema>,
pub projection: super::super::CheckResponse,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
pub struct DeployedSchema {
pub path: String,
pub text: Option<String>,
pub byte_length: usize,
}
#[derive(Debug, thiserror::Error)]
pub enum DeployedError {
#[error(
"no deployed package version `{content_hash}` of workflow type `{workflow_type}` is \
persisted on this server"
)]
NotFound {
workflow_type: String,
content_hash: String,
},
#[error(
"deployed package version `{content_hash}` of workflow type `{workflow_type}` carries no \
archived AWL source: it was authored in Gleam, or deployed before deploys archived their \
source"
)]
NoArchivedSource {
workflow_type: String,
content_hash: String,
},
#[error(
"the persisted archive for workflow type `{workflow_type}` version `{content_hash}` could \
not be read: {reason}"
)]
Unreadable {
workflow_type: String,
content_hash: String,
reason: String,
},
#[error(
"archived schema path `{path}` is not a relative in-document path, so the deployed \
document cannot be checked"
)]
UnsafeSchemaPath {
path: String,
},
#[error("staging the deployed document's archived schemas failed: {0}")]
Staging(#[from] std::io::Error),
#[error("the deployed package catalog could not be read: {0}")]
Catalog(String),
}