type Mysql = { host: string; port: number; user: string; password: string; database: string; }; type LoginRecord = { username: string; lastaccess: string; ipaddress: string; memberof: string; }; export async function main( database: Mysql, record: LoginRecord ): Promise<{ inserted: boolean }> { const mysql2 = await import("mysql2/promise"); const conn = await mysql2.createConnection({ host: database.host, port: database.port, user: database.user, password: database.password, database: database.database, }); try { await conn.execute( "INSERT INTO `bronze.services.reporting` (username, lastaccess, ipaddress, add_date, memberof) VALUES (?, ?, ?, NOW(), ?)", [record.username, record.lastaccess, record.ipaddress, record.memberof] ); return { inserted: true }; } finally { await conn.end(); } }