/** * Type definitions for SolidWorks adapter pattern * Enhanced with comprehensive operation support and robust error handling */ import { z } from 'zod'; import type { SolidWorksFeature, SolidWorksModel } from '../solidworks/types.js'; /** * Base interface for all SolidWorks adapters */ export interface ISolidWorksAdapter { connect(): Promise; disconnect(): Promise; isConnected(): boolean; healthCheck(): Promise; execute(command: Command): Promise>; executeRaw(method: string, args: any[]): Promise; openModel(filePath: string): Promise; closeModel(save?: boolean): Promise; createPart(): Promise; createAssembly(): Promise; createDrawing(): Promise; createExtrusion(params: ExtrusionParameters): Promise; createRevolve(params: RevolveParameters): Promise; createSweep(params: SweepParameters): Promise; createLoft(params: LoftParameters): Promise; createSketch(plane: string): Promise; addLine(x1: number, y1: number, x2: number, y2: number): Promise; addCircle(centerX: number, centerY: number, radius: number): Promise; addRectangle(x1: number, y1: number, x2: number, y2: number): Promise; exitSketch(): Promise; getMassProperties(): Promise; exportFile(filePath: string, format: string): Promise; getDimension(name: string): Promise; setDimension(name: string, value: number): Promise; } /** * Adapter health status */ export interface AdapterHealth { healthy: boolean; lastCheck: Date; errorCount: number; successCount: number; averageResponseTime: number; connectionStatus: 'connected' | 'disconnected' | 'error'; metrics?: { directCOMCalls?: number; macroFallbacks?: number; successRate?: number; }; } /** * Command pattern for SolidWorks operations */ export interface Command { name: string; parameters: Record; validate(): ValidationResult; fallback?: Command; timeout?: number; retryable?: boolean; priority?: number; } /** * Validation result for commands */ export interface ValidationResult { valid: boolean; errors?: string[]; warnings?: string[]; } /** * Result wrapper for adapter operations */ export interface AdapterResult { success: boolean; data?: T; error?: string; timing?: { start: Date | number; end: Date | number; duration: number; }; metadata?: Record; } /** * Base command class with common functionality */ export declare abstract class BaseCommand implements Command { abstract name: string; abstract parameters: Record; fallback?: Command; timeout: number; retryable: boolean; validate(): ValidationResult; /** * Transform parameters before execution */ protected transformParameters(): Record; } /** * Extrusion command with validation and fallback */ export declare class CreateExtrusionCommand extends BaseCommand { name: string; parameters: { depth: number; reverse?: boolean; bothDirections?: boolean; draft?: number; merge?: boolean; [key: string]: any; }; constructor(parameters: { depth: number; reverse?: boolean; bothDirections?: boolean; draft?: number; merge?: boolean; [key: string]: any; }); validate(): ValidationResult; } /** * VBA-based fallback for extrusion */ export declare class CreateExtrusionVBACommand extends BaseCommand { name: string; parameters: Record; constructor(extrusionParams: Record); } /** * Adapter factory for creating appropriate adapter based on configuration */ export declare class AdapterFactory { private static adapters; static register(type: string, factory: () => Promise): void; static create(type?: string): Promise; } /** * Circuit breaker for handling adapter failures */ export declare class CircuitBreaker { private threshold; private timeout; private failures; private lastFailureTime?; private state; constructor(threshold?: number, timeout?: number, _halfOpenRequests?: number); execute(fn: () => Promise): Promise; private onSuccess; private onFailure; getState(): "CLOSED" | "OPEN" | "HALF_OPEN"; reset(): void; } /** * Connection pool for managing multiple SolidWorks connections */ export declare class ConnectionPool { private factory; private minSize; private maxSize; private connections; private available; private inUse; constructor(factory: () => Promise, minSize?: number, maxSize?: number); initialize(): Promise; acquire(): Promise; release(adapter: ISolidWorksAdapter): void; destroy(): Promise; } /** * Batch processor for executing multiple commands efficiently */ export declare class BatchProcessor { private adapter; private batchSize; private delay; private queue; private processing; constructor(adapter: ISolidWorksAdapter, batchSize?: number, delay?: number); add(command: Command): Promise; private process; } /** * Event types for adapter events */ export interface AdapterEvents { connected: undefined; disconnected: undefined; 'command:start': { command: Command; }; 'command:success': { command: Command; result: any; }; 'command:failure': { command: Command; error: Error; }; 'health:check': { healthy: boolean; }; } /** * Schema definitions for common SolidWorks types */ export declare const ModelSchema: z.ZodObject<{ path: z.ZodString; name: z.ZodString; type: z.ZodEnum<["Part", "Assembly", "Drawing"]>; isActive: z.ZodBoolean; configurations: z.ZodOptional>; }, "strip", z.ZodTypeAny, { name: string; path: string; type: "Part" | "Assembly" | "Drawing"; isActive: boolean; configurations?: string[] | undefined; }, { name: string; path: string; type: "Part" | "Assembly" | "Drawing"; isActive: boolean; configurations?: string[] | undefined; }>; export declare const FeatureSchema: z.ZodObject<{ id: z.ZodString; name: z.ZodString; type: z.ZodString; suppressed: z.ZodBoolean; parameters: z.ZodRecord; }, "strip", z.ZodTypeAny, { id: string; name: string; parameters: Record; type: string; suppressed: boolean; }, { id: string; name: string; parameters: Record; type: string; suppressed: boolean; }>; export declare const SketchSchema: z.ZodObject<{ id: z.ZodString; name: z.ZodString; plane: z.ZodString; entities: z.ZodArray; }, "strip", z.ZodTypeAny, { id: string; type: string; coordinates: number[]; }, { id: string; type: string; coordinates: number[]; }>, "many">; }, "strip", z.ZodTypeAny, { id: string; name: string; plane: string; entities: { id: string; type: string; coordinates: number[]; }[]; }, { id: string; name: string; plane: string; entities: { id: string; type: string; coordinates: number[]; }[]; }>; export type Model = z.infer; export type Feature = z.infer; export type Sketch = z.infer; /** * Parameter types for feature operations */ export interface ExtrusionParameters { depth: number; reverse?: boolean; bothDirections?: boolean; depth2?: number; draft?: number; draftOutward?: boolean; draftWhileExtruding?: boolean; offsetDistance?: number; offsetReverse?: boolean; translateSurface?: boolean; merge?: boolean; flipSideToCut?: boolean; startCondition?: number; endCondition?: number | string; thinFeature?: boolean; thinThickness?: number; thinType?: string; capEnds?: boolean; capThickness?: number; } export interface RevolveParameters { angle: number; axis?: string; direction?: number | string; merge?: boolean; thinFeature?: boolean; thinThickness?: number; } export interface SweepParameters { profileSketch: string; pathSketch: string; twistAngle?: number; merge?: boolean; thinFeature?: boolean; thinThickness?: number; } export interface LoftParameters { profiles: string[]; guides?: string[]; guideCurves?: string[]; centerCurve?: string; closed?: boolean; close?: boolean; startTangency?: string; endTangency?: string; merge?: boolean; thinFeature?: boolean; thinThickness?: number; } export interface MassProperties { mass: number; volume: number; surfaceArea: number; centerOfMass: { x: number; y: number; z: number; }; density?: number; momentsOfInertia?: { Ixx: number; Iyy: number; Izz: number; Ixy: number; Iyz: number; Ixz: number; }; } /** * Adapter configuration */ export interface AdapterConfig { type: 'winax' | 'macro-fallback' | 'hybrid' | 'winax-enhanced'; enableCircuitBreaker?: boolean; circuitBreakerThreshold?: number; circuitBreakerTimeout?: number; enableRetry?: boolean; maxRetries?: number; retryDelay?: number; enableConnectionPool?: boolean; poolSize?: number; enableMetrics?: boolean; enableLogging?: boolean; logLevel?: 'debug' | 'info' | 'warn' | 'error'; macroPath?: string; } //# sourceMappingURL=types.d.ts.map