You may want to run the functions inside a transaction. You can do it as the following:
import { createConnection } from "mysql2/promise"; const conn = await createConnection({ host: "localhost", database: "mydb", user: "root", password: "password",}); //call the functions generated by TypeSQLtry { await conn.beginTransaction(); await insertIntoFoo(conn, ...); await insertIntoBar(conn, ...); // ... await conn.commit();} catch (error) { await conn.rollback();}