feat: scrip engine implementation — real SMTP, webhooks, DB actions
- config.ts: add SMTP_HOST, SMTP_PORT, SMTP_USER, SMTP_PASS, SMTP_FROM
- engine.ts: prepare() queries real scrips from DB, matches by queue_id + condition_type, loads lifecycle for OnResolve context, renders Handlebars templates, builds PreparedScrip. commit() dispatches to real action executors.
- actions.ts: SendEmail via nodemailer SMTP, Webhook via fetch POST, SetCustomField writes to custom_field_values table
- conditions.ts: OnResolve uses LifecycleValidator.isResolvedStatus()
- tickets.ts: updated to pass lifecycleDef context to scrip engine
- nodemailer installed
- Port changed to 9876 (8080 occupied by Apache)
Verification: bun run src/index.ts starts server, GET /health returns {"status":"ok","version":"0.1.0"}
This commit is contained in:
@@ -170,7 +170,7 @@ export function createTicketsRouter(db: Db): Hono {
|
||||
|
||||
// Run scrips
|
||||
const prepared = await scripEngine.prepare(id, txList as any);
|
||||
const results = scripEngine.commit(prepared);
|
||||
const results = await scripEngine.commit(prepared);
|
||||
|
||||
return c.json({ ticket: updated, scrip_results: results });
|
||||
});
|
||||
@@ -205,7 +205,7 @@ export function createTicketsRouter(db: Db): Hono {
|
||||
|
||||
const prepared = await scripEngine.prepare(id, txList);
|
||||
const preparedWithDryRun = prepared.map((p) => ({ ...p, dryRun: true }));
|
||||
const results = scripEngine.commit(preparedWithDryRun);
|
||||
const results = await scripEngine.commit(preparedWithDryRun);
|
||||
|
||||
return c.json({ prepared_scrips: results });
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user