Skip to main content

mini_app_core/
lib.rs

1//! # mini-app-core
2//!
3//! Agent-First CRUD store core library. Transport-agnostic DB layer that
4//! drives one table per process from `schema.yaml`, backed by SQLite.
5//!
6//! Transport (MCP / HTTP / CLI) lives in a separate crate (`mini-app-mcp`)
7//! that depends on this one. The dependency is strictly one-way:
8//! `mcp → core`, never the reverse. Error type conversion to `rmcp::ErrorData`
9//! is performed by an ACL adapter (private free function) in the mcp crate to
10//! comply with the Rust orphan rule (Outline rust book §5-1-10 K-orphan-rule).
11
12/// Schema definition, runtime loading, and JSON row validation.
13pub mod schema;
14
15/// Application-level error type.
16pub mod error;
17
18/// Runtime configuration loaded from environment variables.
19pub mod config;
20
21/// SQLite-backed row store (async CRUD via `tokio::task::spawn_blocking`).
22pub mod store;
23
24/// Update semantics for [`store::Store::update`]: [`UpdateMode::Merge`] (default,
25/// RFC 7396 shallow merge) or [`UpdateMode::Replace`] (full replacement).
26pub use store::UpdateMode;
27
28/// Server-side row filter for the `list` tool.
29pub mod filter;
30
31/// Multi-table aggregation primitives (`query_aggregate` tool backend).
32///
33/// Provides `AliasAggregator` (Count / Sum / Avg / Min / Max / GroupBy),
34/// `SourceSpec` (Single / Multi), `AliasRunResult` (Rows / Count / Value /
35/// Groups), and `execute_aggregate` for SQLite ATTACH DATABASE + UNION ALL
36/// composition across per-table `.db` files.
37pub mod aggregator;
38
39/// Multi-table registry + atomic reload (Arc-Swap based, K-110-compliant).
40pub mod registry;
41
42/// Global alias storage (Phase 2). Persists named queries that span
43/// Single / Multi / Pattern table sources in a dedicated
44/// `<project_dir or user_dir>/_global.db` SQLite file, separate from
45/// per-table `<table>.db`. Provides lookup with Project → User
46/// precedence and a lossless migration helper from legacy per-table
47/// `_aliases` storage.
48pub mod alias_storage;
49
50/// `row_materialize` operation — row selection, field projection, and
51/// multi-format filesystem output with SHA-256 integrity digest.
52pub mod materialize;
53
54/// Framework-level dump hook utilities (write-only file materialization).
55pub mod dump;
56
57/// Backup utilities (YAML + SQLite online backup with retention).
58pub mod backup;
59
60/// Snapshot utilities (SQLite-only online snapshot with retention).
61pub mod snapshot;
62
63/// Re-export of [`error::MiniAppError`] for convenient `use mini_app_core::MiniAppError`.
64pub use error::MiniAppError;