supply_inventory 1.0.0
supply_inventory: ^1.0.0 copied to clipboard
A production-grade DDD package for supply chain and inventory management with strict invariant protection and time safety.
1.0.0 #
- Initial Release 🎉
Features #
- Complete domain model for supply chain and inventory management
- Strict DDD architecture with bounded context
- Domain entities:
Inventory,StockItem,SupplyOrder - Immutable value objects:
ProductId,Quantity,SupplierId,Unit - Domain events for audit trails:
StockDepleted,StockReplenished,SupplyOrderPlaced,SupplyOrderReceived - Domain policies:
RestockPolicy - Abstract ports:
Clock,Supplier(Dependency Inversion Principle) - Concrete infrastructure:
SystemClock - Application service:
InventoryManagementService
Invariants Protected #
- ✅ Stock can never go negative
- ✅ Supply order lifecycle strictly enforced (pending → approved → shipped → received)
- ✅ Quantity mismatches on order receipt throw errors (no silent corrections)
- ✅ Products can only be removed from inventory when quantity is zero
- ✅ All stock changes emit domain events
Testing #
- Comprehensive test suite with 100% invariant coverage
FakeClockfor deterministic time controlFakeSupplierfor integration testing- Same input + same time = same output guaranteed
Architecture Principles #
- No
DateTime.now()in domain layer - Clock injection everywhere time is needed
- No setters, no mutable value objects
- All domain logic in entities and policies
- Services orchestrate, never bypass entity rules