1pub mod audit;
13pub mod batch;
14pub mod codec;
15pub mod context;
16pub mod envelope;
17pub mod error;
18pub mod events;
19pub mod find_many;
20pub mod idempotency_record;
21pub mod json;
22pub mod page;
23pub mod projection;
24pub mod route_naming;
25pub mod rpc;
26pub mod rust_keywords;
27pub mod schema;
28pub mod store;
29pub mod transport;
30pub mod validators;
31pub mod value;
32
33#[cfg(not(any(feature = "decimal-rust-decimal", feature = "decimal-bigdecimal")))]
53compile_error!(
54 "cratestack: enable exactly one decimal backend feature — `decimal-rust-decimal` or `decimal-bigdecimal`"
55);
56
57#[cfg(all(feature = "decimal-rust-decimal", feature = "decimal-bigdecimal"))]
58compile_error!(
59 "cratestack: `decimal-rust-decimal` and `decimal-bigdecimal` are mutually exclusive — enable exactly one"
60);
61
62#[cfg(all(feature = "decimal-rust-decimal", not(feature = "decimal-bigdecimal")))]
63pub type Decimal = rust_decimal::Decimal;
64
65#[cfg(all(feature = "decimal-bigdecimal", not(feature = "decimal-rust-decimal")))]
66pub type Decimal = bigdecimal::BigDecimal;
67
68pub type CoolBody = bytes::Bytes;
70
71pub use audit::{
75 AuditActor, AuditEvent, AuditOperation, AuditSink, MulticastAuditSink, NoopAuditSink,
76 TransactionIsolation,
77};
78pub use batch::{
79 BATCH_MAX_ITEMS, BatchItemError, BatchItemResult, BatchItemStatus, BatchRequest, BatchResponse,
80 BatchSummary, find_duplicate_position,
81};
82pub use codec::{CoolCodec, CoolEnvelope, NoEnvelope};
83pub use context::{
84 AuthProvider, CoolAuthIdentity, CoolContext, PrincipalContext, PrincipalFacet, RequestContext,
85 SystemContext,
86};
87pub use envelope::{
88 HmacEnvelope, InMemoryNonceStore, KeyProvider, NonceStore, SealedEnvelope, StaticKeyProvider,
89};
90pub use error::{CoolError, CoolErrorResponse, DbErrorInfo, parse_cuid};
91pub use events::{
92 CoolEventBus, CoolEventEnvelope, CoolEventFuture, ModelEvent, ModelEventKind,
93 SubscriptionGuard, SubscriptionHandle, event_topic, parse_emit_attribute,
94};
95pub use find_many::FieldFilterInput;
96pub use idempotency_record::{IdempotencyRecord, ReservationOutcome};
97pub use json::Json;
98pub use page::{MAX_LIST_LIMIT, Page, PageInfo, PageInput};
99pub use projection::ProjectionDecoder;
100pub use schema::{
101 Attribute, AuthBlock, ConfigBlock, ConfigEntry, Datasource, EnumDecl, EnumVariant,
102 ExtensionKind, Field, MixinDecl, Model, OwnedSchemaSummary, ParsedIndexAttribute, Procedure,
103 ProcedureArg, ProcedureKind, Schema, SchemaSummary, SelectionQuery, SourceSpan, TransportStyle,
104 TypeArity, TypeDecl, TypeRef, View, ViewSource, parse_composite_id_attribute,
105 parse_composite_unique_attribute, parse_index_attribute,
106};
107pub use store::{
108 ClientStateStore, IdempotencyStore, InMemoryStateStore, JsonFileStateStore,
109 PersistedClientState, RateLimitConfig, RateLimitDecision, RateLimitStore, RequestJournalEntry,
110};
111pub use transport::{
112 OpDescriptor, OpKind, RouteTransportCapabilities, RouteTransportDescriptor,
113 canonical_request_string,
114};
115pub use validators::{
116 validate_email, validate_iso4217, validate_length, validate_range_decimal, validate_range_i64,
117 validate_uri,
118};
119pub use value::Value;
120
121#[cfg(test)]
127mod tests {
128 use super::*;
129
130 #[test]
131 fn decimal_backend_is_available() {
132 let d = Decimal::from(42);
135 assert_eq!(d.to_string(), "42");
136 }
137
138 #[test]
139 fn decimal_type_arithmetic() {
140 let d1 = Decimal::from(10);
142 let d2 = Decimal::from(20);
143 let _ = d1 + d2;
145 }
146}