feat: add plugin

- add plugin system that request may included to run before do actual request by type.

Signed-off-by: Pakin <pakin.t@forth.co.th>
This commit is contained in:
Pakin 2026-05-12 12:40:32 +07:00
parent d048dc2437
commit d7f5e12d51
9 changed files with 1492 additions and 15 deletions

View file

@ -0,0 +1,18 @@
export const handler = {
processMessage(input) {
// input should be { type_w: "...", "payload": { plugin: "", ... } }
let n_input = JSON.parse(input);
console.log(`processing: ${input}`);
try {
// delete n_input["payload"]["plugin"];
return JSON.stringify({
type_w: n_input.type,
payload: n_input.payload
});
} catch (e) {
return `JSERROR: ${e.message}\nStack: ${e.stack}`;
}
}
};