pub struct PluginRegistry { /* private fields */ }Implementations§
Source§impl PluginRegistry
impl PluginRegistry
pub fn new(manifest: AppManifest) -> Self
Sourcepub fn all_routes(&self) -> Vec<&PluginRoute>
pub fn all_routes(&self) -> Vec<&PluginRoute>
Collect all custom routes from all plugins.
Sourcepub fn run_before_insert(
&self,
entity: &str,
data: &mut Value,
auth: &AuthContext,
) -> Result<(), PluginError>
pub fn run_before_insert( &self, entity: &str, data: &mut Value, auth: &AuthContext, ) -> Result<(), PluginError>
Run before_insert hooks. Returns first error, or Ok.
Sourcepub fn run_after_insert(
&self,
entity: &str,
id: &str,
data: &Value,
auth: &AuthContext,
)
pub fn run_after_insert( &self, entity: &str, id: &str, data: &Value, auth: &AuthContext, )
Run after_insert hooks.
Sourcepub fn run_before_update(
&self,
entity: &str,
id: &str,
data: &mut Value,
auth: &AuthContext,
) -> Result<(), PluginError>
pub fn run_before_update( &self, entity: &str, id: &str, data: &mut Value, auth: &AuthContext, ) -> Result<(), PluginError>
Run before_update hooks.
Sourcepub fn run_after_update(
&self,
entity: &str,
id: &str,
data: &Value,
auth: &AuthContext,
)
pub fn run_after_update( &self, entity: &str, id: &str, data: &Value, auth: &AuthContext, )
Run after_update hooks.
Sourcepub fn run_before_delete(
&self,
entity: &str,
id: &str,
auth: &AuthContext,
) -> Result<(), PluginError>
pub fn run_before_delete( &self, entity: &str, id: &str, auth: &AuthContext, ) -> Result<(), PluginError>
Run before_delete hooks.
Sourcepub fn run_after_delete(&self, entity: &str, id: &str, auth: &AuthContext)
pub fn run_after_delete(&self, entity: &str, id: &str, auth: &AuthContext)
Run after_delete hooks.
Sourcepub fn run_on_request(
&self,
method: &str,
path: &str,
auth: &AuthContext,
) -> Result<(), PluginError>
pub fn run_on_request( &self, method: &str, path: &str, auth: &AuthContext, ) -> Result<(), PluginError>
Run on_request middleware. Returns first error, or Ok.
This is the legacy entry point — it has no peer-IP info, so the
built-in rate limiter degrades to a single __anon__ bucket for
unauthenticated callers. Prefer [run_on_request_with_meta] from
the HTTP layer where peer IP is available.
Sourcepub fn run_on_request_with_meta(
&self,
method: &str,
path: &str,
auth: &AuthContext,
meta: &RequestMeta<'_>,
) -> Result<(), PluginError>
pub fn run_on_request_with_meta( &self, method: &str, path: &str, auth: &AuthContext, meta: &RequestMeta<'_>, ) -> Result<(), PluginError>
Run on_request middleware with per-request metadata. Plugins that
override on_request_with_meta (e.g. RateLimitPlugin for per-IP
bucketing) get the richer path; others fall through to the default
delegate so existing plugins keep working.
Sourcepub fn try_handle_route(
&self,
method: &str,
path: &str,
body: &str,
auth: &AuthContext,
) -> Option<(u16, String)>
pub fn try_handle_route( &self, method: &str, path: &str, body: &str, auth: &AuthContext, ) -> Option<(u16, String)>
Try to handle a request with plugin routes.