Expand description
cratestack-core — backend-agnostic primitives shared by every
crate in the framework: schema IR, audit + envelope primitives,
the CoolError / CoolContext / Value types, batch envelopes,
RPC wire shapes, and field-level validators.
The public surface is intentionally flat at the crate root: every
type re-exports from a focused submodule below, so callers can
keep writing cratestack_core::CoolError while the implementation
lives in cratestack_core::error. New code can opt into the
submodule paths directly.
Re-exports§
pub use audit::AuditActor;pub use audit::AuditEvent;pub use audit::AuditOperation;pub use audit::AuditSink;pub use audit::MulticastAuditSink;pub use audit::NoopAuditSink;pub use audit::TransactionIsolation;pub use batch::BATCH_MAX_ITEMS;pub use batch::BatchItemError;pub use batch::BatchItemResult;pub use batch::BatchItemStatus;pub use batch::BatchRequest;pub use batch::BatchResponse;pub use batch::BatchSummary;pub use batch::find_duplicate_position;pub use codec::CoolCodec;pub use codec::CoolEnvelope;pub use codec::NoEnvelope;pub use context::AuthProvider;pub use context::CoolAuthIdentity;pub use context::CoolContext;pub use context::PrincipalContext;pub use context::PrincipalFacet;pub use context::RequestContext;pub use envelope::HmacEnvelope;pub use envelope::InMemoryNonceStore;pub use envelope::KeyProvider;pub use envelope::NonceStore;pub use envelope::SealedEnvelope;pub use envelope::StaticKeyProvider;pub use error::CoolError;pub use error::CoolErrorResponse;pub use error::DbErrorInfo;pub use error::parse_cuid;pub use events::CoolEventBus;pub use events::CoolEventEnvelope;pub use events::CoolEventFuture;pub use events::ModelEvent;pub use events::ModelEventKind;pub use events::event_topic;pub use events::parse_emit_attribute;pub use json::Json;pub use page::Page;pub use page::PageInfo;pub use projection::ProjectionDecoder;pub use schema::Attribute;pub use schema::AuthBlock;pub use schema::ConfigBlock;pub use schema::ConfigEntry;pub use schema::Datasource;pub use schema::EnumDecl;pub use schema::EnumVariant;pub use schema::Field;pub use schema::MixinDecl;pub use schema::Model;pub use schema::OwnedSchemaSummary;pub use schema::Procedure;pub use schema::ProcedureArg;pub use schema::ProcedureKind;pub use schema::Schema;pub use schema::SchemaSummary;pub use schema::SelectionQuery;pub use schema::SourceSpan;pub use schema::TransportStyle;pub use schema::TypeArity;pub use schema::TypeDecl;pub use schema::TypeRef;pub use schema::View;pub use schema::ViewSource;pub use transport::OpDescriptor;pub use transport::OpKind;pub use transport::RouteTransportCapabilities;pub use transport::RouteTransportDescriptor;pub use transport::canonical_request_string;pub use validators::validate_email;pub use validators::validate_iso4217;pub use validators::validate_length;pub use validators::validate_range_decimal;pub use validators::validate_range_i64;pub use validators::validate_uri;pub use value::Value;
Modules§
- audit
- Audit log primitives.
- batch
- Batch envelope.
- codec
- Pluggable codec + envelope traits used by the transport layer.
- context
- Request-scoped context: authenticated identity, structured
principal, transport extensions, plus the
AuthProvidertrait that auth middlewares implement. - envelope
- Signed envelope (HMAC-SHA-256).
- error
CoolError— the framework’s error type, its 4xx/5xx HTTP mapping, and the public response envelope clients see on failure.- events
- Model-event bus: typed
created/updated/deletedenvelopes that procedure handlers can subscribe to. - json
- Schema-declared
Jsoncolumns need a model-struct field type that’s the same on every backend so the same struct compiles on server and on embedded (includingwasm32-unknown-unknown, which can’t depend on sqlx). - page
- Generic paginated-page envelope used by every
listroute. The shape mirrors what generated clients consume. - projection
- rpc
- RPC binding wire types.
- schema
- Schema IR — the parsed shape of a
.cstackfile. Every IR node carries source-span back-pointers so consumers can map errors to positions in the original text. - transport
- Transport-binding wire shapes shared by every generator (REST, RPC) and every server emitter.
- validators
- Field-level validators.
- value
- Backend-agnostic JSON-shaped value used throughout the framework (auth claims, audit payloads, RPC error details, schema config).