canic_core/api/app.rs
1use crate::{PublicError, dto::state::AppCommand, workflow};
2
3///
4/// Apply an application-level command.
5///
6/// Public API entry point for mutating application state. This function:
7/// - is safe to call from user canisters and endpoint code
8/// - returns [`PublicError`] suitable for IC boundaries
9/// - delegates all orchestration to the internal workflow layer
10///
11/// Layering:
12/// user canister → api → workflow
13///
14pub async fn apply_command(cmd: AppCommand) -> Result<(), PublicError> {
15 workflow::app::apply_command(cmd)
16 .await
17 .map_err(PublicError::from)
18}