orbis_plugin_api/lib.rs
1//! Orbis Plugin API
2//!
3//! This crate provides the core types and traits needed to develop plugins for Orbis.
4//! It includes:
5//! - **SDK**: Complete plugin development kit with minimal boilerplate
6//! - **UI schema types**: Declarative interface definitions
7//! - **Plugin manifest**: Metadata and configuration structures
8//! - **Runtime host functions**: WASM plugin host interface
9//! - **Error handling**: Plugin-specific error types
10//!
11//! This is the only crate plugin developers need to depend on.
12//!
13//! # Quick Start
14//!
15//! ```rust,ignore
16//! use orbis_plugin_api::prelude::*;
17//!
18//! // Define your plugin with zero boilerplate
19//! orbis_plugin! {
20//! init: || {
21//! log::info!("Plugin initialized!");
22//! Ok(())
23//! }
24//! }
25//!
26//! // Create a handler
27//! #[handler]
28//! fn my_handler(ctx: Context) -> Result<Response> {
29//! let count = state::increment("visits")?;
30//! Response::json(&json!({ "visits": count }))
31//! }
32//! ```
33
34pub mod error;
35pub mod manifest;
36pub mod runtime;
37pub mod sdk;
38pub mod ui;
39
40// Re-export key types for convenience
41pub use error::{Error, Result};
42pub use manifest::{PluginDependency, PluginManifest, PluginPermission, PluginRoute};
43pub use runtime::{HostFunctions, LogLevel, PluginContext};
44pub use ui::{
45 AccordionItem, Action, ArgMapping, BreadcrumbItem, ComponentSchema, CustomValidation,
46 DialogDefinition, EventHandlers, FormField, NavigationConfig, NavigationItem, PageDefinition,
47 PageLifecycleHooks, SelectOption, StateFieldDefinition, StateFieldType, TabItem, TableColumn,
48 ToastLevel, ValidationRule,
49};
50
51/// Prelude for convenient imports in plugins
52///
53/// ```rust,ignore
54/// use orbis_plugin_api::prelude::*;
55/// ```
56pub mod prelude {
57 pub use crate::sdk::prelude::*;
58 pub use crate::{log_debug, log_error, log_info, log_trace, log_warn, orbis_plugin, wrap_handler};
59}