use anyhow::Result;
use async_trait::async_trait;
use serde_json::Value;
use uuid::Uuid;
pub mod registry;
#[cfg(feature = "backend")]
pub mod handlers;
#[cfg(feature = "backend")]
pub mod models;
#[cfg(feature = "backend")]
pub mod providers;
#[cfg(feature = "backend")]
pub mod routes;
pub enum InjectedEnvVarValue {
Plain(String),
Secret {
decrypted: String,
encrypted: String,
},
Protected {
#[allow(dead_code)]
decrypted: String,
encrypted: String,
},
}
pub struct InjectedEnvVar {
pub key: String,
pub value: InjectedEnvVarValue,
}
#[async_trait]
pub trait Extension: Send + Sync {
fn extension_type(&self) -> &str;
fn display_name(&self) -> &str;
async fn validate_spec(&self, spec: &Value) -> Result<()>;
async fn on_spec_updated(
&self,
_old_spec: &Value,
_new_spec: &Value,
_project_id: Uuid,
_extension_name: &str,
_db_pool: &sqlx::PgPool,
) -> Result<()> {
Ok(())
}
#[allow(dead_code)]
fn start(&self);
async fn before_deployment(
&self,
project_id: Uuid,
deployment_group: &str,
) -> Result<Vec<InjectedEnvVar>>;
async fn preview_env_vars(
&self,
project_id: Uuid,
deployment_group: &str,
) -> Result<Vec<InjectedEnvVar>> {
self.before_deployment(project_id, deployment_group).await
}
fn format_status(&self, status: &Value) -> String;
fn description(&self) -> &str;
fn documentation(&self) -> &str;
fn spec_schema(&self) -> Value;
}