Skip to main content

cratefield_tables_api/
lib.rs

1//! The HTTP API over a venture's declared tables (issue #153).
2//!
3//! Not a module crate, which is why it is not named like one. A
4//! `crates/module-*` crate provides a [`Module`] and the conformance kit
5//! runs against every one of them; this provides the decision and the
6//! routes that a venture's **generated** tables module calls. That module
7//! has to be generated source rather than a library because
8//! `personal_data()` is `&'static` all the way down and cannot be
9//! assembled from a manifest read at runtime.
10//!
11//! [`Module`]: cratefield_core::Module
12//!
13//! A `[tables]` declaration already becomes DDL, a module, a privacy
14//! declaration, an access level and the statements that read and write a
15//! row. This is where a request meets them.
16//!
17//! Reading the access decision on its own is the point of splitting
18//! [`access`] out: it decides who sees whose rows and it has no HTTP in
19//! it, so every case is a value rather than a request.
20
21pub mod access;
22pub mod batch;
23pub mod declared;
24pub mod read;
25pub mod routes;
26pub mod surface;
27pub mod write;
28
29pub use access::{
30    FORBIDDEN, MISDECLARED, NO_MEMBERSHIP_FACT, NOT_YOURS_TO_GIVE, READ_ONLY, Reach, TableApi,
31    UNAUTHENTICATED, may_read, may_write, settle_subject,
32};
33pub use batch::{Batch, MAX_READS, Read, run as run_batch};
34pub use declared::{Declared, parse};
35pub use read::{Asked, PAGE, Tables, one, page};
36pub use routes::{
37    BAD_CURSOR, BAD_KEY, COMPOSITE_KEY, Key, NOT_A_KEY_COLUMN, PARTIAL_KEY, cursor_from_query,
38    key_from_path, router,
39};
40pub use surface::surface;
41pub use write::{ALREADY_EXISTS, NOT_A_ROW, create, remove, replace};