Skip to main content

adminx_core/
lib.rs

1// adminx-core/src/lib.rs
2//
3// Framework-neutral core of the adminx admin-panel framework. Contains no web
4// framework and no database dependency: it defines the `Resource` trait, the
5// `Storage` abstraction, the registry, and neutral request/response types.
6//
7// Web adapters (adminx-actix, adminx-axum) translate their framework's
8// request/response to/from `ReqCtx`/`ApiResponse`. Storage adapters
9// (adminx-seaorm, adminx-mongo) implement `Storage`.
10
11pub mod actions;
12pub mod attach;
13pub mod audit;
14pub mod auth;
15pub mod authz;
16pub mod crud;
17pub mod csrf;
18pub mod error;
19pub mod export;
20pub mod filters;
21pub mod menu;
22pub mod mfa;
23pub mod ratelimit;
24pub mod registry;
25pub mod request;
26pub mod resource;
27pub mod search;
28pub mod response;
29pub mod storage;
30pub mod ui;
31
32pub use actions::{ActionFuture, ActionHandler, CustomAction};
33pub use attach::{attachments, set_attachments, Attachment, Attachments, FileField, UploadedFile};
34pub use audit::{auditor, set_auditor, AuditEntry, Auditor, Event as AuditEvent};
35pub use auth::AuthConfig;
36pub use authz::{authorizer, set_authorizer, Action, Authorizer};
37pub use error::CoreError;
38pub use filters::{FilterField, FilterKind, FilterOption};
39pub use menu::{MenuAction, MenuItem};
40pub use registry::{all_resources, get_registered_menus, register_resource};
41pub use request::{Claims, ReqCtx};
42pub use resource::Resource;
43pub use search::{indexer, set_indexer, Indexer};
44pub use response::{ApiBody, ApiResponse};
45pub use ui::set_tailwind_src;
46pub use storage::{
47    seed, set_storage, storage, CreateOutcome, ListPage, QueryOptions, Storage, StorageError,
48};
49
50pub const VERSION: &str = env!("CARGO_PKG_VERSION");
51
52/// Common imports for defining resources and wiring an app.
53pub mod prelude {
54    pub use crate::actions::{ActionFuture, CustomAction};
55    pub use crate::attach::{set_attachments, Attachment, Attachments, FileField, UploadedFile};
56    pub use crate::audit::{set_auditor, AuditEntry, Auditor};
57    pub use crate::auth::{configure as configure_auth, create_admin, AuthConfig};
58    pub use crate::authz::{set_authorizer, Action, Authorizer};
59    pub use crate::error::CoreError;
60    pub use crate::filters::{FilterField, FilterKind, FilterOption};
61    pub use crate::registry::{all_resources, register_resource};
62    pub use crate::request::{Claims, ReqCtx};
63    pub use crate::resource::Resource;
64    pub use crate::search::{set_indexer, Indexer};
65    pub use crate::response::{ApiBody, ApiResponse};
66    pub use crate::storage::{seed, set_storage, storage, QueryOptions, Storage};
67}