/** * Common Type Definitions * Shared utility types used across all domains */ /** * ISO 8601 timestamp string (e.g., "2025-12-09T10:30:45.123Z") */ export type Timestamp = string & { readonly __brand: 'Timestamp'; }; /** * UUID v4 format (e.g., "550e8400-e29b-41d4-a716-446655440000") */ export type UUID = string & { readonly __brand: 'UUID'; }; /** * Email address with basic validation */ export type Email = string & { readonly __brand: 'Email'; }; /** * URL string */ export type URL = string & { readonly __brand: 'URL'; }; /** * ISO 3166-1 alpha-2 language code (e.g., "en", "fr", "de") */ export type LocaleCode = 'en' | 'fr' | 'de' | 'es' | 'it' | 'ja' | 'zh' | 'pt' | 'ru' | 'ko'; /** * Generic Result type for operations * Success: { ok: true, data: T } * Error: { ok: false, error: E } */ export type Result = { readonly ok: true; readonly data: T; } | { readonly ok: false; readonly error: E; }; /** * Pagination metadata */ export interface Pagination { page: number; pageSize: number; total: number; hasMore: boolean; } /** * Paginated response wrapper */ export interface PaginatedResponse { items: T[]; pagination: Pagination; } /** * API error response */ export interface ApiError { code: ErrorCode; message: string; details?: Record; timestamp: Timestamp; requestId: UUID; } /** * Error codes for API responses */ export type ErrorCode = 'VALIDATION_ERROR' | 'AUTHENTICATION_ERROR' | 'AUTHORIZATION_ERROR' | 'NOT_FOUND' | 'CONFLICT' | 'INTERNAL_SERVER_ERROR' | 'SERVICE_UNAVAILABLE' | 'RATE_LIMIT_EXCEEDED' | 'BAD_REQUEST' | 'UNPROCESSABLE_ENTITY'; /** * Represents any JSON-serializable value */ export type JSONValue = string | number | boolean | null | JSONValue[] | { [key: string]: JSONValue; }; /** * Create a branded type helper */ export declare function createBrand(value: string): T & { readonly __brand: any; }; /** * Type guard for Result success */ export declare function isSuccess(result: Result): result is { ok: true; data: T; }; /** * Type guard for Result error */ export declare function isError(result: Result): result is { ok: false; error: Error; }; /** * Helper to create Result success */ export declare function ok(data: T): Result; /** * Helper to create Result error */ export declare function err(error: Error): Result; //# sourceMappingURL=common.d.ts.map