Implement foundational components for Banatie API v2.0 with dual alias system,
flows support, and comprehensive type safety.
**Type Definitions:**
- Add models.ts with database types (Generation, Image, Flow, etc.)
- Add requests.ts with all v2 API request types
- Add responses.ts with standardized response types and converters
- Support for pagination, filters, and complex relations
**Constants:**
- Define technical aliases (@last, @first, @upload)
- Define reserved aliases and validation patterns
- Add rate limits for master/project keys (2-bucket system)
- Add pagination, image, generation, and flow limits
- Comprehensive error messages and codes
**Validators:**
- aliasValidator: Format validation, reserved alias checking
- paginationValidator: Bounds checking with normalization
- queryValidator: UUID, aspect ratio, focal point, date range validation
**Helpers:**
- paginationBuilder: Standardized pagination response construction
- hashHelper: SHA-256 utilities for caching and file deduplication
- queryHelper: Reusable WHERE clause builders with soft delete support
**Core Services:**
- AliasService: 3-tier alias resolution (technical → flow → project)
- Technical alias computation (@last, @first, @upload)
- Flow-scoped alias lookup from JSONB
- Project-scoped alias lookup with uniqueness
- Conflict detection and validation
- Batch resolution support
**Dependencies:**
- Add drizzle-orm to api-service for direct ORM usage
All Phase 1 code is type-safe with zero TypeScript errors.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>