iet-core
core contract official
Defines the shared vocabulary: errors, validation, call context, sessions, transactions, queries, persistence metadata.
CoreFeaturesIntegrationsStacksTooling
Used byiet-appiet-authiet-auth-acliet-auth-acl-timescaleiet-auth-basiciet-auth-basic-axumiet-auth-basic-timescaleiet-auth-identity-timescale+28 more
iet-corecontractContracts and neutral primitivesDepends onnothing — it stands alone
How to use it
iet-core holds the implementation-neutral primitives every feature builds on: AppError/ErrorKind, Principal/CallContext, Session/CallScope, Validate, Operation/Access, Authorizer, transactions, and pagination. Inputs declare the access they require, and operation::check enforces access before validation identically at every boundary.
// examples/handbook-notes/src/note.rs (+ src/service.rs)
use ;
use ;
// In the service; runs the access check first, then validates.
.await?;
checkperforms access control beforevalidate, so unauthorized input is never validated.CallScope::require_resourceguards against a session for the wrongResourceId.
Core contract
This page is the crate reference. For the framework-wide runtime and trait model, read Architecture.
What it implements
- Defines the traits other crates implement:
UseCase,SessionFactory,Validate,Session,Authorizer,TransactionSession,Permission,Event,Operation,Persistent,QueryField.
What's inside
Modules
src/lib.rssrc/module.rssrc/operation.rssrc/persistence.rssrc/query.rs
Public API
(root)
- trait
UseCase— A statically wired single-operation application contract.
- trait
SessionFactory— Factory implementations decide how to acquire the execution resource.
- type
AppResult— Application operation result. - enum
ErrorKind - struct
FieldError - struct
AppError - struct
ErrorDiagnostic pub fn new(kind: ErrorKind, code: impl Into<String>, message: impl Into<String>) -> Selfpub fn with_diagnostic( mut self, component: impl Into<String>, cause_code: impl Into<String>, ) -> Self— Supply a safe classification/SQLSTATE, not raw payloads or credential-bearing URLs.pub fn diagnostic(&self) -> Option<&ErrorDiagnostic>- trait
Validate— Pure input validation, invoked by guarded service entrypoints.
- struct
Principal - struct
CallContext - struct
ResourceId - trait
Session— Per-invocation execution session, implemented by a feature.
- struct
CallScope— Exclusive session borrow propagated across feature port calls. pub fn new(context: &'a CallContext, session: &'a mut S) -> Selfpub fn context(&self) -> &CallContextpub fn session(&mut self) -> &mut Spub fn require_resource(&self, expected: &ResourceId) -> AppResult<()>- trait
Authorizer— Typed policy implementation; core does not assume RBAC or ACL semantics.
- enum
Patch - enum
TransactionState - trait
TransactionSession— Database feature lifecycle. Cancellation cleanup remains a driver obligation.
- trait
Permission— Contract metadata consumed by transport/policy adapters, not an access grant.
- trait
Event
- struct
TransactionScope— Borrowed ownership token. Dropping unfinished work poisons the transaction; asynchronous rollback is performed by the outer owner or database driver. pub fn session(&mut self) -> &mut S
module
- struct
ModuleDescriptor pub fn order_modules(modules: &[ModuleDescriptor]) -> AppResult<Vec<&ModuleDescriptor>>— Deterministic dependency-first ordering with strict missing/cycle checks.
operation
- enum
Access - trait
Operation
persistence
- struct
Hypertable - trait
Persistent
- struct
ForeignKey— Stable-key relationship. Soft deletion does not remove referenced rows. - struct
Index - enum
ColumnType - struct
Column
query
- trait
QueryField— Explicit transport field allowlist, independent of SQL column mappings.
- struct
Pagination pub fn new(page: u64, limit: u32, max_limit: u32, max_offset: u64) -> AppResult<Self>pub fn page(self) -> u64pub fn limit(self) -> u32pub fn offset(self) -> u64- enum
Direction - struct
Sort pub fn parse_sort<F: PartialEq>( input: &str, max_fields: usize, resolve: impl Fn(&str) -> Option<F>, ) -> AppResult<Vec<Sort<F>>>— The caller supplies the allowlisted typed field resolver, never SQL identifiers.- struct
ListQuery - struct
Page - struct
CursorPagination pub fn new( after: Option<String>, before: Option<String>, limit: u32, max_limit: u32, max_cursor_bytes: usize, ) -> AppResult<Self>
Impl map
std::fmt::Display for AppErrorstd::error::Error for AppErrorDrop for TransactionScope<'_, S>Wake for ThreadWakeSession for FakeSessionTransactionSession for FakeSessionAuthorizer for DenyValidate for MustNotValidateValidate for InputOperation for PublicOperation for AuthenticatedOperation for Restricted
Depends on
- No other framework crate: it stands alone.
Used by
iet-appiet-authiet-auth-acliet-auth-acl-timescaleiet-auth-basiciet-auth-basic-axumiet-auth-basic-timescaleiet-auth-identity-timescaleiet-auth-login-htmx-axumiet-auth-profilesiet-auth-profiles-axumiet-auth-profiles-timescaleiet-auth-rbaciet-auth-rbac-timescaleiet-auth-revocations-timescaleiet-auth-session-axumiet-auth-session-cacheiet-auth-session-jwtiet-auth-session-opaqueiet-auth-session-timescale- … and 16 more
In this repository
examples/handbook-notesexamples/htmx-starterexamples/reusable-notesexamples/skills-only-appexamples/skills-only-app-task-tracker
Source: crates/core/iet-core