supply_inventory 1.0.0 copy "supply_inventory: ^1.0.0" to clipboard
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
  • FakeClock for deterministic time control
  • FakeSupplier for 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
0
likes
140
points
9
downloads

Publisher

unverified uploader

Weekly Downloads

A production-grade DDD package for supply chain and inventory management with strict invariant protection and time safety.

Documentation

API reference

License

MIT (license)

More

Packages that depend on supply_inventory