Lenso
lenso is the public Rust facade for Lenso module-authoring and host boot
contracts.
Install it from crates.io:
The default facade exposes serializable module manifest declarations:
- module manifests and manifest lints;
- schema-admin and declarative admin action declarations;
- HTTP route metadata;
- runtime function declarations;
- event handler declarations;
- lifecycle declarations;
- Runtime Console surface declarations;
- story display metadata.
Enable the host feature for the narrow host boot facade:
= { = "0.3.18", = ["host"] }
Application SQL, repositories, auth/session policy, CRUD shape, and Runtime Console UI stay in the host application or module code.
Host-owned linked modules can use lenso::host::transaction when one operation
must atomically claim an idempotency key, execute app-owned SQL, and publish an
Outbox event. The application still writes its business query with sqlx; it
does not import lenso-platform-core or address platform tables directly.
Consumers that only need this transaction boundary can avoid the complete Host boot dependency graph:
= { = "0.3.19", = ["host-transactions"] }
use ;
let key = parse?;
let mut transaction = begin.await?;
if transaction.claim_idempotency_key.await? == Existing
query
.bind
.execute
.await?;
transaction.publish_outbox.await?;
transaction.commit.await?;
The same feature exposes the host-owned relay through
lenso::host::outbox. A host implements EventDispatcher and passes it to
OutboxRelay::relay_once; it does not import a lenso-platform-* crate or
address Outbox tables directly. Delivery is at least once. When a dispatcher
returns a retryable AppError, the existing host retry and dead-letter policy
decides when to redeliver or exhaust the event. Consumers must therefore make
effects idempotent using the stable ClaimedOutboxEvent::id.
use ;
;
let relay = new;
relay.relay_once.await?;
Example
use ;
let manifest = builder
.capabilities
.admin
.runtime
.build;
let lints = lint_module_manifest;
assert!;