25 lines
586 B
TypeScript
25 lines
586 B
TypeScript
/**
|
|
* ViewModel Builder Contract
|
|
*
|
|
* Purpose: Transform API Transport DTOs into ViewModels
|
|
*
|
|
* Rules:
|
|
* - Deterministic and side-effect free
|
|
* - No HTTP/API calls
|
|
* - Input: API Transport DTO
|
|
* - Output: ViewModel
|
|
* - Must be in lib/builders/view-models/
|
|
* - Must be named *ViewModelBuilder
|
|
* - Must have 'use client' directive
|
|
* - Must implement static build() method
|
|
*/
|
|
|
|
export interface ViewModelBuilder<TInput, TOutput> {
|
|
/**
|
|
* Transform DTO into ViewModel
|
|
*
|
|
* @param dto - API Transport DTO
|
|
* @returns ViewModel
|
|
*/
|
|
build(dto: TInput): TOutput;
|
|
} |