WASM client infrastructure for offline-first admin portals
| Tier | platform |
| Role | unclassified (baselined) |
| Path | crates/platform/wasm-ui |
| Edition | 2021 |
| Targets | platform_wasm_ui |
| Public items | 88 across 5 modules |
| Tests | 20 |
What it is for
# platform-wasm-ui
WASM client infrastructure for offline-first admin portals.
This crate provides the building blocks for creating offline-capable admin interfaces that sync with a server when connectivity is available.
Core Components
- `SyncEngine`<S>: Coordinates syncing with the server, generic over storage
- `OutboxManager`<S>: Manages the command outbox queue, generic over storage
- `ApiClient`: HTTP client for server communication
- `SyncStatus`: Reactive sync status for UI display
Storage Abstraction
This crate is generic over the storage backend via KeyValueStore from infrastructure-kv-store. This allows the same code to run with:
InMemoryStorefor testingIndexedDbStorefor browser WASM (enableindexeddbfeature)SqliteStorefor Tauri desktop/mobile (future)
Architecture
┌─────────────────────────────────────────────────────────────┐
│ WASM Admin Client │
│ │
│ ┌───────────────┐ ┌───────────────────────────────┐ │
│ │ UI Layer │───▶│ SyncEngine<S: KeyValueStore>│ │
│ │ (Leptos) │ └───────────────┬───────────────┘ │
│ └───────────────┘ │ │
│ │ ┌───────────┼───────────┐ │
│ ▼ ▼ ▼ ▼ │
│ ┌───────────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
│ │ KeyValueStore│ │ Outbox │ │ Meta │ │ API │ │
│ │ (abstract) │ │ Manager │ │ Storage │ │ Client │ │
│ └───────────────┘ └─────────┘ └─────────┘ └─────────┘ │
└─────────────────────────────────────────────────────────────┘
Example
use std::sync::Arc;
use platform_wasm_ui::{SyncEngine, SyncConfig};
use infrastructure_kv_store::InMemoryStore;
use infrastructure_sync::{Command, IdempotencyKey};
// Create storage and sync engine
let store = Arc::new(InMemoryStore::new());
let config = SyncConfig::new("https://api.example.com");
let mut engine = SyncEngine::new(config, store).await?;
// Queue a command (works offline)
let cmd = Command::CreatePage {
idempotency_key: IdempotencyKey::new(),
slug: "hello".to_string(),
title: "Hello World".to_string(),
page_type: "post".to_string(),
content: "My first post".to_string(),
};
engine.queue_command(cmd).await?;
// Check sync status
let status = engine.status();
if status.pending_count > 0 {
println!("{} commands pending sync", status.pending_count);
}
Capabilities
ApiClient
HTTP API client for server communication.
| Item |
|---|
pub struct ApiClient |
ApiClient :: fn new(config : ApiConfig) -> Self |
ApiClient :: fn set_auth_token(& mut self, token : Option <String>) |
ApiClient :: fn is_authenticated(& self) -> bool |
ApiClient :: async fn submit_command(& self, command : & Command) -> WasmResult <ServerAck> |
ApiClient :: async fn submit_commands(& self, commands : & Command) -> WasmResult <Vec <ServerAck>> |
ApiClient :: async fn pull_changes(& self, request : & PullRequest) -> WasmResult <PullResponse> |
ApiClient :: async fn login(& mut self, email : & str, password : & str) -> WasmResult <LoginResponse> |
ApiClient :: async fn logout(& mut self) -> WasmResult <()> |
ApiClient :: async fn refresh_token(& mut self) -> WasmResult <String> |
ApiClient :: async fn health_check(& self) -> WasmResult <bool> |
ApiConfig
HTTP API client for server communication.
| Item |
|---|
pub struct ApiConfig |
ApiConfig :: fn new(base_url : impl Into <String>) -> Self |
ApiConfig :: fn with_timeout(mut self, timeout_ms : u32) -> Self |
LoginResponse
HTTP API client for server communication.
| Item |
|---|
pub struct LoginResponse |
WasmError
Error types for WASM client operations.
| Item |
|---|
pub enum WasmError |
WasmError :: fn storage(msg : impl Into <String>) -> Self |
WasmError :: fn network(msg : impl Into <String>) -> Self |
WasmError :: fn serialization(msg : impl Into <String>) -> Self |
WasmError :: fn not_found(entity_type : impl Into <String>, entity_id : impl Into <String>) -> Self |
WasmError :: fn server_error(status : u16, message : impl Into <String>) -> Self |
WasmError :: fn is_retryable(& self) -> bool |
WasmError :: fn requires_auth(& self) -> bool |
WasmError :: fn from(err : serde_json::Error) -> Self |
WasmError :: fn from(err : gloo_storage::errors::StorageError) -> Self |
WasmError :: fn from(err : gloo_net::Error) -> Self |
WasmResult
Error types for WASM client operations.
| Item |
|---|
pub type WasmResult<T>: Result <T, WasmError> |
OutboxManager
Outbox queue manager for pending commands.
| Item |
|---|
pub struct OutboxManager<S : KeyValueStore> |
OutboxManager<S>:all
Outbox queue manager for pending commands.
| Item |
|---|
OutboxManager<S> :: fn all_pending(& self) -> Vec <& OutboxEntry> |
OutboxManager<S>:clear
Outbox queue manager for pending commands.
| Item |
|---|
OutboxManager<S> :: async fn clear_synced(& mut self) -> WasmResult <usize> |
OutboxManager<S>:conflicted
Outbox queue manager for pending commands.
| Item |
|---|
OutboxManager<S> :: fn conflicted(& self) -> Vec <& OutboxEntry> |
OutboxManager<S>:discard
Outbox queue manager for pending commands.
| Item |
|---|
OutboxManager<S> :: async fn discard(& mut self, entry_id : Uuid) -> WasmResult <()> |
OutboxManager<S>:failed
Outbox queue manager for pending commands.
| Item |
|---|
OutboxManager<S> :: fn failed(& self) -> Vec <& OutboxEntry> |
OutboxManager<S>:get
Outbox queue manager for pending commands.
| Item |
|---|
OutboxManager<S> :: fn get(& self, entry_id : Uuid) -> Option <& OutboxEntry> |
OutboxManager<S>:handle
Outbox queue manager for pending commands.
| Item |
|---|
OutboxManager<S> :: async fn handle_ack(& mut self, entry_id : Uuid, ack : & ServerAck) -> WasmResult <()> |
OutboxManager<S>:is
Outbox queue manager for pending commands.
| Item |
|---|
OutboxManager<S> :: fn is_empty(& self) -> bool |
OutboxManager<S>:len
Outbox queue manager for pending commands.
| Item |
|---|
OutboxManager<S> :: fn len(& self) -> usize |
OutboxManager<S>:mark
Outbox queue manager for pending commands.
| Item |
|---|
OutboxManager<S> :: async fn mark_syncing(& mut self, entry_id : Uuid) -> WasmResult <()> |
OutboxManager<S>:new
Outbox queue manager for pending commands.
| Item |
|---|
OutboxManager<S> :: async fn new(store : Arc <S>) -> WasmResult <Self> |
OutboxManager<S>:next
Outbox queue manager for pending commands.
| Item |
|---|
OutboxManager<S> :: fn next_pending(& mut self) -> Option <& mut OutboxEntry> |
OutboxManager<S>:queue
Outbox queue manager for pending commands.
| Item |
|---|
OutboxManager<S> :: async fn queue(& mut self, command : Command) -> WasmResult <OutboxEntry> |
OutboxManager<S>:remove
Outbox queue manager for pending commands.
| Item |
|---|
OutboxManager<S> :: async fn remove_synced(& mut self, entry_id : Uuid) -> WasmResult <()> |
OutboxManager<S>:retry
Outbox queue manager for pending commands.
| Item |
|---|
OutboxManager<S> :: async fn retry(& mut self, entry_id : Uuid) -> WasmResult <()> |
OutboxManager<S>:stats
Outbox queue manager for pending commands.
| Item |
|---|
OutboxManager<S> :: fn stats(& self) -> OutboxStats |
OutboxManager<S>:store
Outbox queue manager for pending commands.
| Item |
|---|
OutboxManager<S> :: fn store(& self) -> & Arc <S> |
SyncConfig
Sync engine that coordinates offline-first synchronization.
| Item |
|---|
pub struct SyncConfig |
SyncConfig :: fn new(base_url : impl Into <String>) -> Self |
SyncConfig :: fn with_sync_interval(mut self, interval_ms : u32) -> Self |
SyncConfig :: fn without_auto_sync(mut self) -> Self |
SyncEngine
Sync engine that coordinates offline-first synchronization.
| Item |
|---|
pub struct SyncEngine<S : KeyValueStore> |
SyncEngine<S>:check
Sync engine that coordinates offline-first synchronization.
| Item |
|---|
SyncEngine<S> :: async fn check_connection(& mut self) -> WasmResult <bool> |
SyncEngine<S>:conflicted
Sync engine that coordinates offline-first synchronization.
| Item |
|---|
SyncEngine<S> :: fn conflicted_entries(& self) -> Vec <& infrastructure_sync::OutboxEntry> |
SyncEngine<S>:connection
Sync engine that coordinates offline-first synchronization.
| Item |
|---|
SyncEngine<S> :: fn connection_state(& self) -> ConnectionState |
SyncEngine<S>:full
Sync engine that coordinates offline-first synchronization.
| Item |
|---|
SyncEngine<S> :: async fn full_sync(& mut self) -> WasmResult <SyncResult> |
SyncEngine<S>:get
Sync engine that coordinates offline-first synchronization.
| Item |
|---|
SyncEngine<S> :: async fn get_entity <T : serde::de::DeserializeOwned>(& self, entity_type : & str, entity_id : Uuid,) -> WasmResult <Option <T>> |
SyncEngine<S>:is
Sync engine that coordinates offline-first synchronization.
| Item |
|---|
SyncEngine<S> :: fn is_authenticated(& self) -> bool |
SyncEngine<S>:list
Sync engine that coordinates offline-first synchronization.
| Item |
|---|
SyncEngine<S> :: async fn list_entity_keys(& self, entity_type : & str) -> WasmResult <Vec <String>> |
SyncEngine<S>:login
Sync engine that coordinates offline-first synchronization.
| Item |
|---|
SyncEngine<S> :: async fn login(& mut self, email : & str, password : & str) -> WasmResult <()> |
SyncEngine<S>:logout
Sync engine that coordinates offline-first synchronization.
| Item |
|---|
SyncEngine<S> :: async fn logout(& mut self) -> WasmResult <()> |
SyncEngine<S>:new
Sync engine that coordinates offline-first synchronization.
| Item |
|---|
SyncEngine<S> :: async fn new(config : SyncConfig, store : Arc <S>) -> WasmResult <Self> |
SyncEngine<S>:outbox
Sync engine that coordinates offline-first synchronization.
| Item |
|---|
SyncEngine<S> :: fn outbox_stats(& self) -> infrastructure_sync::OutboxStats |
SyncEngine<S>:process
Sync engine that coordinates offline-first synchronization.
| Item |
|---|
SyncEngine<S> :: async fn process_outbox(& mut self) -> WasmResult <usize> |
SyncEngine<S>:pull
Sync engine that coordinates offline-first synchronization.
| Item |
|---|
SyncEngine<S> :: async fn pull_changes(& mut self) -> WasmResult <Vec <Change>> |
SyncEngine<S>:queue
Sync engine that coordinates offline-first synchronization.
| Item |
|---|
SyncEngine<S> :: async fn queue_command(& mut self, command : Command) -> WasmResult <()> |
SyncEngine<S>:resolve
Sync engine that coordinates offline-first synchronization.
| Item |
|---|
SyncEngine<S> :: async fn resolve_use_client(& mut self, entry_id : Uuid) -> WasmResult <()> |
SyncEngine<S> :: async fn resolve_use_server(& mut self, entry_id : Uuid) -> WasmResult <()> |
SyncEngine<S>:status
Sync engine that coordinates offline-first synchronization.
| Item |
|---|
SyncEngine<S> :: fn status(& self) -> & SyncStatus |
SyncEngine<S>:store
Sync engine that coordinates offline-first synchronization.
| Item |
|---|
SyncEngine<S> :: fn store(& self) -> & Arc <S> |
SyncResult
Sync engine that coordinates offline-first synchronization.
| Item |
|---|
pub struct SyncResult |
SyncResult :: fn is_empty(& self) -> bool |
SyncResult :: fn total(& self) -> usize |
sync_status (other)
Sync status tracking for UI display.
| Item |
|---|
fn time_since_sync(last_sync : Option <DateTime <Utc>>) -> String |
ConnectionState
Sync status tracking for UI display.
| Item |
|---|
pub enum ConnectionState |
ConnectionState :: fn is_online(& self) -> bool |
ConnectionState :: fn is_offline(& self) -> bool |
SyncStatus:SyncStatus
Sync status tracking for UI display.
| Item |
|---|
pub struct SyncStatus |
SyncStatus:default
Sync status tracking for UI display.
| Item |
|---|
SyncStatus :: fn default() -> Self |
SyncStatus:indicator
Sync status tracking for UI display.
| Item |
|---|
SyncStatus :: fn indicator(& self) ->(& 'static str, String, & 'static str) |
SyncStatus:is
Sync status tracking for UI display.
| Item |
|---|
SyncStatus :: fn is_fully_synced(& self) -> bool |
SyncStatus:needs
Sync status tracking for UI display.
| Item |
|---|
SyncStatus :: fn needs_attention(& self) -> bool |
SyncStatus:new
Sync status tracking for UI display.
| Item |
|---|
SyncStatus :: fn new() -> Self |
SyncStatus:set
Sync status tracking for UI display.
| Item |
|---|
SyncStatus :: fn set_online(& mut self) |
SyncStatus :: fn set_offline(& mut self) |
SyncStatus:sync
Sync status tracking for UI display.
| Item |
|---|
SyncStatus :: fn sync_started(& mut self) |
SyncStatus :: fn sync_completed(& mut self) |
SyncStatus :: fn sync_failed(& mut self, error : String) |
SyncStatus:total
Sync status tracking for UI display.
| Item |
|---|
SyncStatus :: fn total_outbox_items(& self) -> usize |
SyncStatus:update
Sync status tracking for UI display.
| Item |
|---|
SyncStatus :: fn update_from_outbox(& mut self, stats : & infrastructure_sync::OutboxStats) |
How to use it
From this crate's own rustdoc:
## Example
Module structure
platform_wasm_ui
api_clienterroroutbox_managersync_enginesync_status
flowchart TD n_platform_wasm_ui["platform_wasm_ui"] n_platform_wasm_ui --> n_api_client["api_client"] n_platform_wasm_ui --> n_error["error"] n_platform_wasm_ui --> n_outbox_manager["outbox_manager"] n_platform_wasm_ui --> n_sync_engine["sync_engine"] n_platform_wasm_ui --> n_sync_status["sync_status"]
Public surface
`api_client`
| Item | What it is |
|---|---|
pub struct ApiConfig | Configuration for the API client. |
ApiConfig :: fn new(base_url : impl Into <String>) -> Self | Create a new API config. |
ApiConfig :: fn with_timeout(mut self, timeout_ms : u32) -> Self | Set the timeout. |
pub struct ApiClient | HTTP client for API communication. |
ApiClient :: fn new(config : ApiConfig) -> Self | Create a new API client. |
ApiClient :: fn set_auth_token(& mut self, token : Option <String>) | Set the auth token. |
ApiClient :: fn is_authenticated(& self) -> bool | Check if authenticated. |
ApiClient :: async fn submit_command(& self, command : & Command) -> WasmResult <ServerAck> | Submit a command to the server. |
ApiClient :: async fn submit_commands(& self, commands : & Command) -> WasmResult <Vec <ServerAck>> | Submit multiple commands. |
ApiClient :: async fn pull_changes(& self, request : & PullRequest) -> WasmResult <PullResponse> | Pull changes from the server. |
ApiClient :: async fn login(& mut self, email : & str, password : & str) -> WasmResult <LoginResponse> | Login and get an auth token. |
ApiClient :: async fn logout(& mut self) -> WasmResult <()> | Logout. |
ApiClient :: async fn refresh_token(& mut self) -> WasmResult <String> | Refresh the auth token. |
ApiClient :: async fn health_check(& self) -> WasmResult <bool> | Check if the server is reachable. |
pub struct LoginResponse | Login response. |
`error`
| Item | What it is |
|---|---|
pub enum WasmError | Errors that can occur in the WASM client. |
WasmError :: fn storage(msg : impl Into <String>) -> Self | Create a storage error. |
WasmError :: fn network(msg : impl Into <String>) -> Self | Create a network error. |
WasmError :: fn serialization(msg : impl Into <String>) -> Self | Create a serialization error. |
WasmError :: fn not_found(entity_type : impl Into <String>, entity_id : impl Into <String>) -> Self | Create a not found error. |
WasmError :: fn server_error(status : u16, message : impl Into <String>) -> Self | Create a server error. |
WasmError :: fn is_retryable(& self) -> bool | Check if this error is retryable. |
WasmError :: fn requires_auth(& self) -> bool | Check if this requires re-authentication. |
WasmError :: fn from(err : serde_json::Error) -> Self | — |
WasmError :: fn from(err : gloo_storage::errors::StorageError) -> Self | — |
WasmError :: fn from(err : gloo_net::Error) -> Self | — |
pub type WasmResult<T>: Result <T, WasmError> | Result type for WASM operations. |
`outbox_manager`
| Item | What it is |
|---|---|
pub struct OutboxManager<S : KeyValueStore> | Manages the outbox queue for offline command storage |
OutboxManager<S> :: async fn new(store : Arc <S>) -> WasmResult <Self> | Create a new outbox manager with the given store. |
OutboxManager<S> :: fn store(& self) -> & Arc <S> | Get reference to the underlying store. |
OutboxManager<S> :: async fn queue(& mut self, command : Command) -> WasmResult <OutboxEntry> | Queue a new command. |
OutboxManager<S> :: fn next_pending(& mut self) -> Option <& mut OutboxEntry> | Get the next entry ready for processing |
OutboxManager<S> :: fn all_pending(& self) -> Vec <& OutboxEntry> | Get all pending entries (for batch processing). |
OutboxManager<S> :: async fn mark_syncing(& mut self, entry_id : Uuid) -> WasmResult <()> | Mark an entry as syncing. |
OutboxManager<S> :: async fn handle_ack(& mut self, entry_id : Uuid, ack : & ServerAck) -> WasmResult <()> | Handle a server acknowledgment. |
OutboxManager<S> :: async fn remove_synced(& mut self, entry_id : Uuid) -> WasmResult <()> | Remove a completed (synced) entry. |
OutboxManager<S> :: async fn clear_synced(& mut self) -> WasmResult <usize> | Clear all synced entries. |
OutboxManager<S> :: fn stats(& self) -> OutboxStats | Get statistics about the outbox. |
OutboxManager<S> :: fn conflicted(& self) -> Vec <& OutboxEntry> | Get all conflicted entries. |
OutboxManager<S> :: fn failed(& self) -> Vec <& OutboxEntry> | Get all failed entries. |
OutboxManager<S> :: async fn retry(& mut self, entry_id : Uuid) -> WasmResult <()> | Retry a failed entry. |
OutboxManager<S> :: async fn discard(& mut self, entry_id : Uuid) -> WasmResult <()> | Discard a conflicted or failed entry. |
OutboxManager<S> :: fn get(& self, entry_id : Uuid) -> Option <& OutboxEntry> | Get entry by ID. |
OutboxManager<S> :: fn is_empty(& self) -> bool | Check if outbox is empty. |
OutboxManager<S> :: fn len(& self) -> usize | Total number of entries. |
`sync_engine`
| Item | What it is |
|---|---|
pub struct SyncConfig | Configuration for the sync engine. |
SyncConfig :: fn new(base_url : impl Into <String>) -> Self | Create a new sync config. |
SyncConfig :: fn with_sync_interval(mut self, interval_ms : u32) -> Self | Set sync interval. |
SyncConfig :: fn without_auto_sync(mut self) -> Self | Disable auto-sync. |
pub struct SyncEngine<S : KeyValueStore> | The sync engine coordinates offline-first synchronization |
SyncEngine<S> :: async fn new(config : SyncConfig, store : Arc <S>) -> WasmResult <Self> | Create a new sync engine. |
SyncEngine<S> :: fn status(& self) -> & SyncStatus | Get current sync status. |
SyncEngine<S> :: fn is_authenticated(& self) -> bool | Check if authenticated. |
SyncEngine<S> :: async fn queue_command(& mut self, command : Command) -> WasmResult <()> | Queue a command for sync |
SyncEngine<S> :: async fn process_outbox(& mut self) -> WasmResult <usize> | Process the outbox (sync pending commands). |
SyncEngine<S> :: async fn pull_changes(& mut self) -> WasmResult <Vec <Change>> | Pull changes from the server. |
SyncEngine<S> :: async fn full_sync(& mut self) -> WasmResult <SyncResult> | Perform a full sync (push + pull). |
SyncEngine<S> :: async fn check_connection(& mut self) -> WasmResult <bool> | Check server connectivity. |
SyncEngine<S> :: fn connection_state(& self) -> ConnectionState | Get connection state. |
SyncEngine<S> :: async fn login(& mut self, email : & str, password : & str) -> WasmResult <()> | Login. |
SyncEngine<S> :: async fn logout(& mut self) -> WasmResult <()> | Logout. |
SyncEngine<S> :: fn conflicted_entries(& self) -> Vec <& infrastructure_sync::OutboxEntry> | Get conflicted entries. |
SyncEngine<S> :: async fn resolve_use_client(& mut self, entry_id : Uuid) -> WasmResult <()> | Resolve a conflict by using client version (force push). |
SyncEngine<S> :: async fn resolve_use_server(& mut self, entry_id : Uuid) -> WasmResult <()> | Resolve a conflict by discarding client changes. |
SyncEngine<S> :: fn store(& self) -> & Arc <S> | Get reference to the underlying store. |
SyncEngine<S> :: fn outbox_stats(& self) -> infrastructure_sync::OutboxStats | Get outbox stats. |
SyncEngine<S> :: async fn get_entity <T : serde::de::DeserializeOwned>(& self, entity_type : & str, entity_id : Uuid,) -> WasmResult <Option <T>> | Get an entity from local storage. |
SyncEngine<S> :: async fn list_entity_keys(& self, entity_type : & str) -> WasmResult <Vec <String>> | List all entity keys of a type. |
pub struct SyncResult | Result of a sync operation. |
SyncResult :: fn is_empty(& self) -> bool | Check if anything was synced. |
SyncResult :: fn total(& self) -> usize | Total changes. |
`sync_status`
| Item | What it is |
|---|---|
pub enum ConnectionState | Connection state. |
ConnectionState :: fn is_online(& self) -> bool | Check if online. |
ConnectionState :: fn is_offline(& self) -> bool | Check if offline. |
pub struct SyncStatus | Current sync status for UI display. |
SyncStatus :: fn default() -> Self | — |
SyncStatus :: fn new() -> Self | Create a new sync status. |
SyncStatus :: fn indicator(& self) ->(& 'static str, String, & 'static str) | Get status indicator for display |
SyncStatus :: fn needs_attention(& self) -> bool | Check if there are items needing attention. |
SyncStatus :: fn is_fully_synced(& self) -> bool | Check if everything is synced. |
SyncStatus :: fn total_outbox_items(& self) -> usize | Total items in outbox. |
SyncStatus :: fn set_online(& mut self) | Mark as online. |
SyncStatus :: fn set_offline(& mut self) | Mark as offline. |
SyncStatus :: fn update_from_outbox(& mut self, stats : & infrastructure_sync::OutboxStats) | Update from outbox stats. |
SyncStatus :: fn sync_started(& mut self) | Mark sync started. |
SyncStatus :: fn sync_completed(& mut self) | Mark sync completed successfully. |
SyncStatus :: fn sync_failed(& mut self, error : String) | Mark sync failed. |
fn time_since_sync(last_sync : Option <DateTime <Utc>>) -> String | Time since last sync, human-readable. |
Re-exports. Exported here, defined elsewhere.
| Export | Defined in |
|---|---|
IndexedDbStore | infrastructure_kv_store_indexeddb::IndexedDbStore |
OutboxManager | outbox_manager::OutboxManager |
{AckStatus,Change,Command,CommandId,Conflict,ConflictResolution,IdempotencyKey,OutboxEntry,OutboxStatus,PullRequest,PullResponse,ServerAck,Version,} | infrastructure_sync::{AckStatus,Change,Command,CommandId,Conflict,ConflictResolution,IdempotencyKey,OutboxEntry,OutboxStatus,PullRequest,PullResponse,ServerAck,Version,} |
{ApiClient,ApiConfig} | api_client::{ApiClient,ApiConfig} |
{ConnectionState,SyncStatus} | sync_status::{ConnectionState,SyncStatus} |
{ContentBlock,ContentPage,PageStatus,PageType} | content_cms::{ContentBlock,ContentPage,PageStatus,PageType} |
{InMemoryStore,KeyValueStore,KeyValueStoreExt} | infrastructure_kv_store::{InMemoryStore,KeyValueStore,KeyValueStoreExt} |
{SyncConfig,SyncEngine,SyncResult} | sync_engine::{SyncConfig,SyncEngine,SyncResult} |
{WasmError,WasmResult} | error::{WasmError,WasmResult} |
Boundary
Reaches into content, infrastructure.
Shares tier platform with 9 other crates: platform-api, platform-corpus-console, platform-customer-ui, platform-disclosure-lab, platform-dto, platform-html-components, platform-leptos-components, platform-privacy-scan-api, … (9 total).
_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._
Where it sits
| Tier (ontology) | platform |
| Architectural role (taxonomy) | unclassified (baselined) |
| Location | crates/platform/wasm-ui |
| Vocabulary in force (lexicon) | current |
Tier flow. Which tiers this crate's own edges cross.
flowchart LR n_platform["platform"] --> n_content["content"] n_platform["platform"] --> n_infrastructure["infrastructure"]
Dependencies
Runtime, in this workspace.
| Crate | Tier | Optional | Only on |
|---|---|---|---|
| `content-cms` | content | no | always |
| `infrastructure-kv-store` | infrastructure | no | always |
| `infrastructure-kv-store-indexeddb` | infrastructure | yes | always |
| `infrastructure-sync` | infrastructure | no | always |
Runtime, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
async-trait | ^0.1 | — | no | always |
chrono | ^0.4 | serde | no | always |
futures | ^0.3 | — | no | always |
gloo-net | ^0.6 | — | no | always |
gloo-storage | ^0.3 | — | no | always |
gloo-timers | ^0.3 | — | no | always |
leptos | ^0.6 | csr | yes | always |
serde | ^1 | derive | no | always |
serde_json | ^1 | — | no | always |
thiserror | ^2 | — | no | always |
uuid | ^1 | v4, v7, serde, js | no | always |
wasm-bindgen | ^0.2 | — | no | always |
wasm-bindgen-futures | ^0.4 | — | no | always |
web-sys | ^0.3 | Window, Document, Storage, console, HtmlInputElement, FormData, … (11 total) | no | always |
Development, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
tokio | ^1 | full, rt, macros | no | always |
wasm-bindgen-test | ^0.3 | — | no | always |
Build. None.
Depended on by. 1 workspace crate.
Signal flow — what reaches this crate, and what it reaches.
flowchart LR n_application_wasm_ui["application-wasm-ui"] -->|uses| SELF SELF["platform-wasm-ui"] SELF -->|runtime| n_content_cms["content-cms"] SELF -->|runtime| n_infrastructure_kv_store["infrastructure-kv-store"] SELF -->|runtime| n_infrastructure_kv_store_indexeddb["infrastructure-kv-store-indexeddb"] SELF -->|runtime| n_infrastructure_sync["infrastructure-sync"] classDef self fill:#1f883d,stroke:#1f883d,color:#fff; class SELF self;
Feature flags
| Feature | Enables | On by default |
|---|---|---|
default | — | yes |
indexeddb | infrastructure-kv-store-indexeddb | no |
infrastructure-kv-store-indexeddb | dep:infrastructure-kv-store-indexeddb | no |
leptos | dep:leptos | no |
leptos-ui | leptos | no |
flowchart LR n_default["default"] n_indexeddb["indexeddb"] --> n_infrastructure_kv_store_indexeddb["infrastructure-kv-store-indexeddb"] n_infrastructure_kv_store_indexeddb["infrastructure-kv-store-indexeddb"] --> n_dep_infrastructure_kv_store_indexeddb["dep:infrastructure-kv-store-indexeddb"] n_leptos["leptos"] --> n_dep_leptos["dep:leptos"] n_leptos_ui["leptos-ui"] --> n_leptos["leptos"]
Targets
| Kind | Name | Source |
|---|---|---|
| lib | platform_wasm_ui | `src/lib.rs` |
Error model
| Error type | Named by |
|---|---|
WasmError | WasmResult |
Operational characteristics
| Property | Evidence |
|---|---|
| async public surface | yes |
| async runtime | none detected |
| database access | none detected |
| network I/O | none detected |
| unsafe code | none detected |
| environment variables | none detected |
No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.
Configuration
No environment variable is read with a literal name anywhere in this crate. A variable whose key is computed at run time cannot be listed here, and is not claimed to be absent.
Related capabilities
1 workspace crate depends on this one: application-wasm-ui.
Verification
| Kind | Count |
|---|---|
| Unit tests | 20 |
| Integration tests | 0 |
| Examples | 0 |
| Doctests | 1 |
Evidence by module. How often each public module is named by something executable.
| Module | Tests | Examples | Consumers |
|---|---|---|---|
api_client | 3 | 0 | 0 |
error | 2 | 0 | 0 |
outbox_manager | 1 | 0 | 0 |
sync_engine | 3 | 0 | 0 |
sync_status | 3 | 0 | 0 |
What the tests establish, by name:
test_api_config—src/api_client.rstest_auth_state—src/api_client.rstest_url_building—src/api_client.rstest_error_requires_auth—src/error.rstest_error_retryable—src/error.rstest_max_retries_constant—src/outbox_manager.rstest_outbox_mark_synced—src/outbox_manager.rstest_outbox_persistence—src/outbox_manager.rstest_outbox_queue_and_stats—src/outbox_manager.rstest_outbox_stats_calculation—src/outbox_manager.rstest_sync_config—src/sync_engine.rstest_sync_engine_creation—src/sync_engine.rstest_sync_engine_metadata_persistence—src/sync_engine.rstest_sync_engine_queue_command—src/sync_engine.rstest_sync_engine_storage_portability—src/sync_engine.rstest_sync_result—src/sync_engine.rstest_connection_state—src/sync_status.rstest_sync_status_checks—src/sync_status.rstest_sync_status_indicators—src/sync_status.rstest_time_since_sync—src/sync_status.rs
Documentation coverage
| Measure | Documented | Total |
|---|---|---|
| Public items with rustdoc | 84 | 88 |
Public modules with a //! block | 5 | 5 |
pie showData
title Public items with rustdoc
"Documented" : 84
"No rustdoc detected" : 4
Metrics
| Metric | Value |
|---|---|
| Rust source files | 6 |
| Source lines | 1766 |
| Code lines | 1181 |
| Public API items | 88 |
| Public modules | 5 |
| Tests | 20 |
| Examples | 0 |
| Cargo features | 5 |
| Direct runtime dependencies | 18 |
| Workspace reverse dependencies | 1 |
pie showData
title Public API by kind
"enum" : 2
"function" : 1
"method" : 76
"struct" : 8
"type alias" : 1
pie showData
title Rust source composition
"Code" : 1181
"Blank or comment" : 585
Generation
Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.