wulf-pulse/lib/services/auvik-factory.ts
root 6eee14f8af Add comprehensive admin features and multi-system integration
- Add admin dashboard with sync controls and data browser
- Implement RMM, Auvik, and Addigy organization mappings
- Add chunked ticket sync with progress tracking
- Implement entity sync service with rate limiting
- Add analytics engine and performance optimizer
- Create data browser for all PSA entities
- Add navigation components and UI improvements
- Implement background processing and sync services
- Add comprehensive documentation and migration scripts
- Update configuration items with multi-system support
- Enhance contact management and purchase history
- Add issue type assignment and LLM analyzer
- Improve error handling and logging utilities
2025-11-19 14:18:16 -05:00

37 lines
1 KiB
TypeScript

import { AuvikClient } from './auvik-client';
import { AuvikClientConfig } from '../types/auvik';
let auvikClientInstance: AuvikClient | null = null;
/**
* Get or create Auvik client singleton instance
*/
export function getAuvikClient(): AuvikClient {
if (!auvikClientInstance) {
const config: AuvikClientConfig = {
apiUrl: process.env.AUVIK_API_URL || '',
apiUser: process.env.AUVIK_API_USER || '',
apiKey: process.env.AUVIK_API_KEY || '',
};
// Validate configuration
if (!config.apiUrl || !config.apiUser || !config.apiKey) {
console.error('Auvik API credentials not configured');
throw new Error(
'Auvik API credentials missing. Please set AUVIK_API_URL, AUVIK_API_USER, and AUVIK_API_KEY environment variables.'
);
}
auvikClientInstance = new AuvikClient(config);
console.log('Auvik client initialized');
}
return auvikClientInstance;
}
/**
* Reset the singleton instance (useful for testing)
*/
export function resetAuvikClient(): void {
auvikClientInstance = null;
}