vtx_sdk/
lib.rs

1/// WIT Interface Binding Module (Private)
2///
3/// # Description
4/// This module is responsible for generating and managing interface bindings defined by the VTX Protocol.
5/// It no longer depends on local files, but directly uses the single source of truth provided by `vtx-protocol`.
6pub mod bindings {
7    include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
8}
9
10/// Core SDK building blocks.
11pub mod core;
12
13/// Error Type Definitions and Unified Error Handling.
14pub mod error;
15
16/// Functional domain modules.
17pub mod modules;
18
19/// Common Prelude Module (exports common types/macros/helper functions).
20pub mod prelude;
21
22/// Plugin Export Adapter with Lower Boilerplate.
23pub mod plugin;
24
25/// Exports the plugin implementation interface definition (`export!(...)`).
26/// Provides the interface for external plugin usage.
27pub use bindings::export;
28
29pub use bindings::vtx::api::vtx_types::{Capabilities, HttpAllowRule};
30/// Core type re-exports.
31pub use core::manifest::Manifest;
32
33/// User Context Structure, commonly used in authorization interfaces.
34/// The `UserContext` type is often used for user authentication and permission check context data.
35pub use bindings::vtx::api::vtx_auth_types::{CurrentUser, UserContext};
36
37/// Error aliases and result helpers.
38pub use error::{Error, Result, VtxError, VtxResult};
39
40/// Capability declaration builders and permission helpers.
41pub use core::capabilities::{
42    CapabilitiesBuilder, CapabilitiesExt, HttpAllowRuleBuilder, VtxErrorExt, PERM_BUFFER_CREATE,
43    PERM_FFMPEG_EXECUTE, PERM_FILE_READ, PERM_FILE_WRITE, PERM_SQL_WRITE,
44};
45
46/// Domain-oriented modules.
47pub mod auth {
48    pub use crate::modules::auth::*;
49}
50
51pub mod data {
52    pub use crate::modules::data::*;
53}
54
55pub mod io {
56    pub use crate::modules::io::*;
57}
58
59pub mod net {
60    pub use crate::modules::net::*;
61}
62
63pub mod media {
64    pub use crate::modules::media::*;
65}
66
67pub mod event {
68    pub use crate::modules::event::*;
69}
70
71/// Focused facade modules for common use cases.
72pub mod db {
73    pub use crate::modules::data::sql::*;
74}
75
76pub mod fs {
77    pub use crate::modules::io::fs::{
78        buffer_from_json, buffer_from_string, create_memory_buffer, head, list_objects, open_uri,
79        read_all, read_json, read_range, read_to_string, VfsBuffer, VfsObjectMeta,
80    };
81    pub use crate::modules::io::stream::{memory_buffer, open_file, BufferExt, StreamBuffer};
82}
83
84pub mod http {
85    pub use crate::modules::net::http::*;
86
87    pub mod client {
88        pub use crate::modules::net::client::*;
89    }
90}
91
92/// Exposes the WIT interface definition content used by the SDK.
93/// Directly reuses constants from the `vtx-protocol` crate, with zero runtime overhead.
94#[cfg(feature = "meta")]
95pub const WIT_DEFINITION: &str = vtx_protocol::WIT_CONTENT;
96
97/// SDK Version Number.
98#[cfg(feature = "meta")]
99pub const VERSION: &str = env!("CARGO_PKG_VERSION");