pipa_core/lib.rs
1//! # Pipa
2//!
3//! Public API surface for the Pipa data quality engine.
4//!
5//! This crate is primarily used via the CLI, but the same functionality
6//! is available programmatically through the modules below.
7//!
8//! Internals (engine, connectors, movement, validators, etc.) are kept private
9//! so they can evolve without breaking consumers.
10
11// --- Internal modules (not re-exported directly) ---
12// These are the building blocks of the engine. They remain private
13// so their APIs can change without breaking downstream users.
14mod connectors;
15mod contracts;
16mod drivers;
17mod engine;
18mod logging;
19mod movement;
20mod profiles;
21mod validators;
22
23// -----------------------------
24// Public API surface
25// -----------------------------
26//
27// Each public submodule below re-exports a curated set of types and
28// functions from the internal engine. This creates a stable, branded
29// API for consumers (CLI or programmatic) while insulating them from
30// internal refactors.
31
32/// Contract management: list, validate, show, and run contracts.
33///
34/// Exposes contract-related types and functions from `engine::contracts`.
35/// Also re-exports the `Executor` type from logging for contract execution context.
36pub mod contract {
37 pub use crate::engine::contracts::{
38 ContractInfo, ContractList, ContractValidation, ValidationOutcome, get_contract,
39 list_contracts, run_contract_validation, validate_contract,
40 };
41 pub use crate::logging::schema::Executor;
42}
43
44/// Profile management: list and test profiles.
45///
46/// Provides access to profile definitions and testing utilities.
47/// Profiles are typically used to parameterize contract runs.
48pub mod profile {
49 pub use crate::engine::profiles::{
50 ProfileList, ProfileTestResult, list_profiles, test_profile,
51 };
52}
53
54/// Run data validation against contracts.
55///
56/// Thin wrapper that exposes the core validation runner directly.
57/// Useful for programmatic invocation without going through CLI.
58pub mod run {
59 pub use crate::engine::contracts::run_contract_validation;
60}
61
62/// Log management: verify log integrity.
63///
64/// Surfaces log verification and integrity checking.
65/// Includes cryptographic verification of log chains.
66pub mod logs {
67 pub use crate::engine::logs::{LogVerification, verify_logs};
68 pub use crate::logging::verify::FileStatus;
69}
70
71/// System health checks.
72///
73/// Provides system-level diagnostics (e.g., environment, connectors).
74/// Useful for pre-flight checks before running validations.
75pub mod health {
76 pub use crate::engine::system::{HealthStatus, check_system_health, run_health_check};
77}
78
79/// Initialize project scaffolding.
80///
81/// Exposes project initialization helpers (e.g., creating config files,
82/// setting up directories). Typically used by `pipa init`.
83pub mod init {
84 pub use crate::engine::init::init_project;
85}
86
87/// Logging infrastructure: pluggable audit logging.
88///
89/// Provides the `AuditLogger` trait and implementations for different backends.
90/// Consumers can use the built-in JSONL logger or implement their own.
91pub mod audit_logging {
92 pub use crate::logging::{AuditLogger, JsonlLogger, NoOpLogger};
93 pub use crate::logging::schema::{AuditLogEntry, Contract, Target, RuleResult, Executor, ProcessSummary};
94}