type_bridge_server/lib.rs
1#![cfg_attr(coverage_nightly, feature(coverage_attribute))]
2
3//! # type-bridge-server
4//!
5//! Transport-agnostic query pipeline for TypeDB with composable interceptors.
6//!
7//! This crate provides both a library and a standalone binary for executing
8//! TypeQL queries through a structured pipeline: **validate → intercept →
9//! compile → execute → intercept**.
10//!
11//! ## Feature flags
12//!
13//! | Feature | Default | Description |
14//! |---------|---------|-------------|
15//! | `typedb` | yes | TypeDB backend via [`TypeDBClient`](typedb::TypeDBClient) |
16//! | `axum-transport` | yes | HTTP server with `/query`, `/query/validate`, `/health`, `/schema` endpoints |
17//!
18//! Disable defaults with `--no-default-features` to use the core pipeline as
19//! a library without any transport or backend.
20//!
21//! ## Library usage
22//!
23//! ```rust,ignore
24//! use type_bridge_server::pipeline::PipelineBuilder;
25//! use type_bridge_server::schema_source::InMemorySchemaSource;
26//!
27//! let pipeline = PipelineBuilder::new(my_executor)
28//! .with_schema_source(InMemorySchemaSource::new(tql_schema))
29//! .with_default_database("my_db")
30//! .with_interceptor(my_audit_log)
31//! .build()?;
32//!
33//! let output = pipeline.execute_query(input).await?;
34//! ```
35//!
36//! ## Extension points
37//!
38//! - **[`QueryExecutor`](executor::QueryExecutor)** — implement to use a
39//! non-TypeDB backend or a mock.
40//! - **[`Interceptor`](interceptor::Interceptor)** — implement to add
41//! cross-cutting concerns (audit, auth, rate limiting).
42//! - **[`SchemaSource`](schema_source::SchemaSource)** — implement to load
43//! TypeQL schemas from custom sources.
44
45pub mod config;
46pub mod error;
47pub mod executor;
48pub mod interceptor;
49pub mod pipeline;
50pub mod schema_source;
51
52#[cfg(feature = "axum-transport")]
53pub mod transport;
54
55#[cfg(feature = "typedb")]
56pub mod typedb;
57
58#[cfg(any(test, feature = "test-helpers"))]
59#[cfg_attr(coverage_nightly, coverage(off))]
60pub mod test_helpers;