adpa-enterprise-framework-automation
Version:
Modular, standards-compliant Node.js/TypeScript automation framework for enterprise requirements, project, and data management. Provides CLI and API for BABOK v3, PMBOK 7th Edition, and DMBOK 2.0 (in progress). Production-ready Express.js API with TypeSpe
91 lines โข 3.92 kB
JavaScript
import { indesignClient } from './creative-suite/indesign-client.js';
import { illustratorClient } from './creative-suite/illustrator-client.js';
import { photoshopClient } from './creative-suite/photoshop-client.js';
import { documentGenerationClient } from './creative-suite/document-generation-client.js';
import { CredentialManager } from './setup-credentials.js';
export class ConnectionTester {
clients;
credentialManager;
constructor() {
this.credentialManager = new CredentialManager();
const credentials = this.credentialManager.getCredentials();
if (!credentials) {
throw new Error('Adobe credentials not found. Run adobe:creative-setup first.');
}
this.clients = {
indesign: indesignClient,
illustrator: illustratorClient,
photoshop: photoshopClient,
docGen: documentGenerationClient
};
}
async testAllConnections() {
console.log('๐งช Testing Adobe Creative Cloud API Connections');
console.log('===============================================');
const tests = [
{ name: 'InDesign Server', client: this.clients.indesign },
{ name: 'Illustrator', client: this.clients.illustrator },
{ name: 'Photoshop', client: this.clients.photoshop },
{ name: 'Document Generation', client: this.clients.docGen }
];
let passedTests = 0;
let totalTests = tests.length;
for (const test of tests) {
const success = await this.testConnection(test.name, test.client);
if (success)
passedTests++;
}
console.log('\\n๐ Test Results:');
console.log(`โ
Passed: ${passedTests}/${totalTests}`);
console.log(`โ Failed: ${totalTests - passedTests}/${totalTests}`);
if (passedTests === totalTests) {
console.log('\\n๐ All Adobe Creative Suite APIs are ready!');
}
else {
console.log('\\nโ ๏ธ Some APIs need attention before proceeding.');
}
}
async testConnection(name, client) {
try {
console.log(`Testing ${name}...`);
await client.testConnection();
console.log(`โ
${name} connection successful`);
return true;
}
catch (error) {
console.log(`โ ${name} connection failed:`, error.message);
// Provide helpful error guidance
if (error.message.includes('401')) {
console.log(' ๐ก Check your API credentials');
}
else if (error.message.includes('403')) {
console.log(' ๐ก Check your API permissions');
}
else if (error.message.includes('ENOTFOUND')) {
console.log(' ๐ก Check your network connection');
}
else if (error.message.includes('timeout')) {
console.log(' ๐ก API might be temporarily unavailable');
}
console.log('');
return false;
}
}
async testSpecificAPI(apiName) {
console.log(`๐ Testing specific API: ${apiName}`);
const clientMap = {
indesign: { name: 'InDesign Server', client: this.clients.indesign },
illustrator: { name: 'Illustrator', client: this.clients.illustrator },
photoshop: { name: 'Photoshop', client: this.clients.photoshop },
docGen: { name: 'Document Generation', client: this.clients.docGen }
};
const test = clientMap[apiName];
return await this.testConnection(test.name, test.client);
}
}
// Run tests if called directly
if (import.meta.url === `file://${process.argv[1]}`) {
const tester = new ConnectionTester();
tester.testAllConnections().catch(console.error);
}
//# sourceMappingURL=test-connections.js.map