vtx-sdk 0.1.14

Official SDK for developing VTX plugins using Rust and WebAssembly.
Documentation
/// WIT Interface Binding Module (Private)
///
/// # Description
/// This module is responsible for generating and managing interface bindings defined by the VTX Protocol.
/// It no longer depends on local files, but directly uses the single source of truth provided by `vtx-protocol`.
pub mod bindings {
    include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
}

/// Core SDK building blocks.
pub mod core;

/// Error Type Definitions and Unified Error Handling.
pub mod error;

/// Functional domain modules.
pub mod modules;

/// Common Prelude Module (exports common types/macros/helper functions).
pub mod prelude;

/// Plugin Export Adapter with Lower Boilerplate.
pub mod plugin;

/// Exports the plugin implementation interface definition (`export!(...)`).
/// Provides the interface for external plugin usage.
pub use bindings::export;

pub use bindings::vtx::api::vtx_types::{Capabilities, HttpAllowRule};
/// Core type re-exports.
pub use core::manifest::Manifest;

/// User Context Structure, commonly used in authorization interfaces.
/// The `UserContext` type is often used for user authentication and permission check context data.
pub use bindings::vtx::api::vtx_auth_types::{CurrentUser, UserContext};

/// Error aliases and result helpers.
pub use error::{Error, Result, VtxError, VtxResult};

/// Capability declaration builders and permission helpers.
pub use core::capabilities::{
    CapabilitiesBuilder, CapabilitiesExt, HttpAllowRuleBuilder, VtxErrorExt, PERM_BUFFER_CREATE,
    PERM_FFMPEG_EXECUTE, PERM_FILE_READ, PERM_FILE_WRITE, PERM_SQL_WRITE,
};

/// Domain-oriented modules.
pub mod auth {
    pub use crate::modules::auth::*;
}

pub mod data {
    pub use crate::modules::data::*;
}

pub mod io {
    pub use crate::modules::io::*;
}

pub mod net {
    pub use crate::modules::net::*;
}

pub mod media {
    pub use crate::modules::media::*;
}

pub mod event {
    pub use crate::modules::event::*;
}

/// Focused facade modules for common use cases.
pub mod db {
    pub use crate::modules::data::sql::*;
}

pub mod fs {
    pub use crate::modules::io::fs::{
        buffer_from_json, buffer_from_string, create_memory_buffer, head, list_objects, open_uri,
        read_all, read_json, read_range, read_to_string, VfsBuffer, VfsObjectMeta,
    };
    pub use crate::modules::io::stream::{memory_buffer, open_file, BufferExt, StreamBuffer};
}

pub mod http {
    pub use crate::modules::net::http::*;

    pub mod client {
        pub use crate::modules::net::client::*;
    }
}

/// Exposes the WIT interface definition content used by the SDK.
/// Directly reuses constants from the `vtx-protocol` crate, with zero runtime overhead.
#[cfg(feature = "meta")]
pub const WIT_DEFINITION: &str = vtx_protocol::WIT_CONTENT;

/// SDK Version Number.
#[cfg(feature = "meta")]
pub const VERSION: &str = env!("CARGO_PKG_VERSION");