appstruct-compiler 0.2.0

Parser, validator, and typed IR compiler for AppStruct application specifications
Documentation
use super::Located;
use appstruct_ir::SourceSpan;

#[derive(Clone, Debug)]
pub(crate) struct SurfacePreset {
    pub name: Located<String>,
    pub version: Located<u64>,
}

#[allow(clippy::struct_excessive_bools)]
#[derive(Clone, Debug, Default)]
pub(crate) struct SurfaceAuth {
    pub enabled: bool,
    pub user_entity: Option<Located<String>>,
    pub registration_enabled: bool,
    pub password_reset_enabled: bool,
    pub oauth_enabled: bool,
    pub oauth_providers: Vec<Located<String>>,
    pub oauth_signup_disabled: Vec<Located<String>>,
    pub roles: Vec<Located<String>>,
    pub default_role: Option<Located<String>>,
}

#[allow(clippy::struct_excessive_bools)]
#[derive(Clone, Debug, Default)]
pub(crate) struct SurfaceBilling {
    pub enabled: bool,
    pub provider: Option<Located<String>>,
    pub subscriptions: bool,
    pub trials: bool,
    pub customer_portal: bool,
    pub metered_usage: bool,
    pub plans: Vec<SurfaceBillingPlan>,
    pub span: Option<SourceSpan>,
}

#[derive(Clone, Debug)]
pub(crate) struct SurfaceBillingPlan {
    pub id: Located<String>,
    pub price_env: Located<String>,
    pub trial_days: Option<Located<u64>>,
    pub entitlements: Vec<Located<String>>,
}

#[derive(Clone, Debug, Default)]
pub(crate) struct SurfaceTenant {
    pub enabled: bool,
    pub span: Option<SourceSpan>,
}

#[derive(Clone, Debug, Default)]
pub(crate) struct SurfaceAudit {
    pub enabled: bool,
    pub reader_roles: Vec<Located<String>>,
    pub span: Option<SourceSpan>,
}

#[derive(Clone, Debug, Default)]
pub(crate) struct SurfaceMail {
    pub enabled: bool,
    pub provider: Option<Located<String>>,
    pub from: Option<Located<String>>,
    pub templates: Vec<SurfaceMailTemplate>,
    pub span: Option<SourceSpan>,
}

#[derive(Clone, Debug)]
pub(crate) struct SurfaceMailTemplate {
    pub name: Located<String>,
    pub subject: Located<String>,
    pub text: Located<String>,
    pub html: Option<Located<String>>,
}

#[derive(Clone, Debug, Default)]
pub(crate) struct SurfaceJobs {
    pub enabled: bool,
    pub poll_interval_ms: Option<Located<u64>>,
    pub lease_seconds: Option<Located<u64>>,
    pub queues: Vec<SurfaceJobQueue>,
    pub schedules: Vec<SurfaceJobSchedule>,
    pub span: Option<SourceSpan>,
}

#[derive(Clone, Debug)]
pub(crate) struct SurfaceJobQueue {
    pub name: Located<String>,
    pub max_attempts: Option<Located<u64>>,
    pub backoff_seconds: Option<Located<u64>>,
}

#[derive(Clone, Debug)]
pub(crate) struct SurfaceJobSchedule {
    pub name: Located<String>,
    pub cron: Located<String>,
    pub queue: Located<String>,
    pub kind: Located<String>,
    pub payload: Option<Located<String>>,
}

#[derive(Clone, Debug, Default)]
pub(crate) struct SurfaceWebhooks {
    pub enabled: bool,
    pub poll_interval_ms: Option<Located<u64>>,
    pub connect_timeout_ms: Option<Located<u64>>,
    pub read_timeout_ms: Option<Located<u64>>,
    pub request_timeout_ms: Option<Located<u64>>,
    pub endpoints: Vec<SurfaceWebhookEndpoint>,
    pub span: Option<SourceSpan>,
}

#[derive(Clone, Debug)]
pub(crate) struct SurfaceWebhookEndpoint {
    pub name: Located<String>,
    pub url: Located<String>,
    pub secret_env: Located<String>,
    pub events: Vec<Located<String>>,
    pub max_attempts: Option<Located<u64>>,
    pub backoff_seconds: Option<Located<u64>>,
}

#[derive(Clone, Debug, Default)]
pub(crate) struct SurfaceRealtime {
    pub enabled: bool,
    pub heartbeat_seconds: Option<Located<u64>>,
    pub presence_ttl_seconds: Option<Located<u64>>,
    pub span: Option<SourceSpan>,
}

#[derive(Clone, Debug, Default)]
pub(crate) struct SurfaceFile {
    pub enabled: bool,
    pub provider: Option<Located<String>>,
    pub local_root: Option<Located<String>>,
    pub max_bytes: Option<Located<u64>>,
    pub allowed_content_types: Vec<Located<String>>,
    pub span: Option<SourceSpan>,
}

#[derive(Clone, Debug, Default)]
pub(crate) struct SurfaceReport {
    pub enabled: bool,
    pub renderer: Option<Located<String>>,
    pub queue: Option<Located<String>>,
    pub max_input_bytes: Option<Located<u64>>,
    pub retention_days: Option<Located<u64>>,
    pub reader_roles: Vec<Located<String>>,
    pub templates: Vec<SurfaceReportTemplate>,
    pub span: Option<SourceSpan>,
}

#[derive(Clone, Debug)]
pub(crate) struct SurfaceReportTemplate {
    pub name: Located<String>,
    pub version: Located<u64>,
    pub body: Located<String>,
    pub input_schema: Located<String>,
    pub data_schema_version: Option<Located<u64>>,
}

#[derive(Clone, Debug, Default)]
pub(crate) struct SurfaceActivity {
    pub enabled: bool,
    pub max_comment_bytes: Option<Located<u64>>,
    pub attachments: bool,
    pub admin_roles: Vec<Located<String>>,
    pub resources: Vec<Located<String>>,
    pub span: Option<SourceSpan>,
}