/** * Core Abstractions and Interfaces * These form the foundation of our clean architecture */ export type Success = { success: true; data: T; }; export type Failure = { success: false; error: E; }; export type Result = Success | Failure; export declare class ResultUtil { static ok(data: T): Success; static fail(error: E): Failure; static isSuccess(result: Result): result is Success; static isFailure(result: Result): result is Failure; static map(result: Result, fn: (data: T) => U): Result; static flatMap(result: Result, fn: (data: T) => Result): Result; static fromPromise(promise: Promise, errorHandler?: (error: unknown) => Error): Promise>; } export declare abstract class DomainError extends Error { readonly details?: unknown | undefined; abstract readonly code: string; abstract readonly statusCode: number; constructor(message: string, details?: unknown | undefined); toJSON(): { name: string; code: string; message: string; details: unknown; stack: string | undefined; }; } export declare class ConnectionError extends DomainError { readonly code = "CONNECTION_ERROR"; readonly statusCode = 503; } export declare class ModelNotFoundError extends DomainError { readonly code = "MODEL_NOT_FOUND"; readonly statusCode = 404; } export declare class InvalidOperationError extends DomainError { readonly code = "INVALID_OPERATION"; readonly statusCode = 400; } export declare class ValidationError extends DomainError { readonly code = "VALIDATION_ERROR"; readonly statusCode = 422; } export declare class COMError extends DomainError { readonly code = "COM_ERROR"; readonly statusCode = 500; } /** * Connection management interface */ export interface IConnection { connect(): Promise>; disconnect(): Promise>; isConnected(): boolean; getConnection(): T | null; healthCheck(): Promise>; } /** * Repository pattern interface */ export interface IRepository { findById(id: ID): Promise>; findAll(): Promise>; save(entity: T): Promise>; update(id: ID, entity: Partial): Promise>; delete(id: ID): Promise>; exists(id: ID): Promise>; } /** * Unit of Work pattern for transactions */ export interface IUnitOfWork { begin(): Promise>; commit(): Promise>; rollback(): Promise>; inTransaction(): boolean; } /** * Command pattern interface */ export interface ICommand { execute(params: TParams): Promise>; canExecute(params: TParams): Promise>; validate(params: TParams): Result; } /** * Query pattern interface */ export interface IQuery { execute(params: TParams): Promise>; validate(params: TParams): Result; } /** * Event interface for Observer pattern */ export interface IEvent { readonly id: string; readonly timestamp: Date; readonly type: string; readonly payload?: unknown; } /** * Event handler interface */ export interface IEventHandler { handle(event: T): Promise>; canHandle(event: IEvent): boolean; } /** * Event bus interface */ export interface IEventBus { publish(event: IEvent): Promise>; subscribe(eventType: string, handler: IEventHandler): void; unsubscribe(eventType: string, handler: IEventHandler): void; } /** * SolidWorks model types */ export declare enum ModelType { Part = "Part", Assembly = "Assembly", Drawing = "Drawing" } /** * SolidWorks model interface */ export interface ISolidWorksModel { readonly id: string; readonly path: string; readonly name: string; readonly type: ModelType; readonly isActive: boolean; readonly isDirty: boolean; readonly metadata?: Record; } /** * SolidWorks feature interface */ export interface ISolidWorksFeature { readonly id: string; readonly name: string; readonly type: string; readonly suppressed: boolean; readonly parameters?: Record; } /** * SolidWorks dimension interface */ export interface ISolidWorksDimension { readonly name: string; readonly value: number; readonly feature: string; readonly tolerance?: { upper: number; lower: number; }; } /** * SolidWorks API adapter interface */ export interface ISolidWorksAdapter { connect(): Promise>; disconnect(): Promise>; isConnected(): boolean; openModel(path: string): Promise>; closeModel(save: boolean): Promise>; createPart(): Promise>; getCurrentModel(): Result; saveModel(path?: string): Promise>; createFeature(params: unknown): Promise>; getFeatures(): Promise>; suppressFeature(name: string): Promise>; getDimension(name: string): Promise>; setDimension(name: string, value: number): Promise>; listDimensions(): Promise>; exportModel(path: string, format: string): Promise>; } /** * Configuration provider interface */ export interface IConfigurationProvider { get(key: string): T | undefined; getRequired(key: string): T; set(key: string, value: unknown): void; has(key: string): boolean; validate(): Result; reload(): Promise>; } /** * Logger interface */ export interface ILogger { debug(message: string, context?: Record): void; info(message: string, context?: Record): void; warn(message: string, context?: Record): void; error(message: string, error?: Error, context?: Record): void; fatal(message: string, error?: Error, context?: Record): void; } /** * Abstract factory interface */ export interface IFactory { create(params: TParams): Result; canCreate(params: TParams): boolean; } /** * Service locator interface (for dependency injection) */ export interface IServiceLocator { register(token: symbol | string, instance: T): void; resolve(token: symbol | string): T; has(token: symbol | string): boolean; reset(): void; } /** * Validator interface */ export interface IValidator { validate(input: unknown): Result; isValid(input: unknown): boolean; } /** * Validation rule interface */ export interface IValidationRule { validate(value: T): Result; message: string; } /** * Middleware interface for request processing pipeline */ export interface IMiddleware { execute(context: TContext, next: () => Promise>): Promise>; } /** * Pipeline interface */ export interface IPipeline { use(middleware: IMiddleware): void; execute(context: TContext): Promise>; } /** * Cache interface */ export interface ICache { get(key: string): Promise>; set(key: string, value: T, ttl?: number): Promise>; has(key: string): Promise>; delete(key: string): Promise>; clear(): Promise>; size(): Promise>; } /** * Metrics collector interface */ export interface IMetricsCollector { increment(metric: string, value?: number, tags?: Record): void; gauge(metric: string, value: number, tags?: Record): void; histogram(metric: string, value: number, tags?: Record): void; timing(metric: string, duration: number, tags?: Record): void; } /** * Health check interface */ export interface IHealthCheck { name: string; check(): Promise>; } export interface HealthStatus { status: 'healthy' | 'degraded' | 'unhealthy'; message?: string; details?: Record; } export declare const TypeGuards: { isModelType(value: unknown): value is ModelType; isSolidWorksModel(value: unknown): value is ISolidWorksModel; isError(value: unknown): value is Error; isDomainError(value: unknown): value is DomainError; }; //# sourceMappingURL=core-abstractions.d.ts.map