//! CottonDB's domain layer, ported from `packages/core/src` and //! `packages/import-core/src`. //! //! **Pure.** No I/O, no clock, no randomness, no SQLite, no environment — //! every function here takes its world as arguments and returns a value, //! exactly as the TypeScript modules do. Where the TypeScript reads the //! process time zone implicitly (`getHours`, `setDate`, `toLocaleString`) the //! Rust takes the zone as an explicit argument and the doc comment says so. //! `cotton-store` is a dependency only where the TypeScript imports from //! `@cottondb/store` (the JS-faithful string helpers in `protocol::js`, //! `derived_id`, and the content fingerprint that [`import`] must never //! re-derive). //! //! [`import`] is `packages/import-core` and lands INSIDE this crate rather //! than beside it: that package exists in TypeScript only to guarantee //! platform neutrality — nothing in it may import a `node:` module or touch //! `Buffer`, which is what makes every reader's fingerprint match — and that //! constraint is already this crate's own rule. //! //! Where the crate must talk to a database it does so through a TRAIT the //! server implements over crate-local value types, never a `rusqlite` type in //! a signature: [`rules::search_everything::SearchDriver`] is the pattern. //! //! Every module is pinned to its TypeScript original two ways: each case of //! the module's `__tests__` file is ported as a Rust test, and extra vectors //! were computed by RUNNING the TypeScript so that any function whose output //! is a string or a date is compared against what Node actually produced — //! never against a value someone reasoned out. pub mod js_text; // THE OUTBOX A HOUSEHOLD MAC PULLS ITS BACKUP FROM: the routes, the body and // the one path rule the serving Mac and the receiving Mac share. pub mod constants; pub mod definitions; pub mod design; pub mod device; pub mod rules; /// The pure rules, one implementation the Worker runs as WASM too. pub use cotton_rules; pub mod transforms; pub mod failure; // WHICH APP THIS PROCESS IS — CottonDB or Cotton Dev. Every rule that names // where the data lives or which household a build may reach reads it. pub mod flavor; pub mod lane_sandbox; // THE INVITE LINK a second person joins a database by (KS5): one codec for // the Mac that makes it and the device that claims it, bound to a flavor. pub mod invite_link; // THE INK: the reading rules of letters written above the fan, one // implementation for every shell; the letter model stays the platform's. pub mod ink; pub mod look; // THE ONE DECLARATION OF THE GIT LADDER. Here rather than beside either // caller because there are three: `CottonHost` (a Swift literal twin, held by // `scripts/__tests__/swift-mac.test.ts`), `cotton-client` and `cotton-server`. // Both crates depend on this one. pub mod git; pub mod handles; pub mod import; // PUBLIC because the server needs it too. `Math.round` is a shared // SEMANTIC, not a private convenience: it ties to the LARGER value, so it // disagrees with `f64::round` at every negative half, and any port that // reaches for the wrong one is wrong in a way no type can catch. A second // copy of it in another crate is the same hazard as a second copy of any // rule — the news port had to carry one while this said `pub(crate)`. pub use cotton_rules::js_number; pub mod keys; /// Cotton Calling: the one-to-one call as a pure rule the shells draw. pub mod calling; pub mod chat; /// Cotton Health: Apple Health readings as a person's own rows, read-only. pub mod health; pub mod language; pub mod mail; pub mod media; pub mod messages; pub mod books; /// Cotton Pages' rules: a web page read into its article, and kept pages exported. pub mod films; pub mod music; pub mod retired; pub mod net; pub mod phrase; pub mod primitives; pub mod qr; pub mod records; pub mod recipes; pub mod front_door; pub mod relay_address; pub mod templates; pub mod vault; pub mod seal; pub mod sites; pub mod kit; pub mod kit_pictures; pub mod toolkits; pub mod genesis; pub mod everything; // Cotton Data: what the app says about the database, read only (assets/design/data). pub mod data; pub mod export; pub mod backup; pub mod albums;