in src/service.ts [449:472]
private registerApplicationContextHook(config: IEmbedConfiguration): void {
const applicationContextProvider = config?.eventHooks?.applicationContextProvider;
if (!applicationContextProvider) {
return;
}
if (config?.type.toLowerCase() !== "report") {
throw new Error("applicationContextProvider is only supported in report embed");
}
if (typeof applicationContextProvider !== 'function') {
throw new Error("applicationContextProvider must be a function");
}
this.router.post(`preQuery`, async (req, _res) => {
try {
const result = await applicationContextProvider(req.body);
_res.send(200, result);
} catch (error) {
_res.send(400, null);
console.error(error);
}
});
}