02b51d7814
- Repository interfaces defined by domain (@landvex/domain) - 6 in-memory adapters: Session, Mission, DecisionCase, Artifact, EventStore, UnitOfWork - 9 tests verifying adapter contracts - Domain unchanged — infrastructure depends on domain, never reverse - ADR-006: In-Memory Adapters for Testing Definition of Done met: - All adapters compile against domain interfaces - Unit tests pass (9/9) - No PostgreSQL, S3, Express, AI in this PR - Ready for PR-003: PostgreSQL adapters
54 lines
1.5 KiB
Markdown
54 lines
1.5 KiB
Markdown
# @landvex/infrastructure
|
|
|
|
Persistence adapters and infrastructure for LandveX domain.
|
|
|
|
## Architecture
|
|
|
|
```
|
|
Domain (interfaces) ← Infrastructure (adapters)
|
|
```
|
|
|
|
- **Domain defines** repository interfaces (WHAT)
|
|
- **Infrastructure implements** them (HOW)
|
|
- **Domain never depends** on infrastructure
|
|
|
|
## Repository Interfaces
|
|
|
|
| Interface | Purpose |
|
|
|-----------|---------|
|
|
| `FieldSessionRepository` | Store/retrieve field sessions |
|
|
| `MissionRepository` | Store/retrieve missions |
|
|
| `DecisionCaseRepository` | Store/retrieve decision cases |
|
|
| `ArtifactRegistry` | Register/find artifacts |
|
|
| `EventStore` | Append-only event log |
|
|
| `UnitOfWork` | Coordinate multiple repositories |
|
|
|
|
## In-Memory Adapters
|
|
|
|
For testing and development:
|
|
|
|
| Adapter | Data Structure |
|
|
|---------|---------------|
|
|
| `InMemoryFieldSessionRepository` | Map<string, FieldSession> |
|
|
| `InMemoryMissionRepository` | Map<string, Mission> |
|
|
| `InMemoryDecisionCaseRepository` | Map<string, DecisionCase> |
|
|
| `InMemoryArtifactRegistry` | Map<string, Artifact> |
|
|
| `InMemoryEventStore` | Array<DomainEvent> |
|
|
| `InMemoryUnitOfWork` | Coordinates all above |
|
|
|
|
## Future Adapters
|
|
|
|
| Adapter | Technology | Status |
|
|
|---------|-----------|--------|
|
|
| PostgreSQL repositories | PostgreSQL | Planned |
|
|
| S3 Artifact Registry | AWS S3 / Cloudflare R2 | Planned |
|
|
| Event Store | PostgreSQL / EventStoreDB | Planned |
|
|
|
|
## ADRs
|
|
|
|
- ADR-006: In-Memory Adapters for Testing
|
|
|
|
## Dependencies
|
|
|
|
- `@landvex/domain` — repository interfaces depend on domain types
|