"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const processor_1 = require("./chunking/processor");
async function testChunking() {
try {
console.log('Testing chunking system...');
// Sample Apex class data (from your CallManagementService)
const apexMetadata = {
fullName: 'CallManagementService',
Body: `public class CallManagementService {
@AuraEnabled
public static CallInitiationResponse initiateDirectCall(String phoneNumber, String assistantId) {
CallInitiationResponse response = new CallInitiationResponse();
if (String.isBlank(phoneNumber)) {
response.success = false;
response.error = 'Phone number is required';
return response;
}
return response;
}
private static String getDefaultAssistantId() {
try {
List<aidialer__AI_Dialer_Setting__mdt> settings = [
SELECT aidialer__Value__c
FROM aidialer__AI_Dialer_Setting__mdt
WHERE DeveloperName = 'Default_Assistant_ID'
LIMIT 1
];
if (!settings.isEmpty()) {
return settings[0].aidialer__Value__c;
}
} catch (Exception e) {
System.debug('Error getting default assistant ID: ' + e.getMessage());
}
return '64b4c1c2-c370-49b3-b755-258d6288eb27';
}
}`,
createdDate: '2025-08-27T19:35:30.000+0000',
lastModifiedDate: '2025-08-31T14:43:19.000+0000'
};
// Test Apex chunking
const processor = new processor_1.MetadataProcessor();
const chunks = await processor.processMetadata(apexMetadata, 'ApexClass', 'test_org_123');
console.log(`\n✓ Generated ${chunks.length} chunks for CallManagementService:`);
chunks.forEach((chunk, index) => {
console.log(`\nChunk ${index + 1}:`);
console.log(` ID: ${chunk.id}`);
console.log(` Name: ${chunk.name}`);
console.log(` Path: ${chunk.path}`);
console.log(` Symbols: ${chunk.symbols.slice(0, 5).join(', ')}${chunk.symbols.length > 5 ? '...' : ''}`);
console.log(` Content (first 200 chars): ${chunk.content.substring(0, 200)}...`);
});
console.log('\n✓ Chunking system test completed successfully!');
}
catch (error) {
console.error('✗ Chunking test failed:', error);
}
}
testChunking();