#![forbid(unsafe_code)]
#[cfg(feature = "cli")]
pub mod cli;
pub mod api_key;
pub mod token_revocation;
pub mod api;
pub mod error;
pub mod extractors;
#[cfg(feature = "federation")]
pub mod federation;
pub mod logging;
pub mod middleware;
pub mod routes;
pub mod schema;
pub mod server;
pub mod server_config;
pub mod subscriptions;
pub mod validation;
pub mod metrics_server;
pub mod config;
pub mod resilience;
#[cfg(feature = "federation")]
pub mod tracing_utils;
#[cfg(not(feature = "federation"))]
pub mod tracing_utils {
use axum::http::HeaderMap;
#[allow(clippy::missing_const_for_fn)] pub fn extract_trace_context(_headers: &HeaderMap) -> Option<()> {
None
}
}
#[cfg(feature = "auth")]
pub use fraiseql_auth as auth;
#[cfg(feature = "webhooks")]
pub use fraiseql_webhooks as webhooks;
#[cfg(not(feature = "auth"))]
pub mod auth {
use std::sync::Arc;
pub mod state_encryption {
pub struct StateEncryptionService;
impl StateEncryptionService {
pub fn from_compiled_schema(
_s: &serde_json::Value,
) -> crate::Result<Option<std::sync::Arc<Self>>> {
Ok(None)
}
}
}
pub struct PkceStateStore;
impl PkceStateStore {
pub fn is_in_memory(&self) -> bool {
true
}
pub async fn cleanup_expired(&self) {}
}
pub struct OidcServerClient;
impl OidcServerClient {
pub fn from_compiled_schema(_schema_json: &serde_json::Value) -> Option<Arc<Self>> {
None
}
}
}
#[cfg(feature = "secrets")]
pub use fraiseql_secrets::{encryption, secrets_manager};
pub mod tls;
#[cfg(feature = "observers")]
pub mod observers;
#[cfg(feature = "arrow")]
pub mod arrow;
#[cfg(feature = "mcp")]
pub mod mcp;
pub mod pool;
pub mod storage;
pub mod trusted_documents;
pub mod tenancy;
#[cfg(any(test, feature = "testing"))]
pub mod testing;
#[cfg(feature = "cli")]
pub use cli::{Cli, ServerArgs};
pub use logging::{
ErrorDetails, LogLevel, LogMetrics, RequestContext, RequestId, RequestLogger, SourceLocation,
StructuredLogEntry,
};
pub use metrics_server::{MetricsCollector, PrometheusMetrics};
pub use schema::CompiledSchemaLoader;
pub use server::Server;
pub use server_config::ServerConfig;
pub use tls::TlsSetup;
pub use validation::{ComplexityValidationError, RequestValidator};
pub mod prelude {
pub use fraiseql_core::schema::CompiledSchema;
pub use crate::{
ComplexityValidationError, RequestValidator, Server, ServerConfig, ServerError, TlsSetup,
};
}
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum ServerError {
#[error("Failed to bind server: {0}")]
BindError(String),
#[error("Configuration error: {0}")]
ConfigError(String),
#[error("Runtime error: {0}")]
RuntimeError(#[from] fraiseql_core::error::FraiseQLError),
#[error("IO error: {0}")]
IoError(#[from] std::io::Error),
#[error("Database error: {0}")]
Database(String),
#[error("Validation error: {0}")]
Validation(String),
#[error("Conflict: {0}")]
Conflict(String),
#[error("Not found: {0}")]
NotFound(String),
}
pub type Result<T> = std::result::Result<T, ServerError>;