1pub mod macros;
49pub use macros::log_include_hydration_failure;
50
51pub const STANDARD_ENDPOINT_COUNT: usize = 12;
53
54pub mod config;
55pub mod crud;
56pub mod entity;
57pub mod repository;
58pub mod extractors;
59pub mod http;
60pub mod permission;
61pub mod grpc;
62pub mod builder;
63pub mod utils;
64pub mod persistence;
65pub mod specification;
66pub mod registry;
67
68pub mod module;
70pub mod module_registry;
71
72pub mod domain_service;
74pub mod command;
75pub mod query;
76pub mod value_object;
77pub mod aggregate;
78pub mod error;
79
80pub mod service;
82pub mod violation;
83pub mod write_guard;
84pub mod write_hooks;
85pub mod notification;
86pub mod row_rule;
87pub mod actor_roles;
88pub mod usecase;
89pub mod validation;
90pub mod policy;
91pub mod bulk;
92pub mod integration;
93pub mod cqrs;
94pub mod graphql;
95
96pub mod trigger;
98pub mod flow;
99pub mod workflow;
100pub mod projection;
101pub mod state_machine;
102
103#[cfg(feature = "openapi")]
105pub mod openapi;
106
107#[allow(deprecated)]
108pub use trigger::{
109 TriggerHandler, TriggerEvent, TriggerContext, TriggerContextMut,
110 ActionExecutor, TriggerRegistry,
111};
112
113pub use entity::*;
115pub use repository::*;
116pub use grpc::*;
117pub use builder::*;
118
119pub use config::{
121 BackboneConfig, ConfigError, ConfigResult, ConfigLoader,
122 AppConfig, Environment,
124 ServerConfig,
126 DatabaseConfig, CacheConfig,
128 ModulesConfig, SapiensConfig, PostmanConfig, BucketConfig,
130 SapiensAuthConfig, PasswordHasherConfig, SapiensLockoutConfig,
131 SmtpConfig, TemplatesConfig, StorageConfig,
132 LoggingConfig, LoggingFileConfig,
134 MonitoringConfig,
136 ContextsConfig, RedisEventBusConfig,
138 FeaturesConfig, RateLimitingConfig,
140 SecurityConfig, CsrfConfig, SecurityHeadersConfig,
142 ConfigurationBus, ConfigValue, ConfigChangeEvent,
144};
145
146pub use http::{
148 CrudService,
150 BackboneCrudHandler,
151 BackboneHttpHandler,
152 AccessScope,
154 ApiResponse,
156 PaginatedResponse,
157 PaginatedApiResponse,
158 PaginationResponse,
159 BulkResponse,
160 BulkCreateRequest,
161 ListQueryParams,
163 ListRequest,
164 UpsertRequest,
165 FilterOptions,
166 SortOrder,
167 BatchIdsRequest,
168 BulkUpdateItem,
169 BulkPatchItem,
170 BulkPatchRequest,
171 PaginationRequest,
173};
174
175#[cfg(feature = "openapi")]
177pub use openapi::BackboneComponents;
178
179pub use utils::{
181 BackboneError, PaginationParams, PaginationMeta as BackbonePaginationMeta,
182 now, days_ago, days_from_now, hours_ago, hours_from_now, minutes_from_now,
183 new_id, new_id_string, parse_id, is_valid_uuid,
184 is_valid_email, is_valid_username, normalize_string,
185};
186
187pub use persistence::{
189 CrudRepository, PersistentEntity, Reference, RepositoryError, PartialUpdatable, SearchableRepository, Versioned,
191 InMemoryRepository,
193 CrudServiceAdapter, SimpleCrudServiceAdapter, AdapterError,
195};
196
197pub use specification::{
199 Specification,
201 AndSpecification, OrSpecification, NotSpecification,
203 SpecificationResult, SpecificationEvaluator,
205 AlwaysTrue, AlwaysFalse, PredicateSpecification,
207 predicate,
209};
210
211#[cfg(feature = "postgres")]
213pub use persistence::{PostgresRepository, PostgresRepositoryBuilder, PostgresEntity};
214
215pub use registry::{
217 ModuleService,
219 ServiceRegistry,
221 ServiceHealth, HealthStatus, RegistryHealth, RegistryStatistics,
223 ServiceDescriptor,
225};
226
227pub use module::{
229 BackboneModule,
230 MigrationInfo,
231 SeedInfo,
232};
233
234pub use module_registry::{
235 ModuleRegistry,
236 ModuleRegistryError,
237 ModuleRegistryResult,
238};
239
240pub use domain_service::{DomainService, TransactionalDomainService};
242
243pub use command::{Command, CommandHandler, CommandDispatcher, ValidatableCommand, ValidatingCommandHandler};
244
245pub use query::{
246 Query, QueryHandler, QueryDispatcher,
247 CacheableQuery, PaginatedQuery, PaginatedQueryResult,
248};
249
250pub use value_object::{ValueObject, OptionalValueObject, ValueObjectError};
251
252pub use aggregate::{AggregateRoot, EventSourcedAggregate, InvariantAggregate, AggregateMetadata};
253
254pub use error::{ModuleError, ErrorCategory, ErrorResponse, CommonError};
255
256pub use violation::{code_from_constraint, Violation};
258pub use write_guard::{AllowAll, GuardOutcome, WriteCtx, WriteGuard, WriteKind};
259pub use write_hooks::{Change, ChangeKind, DeclaredEvent, NoWriteHooks, WriteHooks};
262pub use service::{
263 GenericCrudService, ServiceError, ServiceResult,
264 FromCreateDto, ApplyUpdateDto, ServiceLifecycle, NoOpLifecycle,
265};
266
267pub use usecase::{
268 UseCaseError, UseCaseResult,
269 UseCaseHooks, DefaultHooks,
270 UseCaseService, EntityFactory, EntityUpdater,
271 CreateUseCase, UpdateUseCase, GetUseCase, DeleteUseCase,
272 ListUseCase, ListParams, ListResult, ListService,
273};
274
275pub use validation::{
276 ValidationError, ValidationErrors, FieldRule, EntityValidator,
277 RequiredString, MaxLength, NonNegative, OptionalNotBlank, Regex, RequiredUuid,
278};
279
280pub use policy::{
281 PolicyContext, PolicyOutcome, PolicyDecision, DomainPolicy,
282 PermitAllPolicy, DenyAllPolicy,
283 AllOfPolicy, AnyOfPolicy, NotPolicy,
284};
285
286pub use bulk::{
287 BulkFailureMode, BulkOperationConfig, BulkItemResult, BulkOperationResult,
288 BulkOperationProgress, BulkCapableService, GenericBulkService,
289};
290
291pub use integration::{
292 ModuleAdapter, ProjectionAdapter, IntegrationError,
293 EventBridge, IdentityAdapter, identity_adapter,
294};
295
296pub use cqrs::{
297 GenericCreateCommand, GenericUpdateCommand, GenericDeleteCommand, GenericRestoreCommand,
299 GenericGetQuery, GenericListQuery, GenericListDeletedQuery,
301 GenericCommandHandler, GenericQueryHandler,
303 CqrsService, CqrsReadService,
305};
306
307pub use graphql::{
308 GenericGraphQLResolver, GraphQLCapableService,
309 GraphQLListResult, GraphQLPaginationInput,
310};
311
312pub const VERSION: &str = env!("CARGO_PKG_VERSION");
317
318pub const STANDARD_ENDPOINTS: [&str; 11] = [
331 "GET /api/v1/{collection}",
332 "POST /api/v1/{collection}",
333 "GET /api/v1/{collection}/:id",
334 "PUT /api/v1/{collection}/:id",
335 "PATCH /api/v1/{collection}/:id",
336 "DELETE /api/v1/{collection}/:id",
337 "POST /api/v1/{collection}/bulk",
338 "POST /api/v1/{collection}/upsert",
339 "GET /api/v1/{collection}/trash",
340 "POST /api/v1/{collection}/:id/restore",
341 "DELETE /api/v1/{collection}/empty",
342];