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 grpc;
61pub mod builder;
62pub mod utils;
63pub mod persistence;
64pub mod specification;
65pub mod registry;
66
67pub mod module;
69pub mod module_registry;
70
71pub mod domain_service;
73pub mod command;
74pub mod query;
75pub mod value_object;
76pub mod aggregate;
77pub mod error;
78
79pub mod service;
81pub mod violation;
82pub mod write_guard;
83pub mod usecase;
84pub mod validation;
85pub mod policy;
86pub mod bulk;
87pub mod integration;
88pub mod cqrs;
89pub mod graphql;
90
91pub mod trigger;
93pub mod flow;
94pub mod projection;
95pub mod state_machine;
96
97#[cfg(feature = "openapi")]
99pub mod openapi;
100
101pub use trigger::{
102 TriggerHandler, TriggerEvent, TriggerContext, TriggerContextMut,
103 ActionExecutor, TriggerRegistry,
104};
105
106pub use entity::*;
108pub use repository::*;
109pub use grpc::*;
110pub use builder::*;
111
112pub use config::{
114 BackboneConfig, ConfigError, ConfigResult, ConfigLoader,
115 AppConfig, Environment,
117 ServerConfig,
119 DatabaseConfig, CacheConfig,
121 ModulesConfig, SapiensConfig, PostmanConfig, BucketConfig,
123 SapiensAuthConfig, PasswordHasherConfig, SapiensLockoutConfig,
124 SmtpConfig, TemplatesConfig, StorageConfig,
125 LoggingConfig, LoggingFileConfig,
127 MonitoringConfig,
129 ContextsConfig, RedisEventBusConfig,
131 FeaturesConfig, RateLimitingConfig,
133 SecurityConfig, CsrfConfig, SecurityHeadersConfig,
135 ConfigurationBus, ConfigValue, ConfigChangeEvent,
137};
138
139pub use http::{
141 CrudService,
143 BackboneCrudHandler,
144 BackboneHttpHandler,
145 AccessScope,
147 ApiResponse,
149 PaginatedResponse,
150 PaginatedApiResponse,
151 PaginationResponse,
152 BulkResponse,
153 BulkCreateRequest,
154 ListQueryParams,
156 ListRequest,
157 UpsertRequest,
158 FilterOptions,
159 SortOrder,
160 BatchIdsRequest,
161 BulkUpdateItem,
162 BulkPatchItem,
163 BulkPatchRequest,
164 PaginationRequest,
166};
167
168#[cfg(feature = "openapi")]
170pub use openapi::BackboneComponents;
171
172pub use utils::{
174 BackboneError, PaginationParams, PaginationMeta as BackbonePaginationMeta,
175 now, days_ago, days_from_now, hours_ago, hours_from_now, minutes_from_now,
176 new_id, new_id_string, parse_id, is_valid_uuid,
177 is_valid_email, is_valid_username, normalize_string,
178};
179
180pub use persistence::{
182 CrudRepository, PersistentEntity, RepositoryError, PartialUpdatable, SearchableRepository, Versioned,
184 InMemoryRepository,
186 CrudServiceAdapter, SimpleCrudServiceAdapter, AdapterError,
188};
189
190pub use specification::{
192 Specification,
194 AndSpecification, OrSpecification, NotSpecification,
196 SpecificationResult, SpecificationEvaluator,
198 AlwaysTrue, AlwaysFalse, PredicateSpecification,
200 predicate,
202};
203
204#[cfg(feature = "postgres")]
206pub use persistence::{PostgresRepository, PostgresRepositoryBuilder, PostgresEntity};
207
208pub use registry::{
210 ModuleService,
212 ServiceRegistry,
214 ServiceHealth, HealthStatus, RegistryHealth, RegistryStatistics,
216 ServiceDescriptor,
218};
219
220pub use module::{
222 BackboneModule,
223 MigrationInfo,
224 SeedInfo,
225};
226
227pub use module_registry::{
228 ModuleRegistry,
229 ModuleRegistryError,
230 ModuleRegistryResult,
231};
232
233pub use domain_service::{DomainService, TransactionalDomainService};
235
236pub use command::{Command, CommandHandler, CommandDispatcher, ValidatableCommand, ValidatingCommandHandler};
237
238pub use query::{
239 Query, QueryHandler, QueryDispatcher,
240 CacheableQuery, PaginatedQuery, PaginatedQueryResult,
241};
242
243pub use value_object::{ValueObject, OptionalValueObject, ValueObjectError};
244
245pub use aggregate::{AggregateRoot, EventSourcedAggregate, InvariantAggregate, AggregateMetadata};
246
247pub use error::{ModuleError, ErrorCategory, ErrorResponse, CommonError};
248
249pub use violation::{code_from_constraint, Violation};
251pub use write_guard::{AllowAll, GuardOutcome, WriteCtx, WriteGuard, WriteKind};
252pub use service::{
253 GenericCrudService, ServiceError, ServiceResult,
254 FromCreateDto, ApplyUpdateDto, ServiceLifecycle, NoOpLifecycle,
255};
256
257pub use usecase::{
258 UseCaseError, UseCaseResult,
259 UseCaseHooks, DefaultHooks,
260 UseCaseService, EntityFactory, EntityUpdater,
261 CreateUseCase, UpdateUseCase, GetUseCase, DeleteUseCase,
262 ListUseCase, ListParams, ListResult, ListService,
263};
264
265pub use validation::{
266 ValidationError, ValidationErrors, FieldRule, EntityValidator,
267 RequiredString, MaxLength, NonNegative, OptionalNotBlank, Regex, RequiredUuid,
268};
269
270pub use policy::{
271 PolicyContext, PolicyOutcome, PolicyDecision, DomainPolicy,
272 PermitAllPolicy, DenyAllPolicy,
273 AllOfPolicy, AnyOfPolicy, NotPolicy,
274};
275
276pub use bulk::{
277 BulkFailureMode, BulkOperationConfig, BulkItemResult, BulkOperationResult,
278 BulkOperationProgress, BulkCapableService, GenericBulkService,
279};
280
281pub use integration::{
282 ModuleAdapter, ProjectionAdapter, IntegrationError,
283 EventBridge, IdentityAdapter, identity_adapter,
284};
285
286pub use cqrs::{
287 GenericCreateCommand, GenericUpdateCommand, GenericDeleteCommand, GenericRestoreCommand,
289 GenericGetQuery, GenericListQuery, GenericListDeletedQuery,
291 GenericCommandHandler, GenericQueryHandler,
293 CqrsService, CqrsReadService,
295};
296
297pub use graphql::{
298 GenericGraphQLResolver, GraphQLCapableService,
299 GraphQLListResult, GraphQLPaginationInput,
300};
301
302pub const VERSION: &str = env!("CARGO_PKG_VERSION");
307
308pub const STANDARD_ENDPOINTS: [&str; 11] = [
321 "GET /api/v1/{collection}",
322 "POST /api/v1/{collection}",
323 "GET /api/v1/{collection}/:id",
324 "PUT /api/v1/{collection}/:id",
325 "PATCH /api/v1/{collection}/:id",
326 "DELETE /api/v1/{collection}/:id",
327 "POST /api/v1/{collection}/bulk",
328 "POST /api/v1/{collection}/upsert",
329 "GET /api/v1/{collection}/trash",
330 "POST /api/v1/{collection}/:id/restore",
331 "DELETE /api/v1/{collection}/empty",
332];