i am getting this error back to back can any one help me fix this
ERROR:
TypeError: (0 , jsreport_1.default) is not a function
FULL ERROR:
Error with jsreport: TypeError: (0 , jsreport_1.default) is not a function
at C:\Users\naser\projects\websites\clint_site\PerfAI-Inc\WebApp-API\src\design_analysis_service\report_generation.ts:27:37
at makeGovernanceReport (C:\Users\naser\projects\websites\clint_site\PerfAI-Inc\WebApp-API\src\design_analysis_service\report_generation.ts:37:7)
at DesignAnalysisService.processDocument (C:\Users\naser\projects\websites\clint_site\PerfAI-Inc\WebApp-API\src\design_analysis_service\design_analysis.service.ts:423:37)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
CODE:
let jsReportGenerator;
(async () => {
try {
// Log to indicate the start of the jsreport process
console.log('jsreport initializing...');
// const configPath = join(process.cwd(), 'jsreport.config.json');
// const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
// // Initialize jsreport with the configuration
// console.log('The config file: ', config);
jsReportGenerator = JsReport();
await jsReportGenerator.init();
console.log('jsreport generator started');
// Call the printReport function
await printReport('your-template-name'); // Replace 'your-template-name' with the actual template name
} catch (error) {
console.error('Error with jsreport:', error);
}
})();
// Define the printReport function
const printReport = async (name) => {
try {
const result = await jsReportGenerator.render({
template: {
content: '<h1>Hello World!</h1>', // Ensure this function is defined and working
engine: 'handlebars',
recipe: 'chrome-pdf',
helpers: `
function alias(items, inflList) {
let finder = inflList.find(e => e === items);
return finder ? finder : 'Unknown Source';
}
`,
},
});
// Write the report buffer to a file
await fs.writeFileSync('InfluenceReport.pdf', result.content);
console.log('Report generated and saved successfully.');
} catch (error) {
console.error('Error generating report:', error);
}
};