UNPKG

@visionfi/desktop-sdk

Version:

Desktop SDK for VisionFI Cloud Run services with Azure AD authentication

105 lines (94 loc) 2.14 kB
/** * Desktop-specific types for VisionFI Cloud Run client * Copyright (c) 2024-2025 VisionFI. All Rights Reserved. */ /** * Configuration options for the desktop client */ export interface VisionFIDesktopConfig { /** * Tenant API endpoint URL * @example 'https://your-service.run.app' */ tenantApiUrl: string; /** * Function to retrieve Azure AD access token * Should handle token refresh automatically */ getAccessToken: () => Promise<string>; /** * Callback when token expires */ onTokenExpired?: () => void; /** * Enable offline mode with queue * @default false */ offlineMode?: boolean; /** * Maximum retry attempts for failed requests * @default 3 */ maxRetries?: number; /** * Initial retry delay in milliseconds * @default 1000 */ retryDelay?: number; /** * Request timeout in milliseconds * @default 30000 */ timeout?: number; } /** * Upload progress information */ export interface UploadProgress { /** File being uploaded */ fileName: string; /** Bytes uploaded so far */ bytesUploaded: number; /** Total file size in bytes */ totalBytes: number; /** Upload percentage (0-100) */ percentage: number; /** Upload speed in bytes per second */ speed: number; /** Estimated time remaining in seconds */ remainingTime: number; } /** * Connection status */ export type ConnectionStatus = 'online' | 'offline' | 'connecting'; /** * Offline queue operation */ export interface QueuedOperation { /** Unique operation ID */ id: string; /** Method name to call */ method: string; /** Arguments for the method */ args: any[]; /** Timestamp when queued */ timestamp: number; /** Number of retry attempts */ retryCount: number; /** Priority level (higher = more important) */ priority?: number; } /** * Sync result for offline operations */ export interface SyncResult { /** Operation ID */ operationId: string; /** Whether sync was successful */ success: boolean; /** Result data if successful */ result?: any; /** Error if failed */ error?: Error; }